From 763cac0aadb3203e08f741b3e16b485d4ff95019 Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:10:49 +0900 Subject: [PATCH] wip --- packages/frontend/.storybook/generate.tsx | 1 + packages/frontend/src/components/MkFolder.vue | 6 +- .../src/components/MkTagItem.stories.impl.ts | 70 +++++++++++++++++++ .../frontend/src/components/MkTagItem.vue | 61 ++++++++++++++++ .../admin/custom-emojis-grid.local.list.vue | 68 +++++++++++++++++- 5 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/src/components/MkTagItem.stories.impl.ts create mode 100644 packages/frontend/src/components/MkTagItem.vue diff --git a/packages/frontend/.storybook/generate.tsx b/packages/frontend/.storybook/generate.tsx index d61df9e7be..7ca3fddbe2 100644 --- a/packages/frontend/.storybook/generate.tsx +++ b/packages/frontend/.storybook/generate.tsx @@ -409,6 +409,7 @@ function toStories(component: string): Promise { glob('src/components/MkUserSetupDialog.vue'), glob('src/components/MkUserSetupDialog.*.vue'), glob('src/components/MkInviteCode.vue'), + glob('src/components/MkTagItem.vue'), glob('src/pages/user/home.vue'), ]); const components = globs.flat(); diff --git a/packages/frontend/src/components/MkFolder.vue b/packages/frontend/src/components/MkFolder.vue index c143c2af1f..0c6f057538 100644 --- a/packages/frontend/src/components/MkFolder.vue +++ b/packages/frontend/src/components/MkFolder.vue @@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only >
- +
@@ -56,9 +56,13 @@ import { defaultStore } from '@/store.js'; const props = withDefaults(defineProps<{ defaultOpen?: boolean; maxHeight?: number | null; + spacerMin?: number; + spacerMax?: number; }>(), { defaultOpen: false, maxHeight: null, + spacerMin: 14, + spacerMax: 22, }); const getBgColor = (el: HTMLElement) => { diff --git a/packages/frontend/src/components/MkTagItem.stories.impl.ts b/packages/frontend/src/components/MkTagItem.stories.impl.ts new file mode 100644 index 0000000000..3f243ff651 --- /dev/null +++ b/packages/frontend/src/components/MkTagItem.stories.impl.ts @@ -0,0 +1,70 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable import/no-default-export */ +import { action } from '@storybook/addon-actions'; +import { StoryObj } from '@storybook/vue3'; +import MkTagItem from './MkTagItem.vue'; + +export const Default = { + render(args) { + return { + components: { + MkTagItem: MkTagItem, + }, + setup() { + return { + args, + }; + }, + computed: { + props() { + return { + ...this.args, + }; + }, + events() { + return { + click: action('click'), + exButtonClick: action('exButtonClick'), + }; + }, + }, + template: '', + }; + }, + args: { + content: 'name', + }, + parameters: { + layout: 'centered', + }, +} satisfies StoryObj; + +export const Icon = { + ...Default, + args: { + ...Default.args, + iconClass: 'ti ti-arrow-up', + }, +} satisfies StoryObj; + +export const ExButton = { + ...Default, + args: { + ...Default.args, + exButtonIconClass: 'ti ti-x', + }, +} satisfies StoryObj; + +export const IconExButton = { + ...Default, + args: { + ...Default.args, + iconClass: 'ti ti-arrow-up', + exButtonIconClass: 'ti ti-x', + }, +} satisfies StoryObj; diff --git a/packages/frontend/src/components/MkTagItem.vue b/packages/frontend/src/components/MkTagItem.vue new file mode 100644 index 0000000000..52e4b0b034 --- /dev/null +++ b/packages/frontend/src/components/MkTagItem.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue b/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue index a725b5708d..36ba429ab6 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue @@ -58,7 +58,24 @@ -
+ + + +
+
+ +
+ + + +
+
@@ -134,6 +151,7 @@ import MkFolder from '@/components/MkFolder.vue'; import MkSelect from '@/components/MkSelect.vue'; import { deviceKind } from '@/scripts/device-kind.js'; import { GridSetting } from '@/components/grid/grid.js'; +import MkTagItem from '@/components/MkTagItem.vue'; type GridItem = { checked: boolean; @@ -153,6 +171,21 @@ type GridItem = { originalUrl?: string | null; } +type GridSortOrderKey = + 'name' | + 'category' | + 'aliases' | + 'type' | + 'license' | + 'isSensitive' | + 'localOnly' | + 'updatedAt'; + +type GridSortOrder = { + column: GridSortOrderKey; + direction: 'ASC' | 'DESC'; +} + function setupGrid(): GridSetting { const required = validators.required(); const regex = validators.regex(/^[a-zA-Z0-9_]+$/); @@ -203,7 +236,8 @@ const queryUpdatedAtTo = ref(null); const querySensitive = ref(null); const queryLocalOnly = ref(null); const previousQuery = ref(undefined); - +const sortOrders = ref([]); +sortOrders.value.push({ column: 'updatedAt', direction: 'DESC' }, { column: 'name', direction: 'ASC' }); const requestLogs = ref([]); const gridItems = ref([]); @@ -608,6 +642,36 @@ onMounted(async () => { gap: 8px; } +.sortOrderArea { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-start; +} + +.sortOrderAreaTags { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-start; + gap: 8px; +} + +.sortOrderAddButton { + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + min-width: 2.0em; + min-height: 2.0em; + max-width: 2.0em; + max-height: 2.0em; + padding: 8px; + margin-left: auto; + border-radius: 9999px; + background-color: var(--buttonBg); +} + .gridArea { overflow: scroll; padding-top: 8px;