diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-12-27 14:36:33 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-12-27 14:36:33 +0900 |
| commit | 9384f5399da39e53855beb8e7f8ded1aa56bf72e (patch) | |
| tree | ce5959571a981b9c4047da3c7b3fd080aa44222c /packages/frontend/src/ui/deck/widgets-column.vue | |
| parent | wip: retention for dashboard (diff) | |
| download | misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.gz misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.bz2 misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.zip | |
rename: client -> frontend
Diffstat (limited to 'packages/frontend/src/ui/deck/widgets-column.vue')
| -rw-r--r-- | packages/frontend/src/ui/deck/widgets-column.vue | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/packages/frontend/src/ui/deck/widgets-column.vue b/packages/frontend/src/ui/deck/widgets-column.vue new file mode 100644 index 0000000000..fc61d18ff6 --- /dev/null +++ b/packages/frontend/src/ui/deck/widgets-column.vue @@ -0,0 +1,69 @@ +<template> +<XColumn :menu="menu" :naked="true" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)"> + <template #header><i class="ti ti-apps" style="margin-right: 8px;"></i>{{ column.name }}</template> + + <div class="wtdtxvec"> + <div v-if="!(column.widgets && column.widgets.length > 0) && !edit" class="intro">{{ i18n.ts._deck.widgetsIntroduction }}</div> + <XWidgets :edit="edit" :widgets="column.widgets" @add-widget="addWidget" @remove-widget="removeWidget" @update-widget="updateWidget" @update-widgets="updateWidgets" @exit="edit = false"/> + </div> +</XColumn> +</template> + +<script lang="ts" setup> +import { } from 'vue'; +import XColumn from './column.vue'; +import { addColumnWidget, Column, removeColumnWidget, setColumnWidgets, updateColumnWidget } from './deck-store'; +import XWidgets from '@/components/MkWidgets.vue'; +import { i18n } from '@/i18n'; + +const props = defineProps<{ + column: Column; + isStacked: boolean; +}>(); + +const emit = defineEmits<{ + (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; +}>(); + +let edit = $ref(false); + +function addWidget(widget) { + addColumnWidget(props.column.id, widget); +} + +function removeWidget(widget) { + removeColumnWidget(props.column.id, widget); +} + +function updateWidget({ id, data }) { + updateColumnWidget(props.column.id, id, data); +} + +function updateWidgets(widgets) { + setColumnWidgets(props.column.id, widgets); +} + +function func() { + edit = !edit; +} + +const menu = [{ + icon: 'ti ti-pencil', + text: i18n.ts.editWidgets, + action: func, +}]; +</script> + +<style lang="scss" scoped> +.wtdtxvec { + --margin: 8px; + --panelBorder: none; + + padding: 0 var(--margin); + + > .intro { + padding: 16px; + text-align: center; + } +} +</style> |