カスタム絵文字一覧情報をmetaから分離
This commit is contained in:
@@ -5,11 +5,11 @@ import { miLocalStorage } from './local-storage';
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
||||
const instanceData = miLocalStorage.getItem('instance');
|
||||
const cached = miLocalStorage.getItem('instance');
|
||||
|
||||
// TODO: instanceをリアクティブにするかは再考の余地あり
|
||||
|
||||
export const instance: Misskey.entities.InstanceMetadata = reactive(instanceData ? JSON.parse(instanceData) : {
|
||||
export const instance: Misskey.entities.InstanceMetadata = reactive(cached ? JSON.parse(cached) : {
|
||||
// TODO: set default values
|
||||
});
|
||||
|
||||
@@ -24,23 +24,3 @@ export async function fetchInstance() {
|
||||
|
||||
miLocalStorage.setItem('instance', JSON.stringify(instance));
|
||||
}
|
||||
|
||||
export const emojiCategories = computed(() => {
|
||||
if (instance.emojis == null) return [];
|
||||
const categories = new Set();
|
||||
for (const emoji of instance.emojis) {
|
||||
categories.add(emoji.category);
|
||||
}
|
||||
return Array.from(categories);
|
||||
});
|
||||
|
||||
export const emojiTags = computed(() => {
|
||||
if (instance.emojis == null) return [];
|
||||
const tags = new Set();
|
||||
for (const emoji of instance.emojis) {
|
||||
for (const tag of emoji.aliases) {
|
||||
tags.add(tag);
|
||||
}
|
||||
}
|
||||
return Array.from(tags);
|
||||
});
|
||||
|
Reference in New Issue
Block a user