2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-07-11 03:13:11 +02:00
|
|
|
<template>
|
2023-05-20 03:12:18 +02:00
|
|
|
<XColumn :menu="menu" :naked="true" :column="column" :isStacked="isStacked">
|
2022-12-21 00:39:28 +01:00
|
|
|
<template #header><i class="ti ti-apps" style="margin-right: 8px;"></i>{{ column.name }}</template>
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2023-01-14 03:18:12 +01:00
|
|
|
<div :class="$style.root">
|
|
|
|
<div v-if="!(column.widgets && column.widgets.length > 0) && !edit" :class="$style.intro">{{ i18n.ts._deck.widgetsIntroduction }}</div>
|
2023-05-19 13:52:15 +02:00
|
|
|
<XWidgets :edit="edit" :widgets="column.widgets ?? []" @addWidget="addWidget" @removeWidget="removeWidget" @updateWidget="updateWidget" @updateWidgets="updateWidgets" @exit="edit = false"/>
|
2020-07-11 03:13:11 +02:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</XColumn>
|
2020-07-11 03:13:11 +02:00
|
|
|
</template>
|
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { ref } from 'vue';
|
2020-07-11 03:13:11 +02:00
|
|
|
import XColumn from './column.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { addColumnWidget, Column, removeColumnWidget, setColumnWidgets, updateColumnWidget } from './deck-store.js';
|
2022-08-30 17:24:33 +02:00
|
|
|
import XWidgets from '@/components/MkWidgets.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const edit = ref(false);
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
function addWidget(widget) {
|
|
|
|
addColumnWidget(props.column.id, widget);
|
|
|
|
}
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
function removeWidget(widget) {
|
|
|
|
removeColumnWidget(props.column.id, widget);
|
|
|
|
}
|
2020-12-19 02:55:52 +01:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
function updateWidget({ id, data }) {
|
|
|
|
updateColumnWidget(props.column.id, id, data);
|
|
|
|
}
|
2020-12-28 03:56:42 +01:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
function updateWidgets(widgets) {
|
|
|
|
setColumnWidgets(props.column.id, widgets);
|
|
|
|
}
|
2021-02-16 14:17:13 +01:00
|
|
|
|
2022-03-20 19:11:14 +01:00
|
|
|
function func() {
|
2023-12-07 06:42:09 +01:00
|
|
|
edit.value = !edit.value;
|
2022-03-20 19:11:14 +01:00
|
|
|
}
|
2022-07-16 22:33:21 +02:00
|
|
|
|
|
|
|
const menu = [{
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-pencil',
|
2022-07-16 22:33:21 +02:00
|
|
|
text: i18n.ts.editWidgets,
|
|
|
|
action: func,
|
|
|
|
}];
|
2020-07-11 03:13:11 +02:00
|
|
|
</script>
|
|
|
|
|
2023-01-14 03:18:12 +01:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2021-02-16 14:17:13 +01:00
|
|
|
--margin: 8px;
|
2021-07-27 14:37:32 +02:00
|
|
|
--panelBorder: none;
|
2020-07-11 03:13:11 +02:00
|
|
|
|
2021-02-16 14:17:13 +01:00
|
|
|
padding: 0 var(--margin);
|
2023-01-14 03:18:12 +01:00
|
|
|
}
|
2022-07-04 14:28:59 +02:00
|
|
|
|
2023-01-14 03:18:12 +01:00
|
|
|
.intro {
|
|
|
|
padding: 16px;
|
|
|
|
text-align: center;
|
2020-07-11 03:13:11 +02:00
|
|
|
}
|
|
|
|
</style>
|