From a3743a06229b9111b9a38c9d4bbda6a93e9207ea Mon Sep 17 00:00:00 2001 From: mattyatea Date: Wed, 18 Oct 2023 17:42:06 +0900 Subject: [PATCH] Feat:emoji folder --- locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + .../src/components/MkEmojiPicker.section.vue | 136 ++++++++++++++---- .../frontend/src/components/MkEmojiPicker.vue | 40 ++++-- 4 files changed, 142 insertions(+), 36 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index a7182e6c1b..891d84276c 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -323,6 +323,7 @@ export interface Locale { "createFolder": string; "renameFolder": string; "deleteFolder": string; + "Folder": string; "addFile": string; "emptyDrive": string; "emptyFolder": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index db45638a8e..2c580b0641 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -320,6 +320,7 @@ folderName: "フォルダー名" createFolder: "フォルダーを作成" renameFolder: "フォルダー名を変更" deleteFolder: "フォルダーを削除" +Folder: "フォルダー" addFile: "ファイルを追加" emptyDrive: "ドライブは空です" emptyFolder: "フォルダーは空です" diff --git a/packages/frontend/src/components/MkEmojiPicker.section.vue b/packages/frontend/src/components/MkEmojiPicker.section.vue index 08297ea5ba..0582cf8b74 100644 --- a/packages/frontend/src/components/MkEmojiPicker.section.vue +++ b/packages/frontend/src/components/MkEmojiPicker.section.vue @@ -4,49 +4,129 @@ SPDX-License-Identifier: AGPL-3.0-only --> diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue index 7eff637482..33a7d003a6 100644 --- a/packages/frontend/src/components/MkEmojiPicker.vue +++ b/packages/frontend/src/components/MkEmojiPicker.vue @@ -72,19 +72,26 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.customEmojis }}
+ - {{ category || i18n.ts.other }} - + :emojis="computed(() => customEmojis.filter(filterAvailable))" + :category="category" + @chosen="chosen" + />
{{ i18n.ts.emoji }}
- {{ category }} + {{ category }} + +
@@ -107,7 +114,7 @@ import { isTouchUsing } from '@/scripts/touch.js'; import { deviceKind } from '@/scripts/device-kind.js'; import { i18n } from '@/i18n.js'; import { defaultStore } from '@/store.js'; -import { customEmojiCategories, customEmojis, customEmojisMap } from '@/custom-emojis.js'; +import {customEmojiCategories, customEmojis, customEmojisMap} from '@/custom-emojis.js'; import { $i } from '@/account.js'; const props = withDefaults(defineProps<{ @@ -143,6 +150,23 @@ const q = ref(''); const searchResultCustom = ref([]); const searchResultUnicode = ref([]); const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index'); +let split_categories = []; +customEmojiCategories.value.forEach(e => { + if (e !== null){ + split_categories.push(e.split('/')) + } +}); + +const groupedData = {}; +split_categories.forEach((item) => { + if (!groupedData[item[0]]) { + groupedData[item[0]] = []; + groupedData[item[0]].push(item[0]); + }else{ + groupedData[item[0]].push(item[1]); + } +}); +console.log(groupedData) watch(q, () => { if (emojisEl.value) emojisEl.value.scrollTop = 0;