Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 453a54d

Browse files
committed
prefer周りを修正
1 parent cc7aa0c commit 453a54d

File tree

6 files changed

+90
-44
lines changed

6 files changed

+90
-44
lines changed

packages/frontend/src/pages/settings/timelineHeader.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import { timelineHeaderItemDef } from '@/timeline-header.js';
6666
import MkInput from '@/components/MkInput.vue';
6767
import MkFoldableSection from '@/components/MkFoldableSection.vue';
6868
import { $i } from '@/i.js';
69+
import { prefer } from '@/preferences';
6970
7071
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
7172
const tmpName = ref();
@@ -128,7 +129,7 @@ function removeItem(index: number) {
128129
}
129130
130131
async function save() {
131-
store.set('timelineHeader', items.value.map(x => x.type));
132+
prefer.commit('timelineHeader', items.value.map(x => x.type));
132133
await reloadAsk();
133134
}
134135

packages/frontend/src/pages/timeline.vue

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ SPDX-License-Identifier: AGPL-3.0-only
3030
</template>
3131

3232
<script lang="ts" setup>
33-
import { computed, watch, provide, useTemplateRef, ref, onMounted, onActivated, defineAsyncComponent } from 'vue';
33+
import { computed, watch, useTemplateRef, ref, onMounted, onActivated, defineAsyncComponent } from 'vue';
3434
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
3535
import type { MenuItem } from '@/types/menu.js';
3636
import type { BasicTimelineType } from '@/timelines.js';
3737
import MkStreamingNotesTimeline from '@/components/MkStreamingNotesTimeline.vue';
38-
import MkInfo from '@/components/MkInfo.vue';
3938
const MkPostForm = defineAsyncComponent(() => import('@/components/MkPostForm.vue'));
4039
import * as os from '@/os.js';
4140
import { store } from '@/store.js';
@@ -49,6 +48,7 @@ import { miLocalStorage } from '@/local-storage.js';
4948
import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
5049
import { prefer } from '@/preferences.js';
5150
import { ui } from '@@/js/config.js';
51+
import { timelineHeaderItemDef } from '@/timeline-header';
5252
const XPostForm = defineAsyncComponent(() => import('@/components/XPostForm.vue'));
5353
5454
const tlComponent = useTemplateRef('tlComponent');
@@ -203,6 +203,7 @@ function saveSrc(newSrc: TimelinePageSrc): void {
203203
204204
function saveTlFilter(key: keyof typeof store.s.tl.filter, newValue: boolean) {
205205
if (key !== 'withReplies' || $i) {
206+
const out = deepMerge({ filter: { [key]: newValue } }, store.s.tl);
206207
store.set('tl', out);
207208
}
208209
}
@@ -284,32 +285,39 @@ const headerActions = computed(() => {
284285
return items;
285286
});
286287
287-
const headerTabs = computed(() => [...(prefer.r.pinnedUserLists.value.map(l => ({
288-
key: 'list:' + l.id,
289-
title: l.name,
290-
icon: 'ti ti-star',
291-
iconOnly: true,
292-
}))), ...availableBasicTimelines().map(tl => ({
293-
key: tl,
294-
title: i18n.ts._timelines[tl],
295-
icon: basicTimelineIconClass(tl),
296-
iconOnly: true,
297-
})), {
298-
icon: 'ti ti-list',
299-
title: i18n.ts.lists,
300-
iconOnly: true,
301-
onClick: chooseList,
302-
}, {
303-
icon: 'ti ti-antenna',
304-
title: i18n.ts.antennas,
305-
iconOnly: true,
306-
onClick: chooseAntenna,
307-
}, {
308-
icon: 'ti ti-device-tv',
309-
title: i18n.ts.channel,
310-
iconOnly: true,
311-
onClick: chooseChannel,
312-
}] as Tab[]);
288+
const headerTabs = computed(() => {
289+
const timelineHeaderValue = prefer.s.timelineHeader;
290+
console.log(prefer.s.timelineHeader);
291+
if (!Array.isArray(timelineHeaderValue)) {
292+
console.error('timelineHeader is not an array:', timelineHeaderValue);
293+
return [] as Tab[];
294+
}
295+
296+
return timelineHeaderValue.map(tab => {
297+
const tabDef = timelineHeaderItemDef[tab];
298+
if (!tabDef) {
299+
return {};
300+
}
301+
302+
return {
303+
...(!['channels', 'antennas', 'lists'].includes(tab) ? {
304+
key: tab,
305+
} : {}),
306+
title: tabDef.title,
307+
icon: tabDef.icon,
308+
iconOnly: tabDef.iconOnly,
309+
...(tab === 'lists' ? {
310+
onClick: (ev) => chooseList(ev),
311+
} : {}),
312+
...(tab === 'antennas' ? {
313+
onClick: (ev) => chooseAntenna(ev),
314+
} : {}),
315+
...(tab === 'channels' ? {
316+
onClick: (ev) => chooseChannel(ev),
317+
} : {}),
318+
};
319+
}) as Tab[];
320+
});
313321
314322
const headerTabsWhenNotLogin = computed(() => [...availableBasicTimelines().map(tl => ({
315323
key: tl,

packages/frontend/src/pref-migrate.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ export function migrateOldSettings() {
5151
prefer.commit('deck.profiles', profiles);
5252
});
5353

54+
// TypeAny独自の設定を以降
55+
prefer.commit('timelineHeader', store.s.timelineHeader);
56+
prefer.commit('followerColor', store.s.followerColor);
57+
prefer.commit('specifiedColor', store.s.specifiedColor);
58+
prefer.commit('localOnlyColor', store.s.localOnlyColor);
59+
5460
prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme'));
5561
prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme'));
5662
prefer.commit('syncDeviceDarkMode', ColdDeviceStorage.get('syncDeviceDarkMode'));

packages/frontend/src/preferences/def.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import type { Plugin } from '@/plugin.js';
1212
import type { DeviceKind } from '@/utility/device-kind.js';
1313
import type { DeckProfile } from '@/deck.js';
1414
import type { WatermarkPreset } from '@/utility/watermark.js';
15+
import type { TimelineHeaderItem } from '@/timeline-header';
1516
import { genId } from '@/utility/id.js';
1617
import { DEFAULT_DEVICE_KIND } from '@/utility/device-kind.js';
1718
import { deepEqual } from '@/utility/deep-equal.js';
18-
import { instance } from '@/instance';
19+
import { isGlobalTimelineAvailable, isLocalTimelineAvailable } from '@/utility/get-timeline-available';
1920

2021
/** サウンド設定 */
2122
export type SoundStore = {
@@ -42,7 +43,17 @@ export const PREF_DEF = definePreferences({
4243
username: string;
4344
}][],
4445
},
45-
46+
timelineHeader: {
47+
serverDependent: true,
48+
default: [
49+
'home',
50+
...(isLocalTimelineAvailable() ? ['local', 'social'] : []),
51+
...(isGlobalTimelineAvailable() ? ['global'] : []),
52+
'lists',
53+
'antennas',
54+
'channels',
55+
] as TimelineHeaderItem[],
56+
},
4657
pinnedUserLists: {
4758
accountDependent: true,
4859
default: [] as Misskey.entities.UserList[],

packages/frontend/src/store.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,26 @@ export const store = markRaw(new Pizzax('base', {
177177
'channels',
178178
] as TimelineHeaderItem[],
179179
},
180+
specifiedColor: {
181+
where: 'device',
182+
default: '#FFFF64',
183+
},
184+
followerColor: {
185+
where: 'device',
186+
default: '#FF00FF',
187+
},
188+
homeColor: {
189+
where: 'device',
190+
default: '#00FFFF',
191+
},
192+
localOnlyColor: {
193+
where: 'device',
194+
default: '#2b2c41',
195+
},
196+
numberOfGamingSpeed: {
197+
where: 'device',
198+
default: 44,
199+
},
180200
menuDisplay: {
181201
where: 'device',
182202
default: 'sideFull' as 'sideFull' | 'sideIcon' | 'top',

packages/frontend/src/timeline-header.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,81 +45,81 @@ export const timelineHeaderItemDef = reactive<Partial<Record<TimelineHeaderItem,
4545
home: {
4646
title: i18n.ts._timelines.home,
4747
icon: 'ti ti-home',
48-
iconOnly: true,
48+
iconOnly: false,
4949
},
5050
...(isLocalTimelineAvailable() ? {
5151
local: {
5252
title: i18n.ts._timelines.local,
5353
icon: 'ti ti-planet',
54-
iconOnly: true,
54+
iconOnly: false,
5555
},
5656
social: {
5757
title: i18n.ts._timelines.social,
5858
icon: 'ti ti-universe',
59-
iconOnly: true,
59+
iconOnly: false,
6060
},
6161
media: {
6262
title: i18n.ts._timelines.media,
6363
icon: 'ti ti-photo',
64-
iconOnly: true,
64+
iconOnly: false,
6565
} } : {}),
6666
...(isGlobalTimelineAvailable() ? { global: {
6767
title: i18n.ts._timelines.global,
6868
icon: 'ti ti-whirl',
69-
iconOnly: true,
69+
iconOnly: false,
7070
} } : {}),
7171
lists: {
7272
icon: 'ti ti-list',
7373
title: i18n.ts.lists,
74-
iconOnly: true,
74+
iconOnly: false,
7575
},
7676
antennas: {
7777
icon: 'ti ti-antenna',
7878
title: i18n.ts.antennas,
79-
iconOnly: true,
79+
iconOnly: false,
8080
},
8181
channels: {
8282
icon: 'ti ti-device-tv',
8383
title: i18n.ts.channel,
84-
iconOnly: true,
84+
iconOnly: false,
8585
},
8686
...lists.reduce((acc, l) => {
8787
acc['list:' + l.id] = {
8888
title: i18n.ts.lists + ':' + l.name,
8989
icon: 'ti ti-star',
90-
iconOnly: true,
90+
iconOnly: false,
9191
};
9292
return acc;
9393
}, {}),
9494
...userChannels.reduce((acc, l) => {
9595
acc['channel:' + l.id] = {
9696
title: i18n.ts.channel + ':' + l.name,
9797
icon: 'ti ti-star',
98-
iconOnly: true,
98+
iconOnly: false,
9999
};
100100
return acc;
101101
}, {}),
102102
...userChannelFollowings.reduce((acc, l) => {
103103
acc['channel:' + l.id] = {
104104
title: i18n.ts.channel + ':' + l.name,
105105
icon: 'ti ti-star',
106-
iconOnly: true,
106+
iconOnly: false,
107107
};
108108
return acc;
109109
}, {}),
110110
...userFavoriteLists.reduce((acc, l) => {
111111
acc['channel:' + l.id] = {
112112
title: i18n.ts.channel + ':' + l.name,
113113
icon: 'ti ti-star',
114-
iconOnly: true,
114+
iconOnly: false,
115115
};
116116
return acc;
117117
}, {}),
118118
...antenna.reduce((acc, l) => {
119119
acc['antenna:' + l.id] = {
120120
title: i18n.ts.antennas + ':' + l.name,
121121
icon: 'ti ti-star',
122-
iconOnly: true,
122+
iconOnly: false,
123123
};
124124
return acc;
125125
}, {}),

0 commit comments

Comments
 (0)