define defult Following Feed state in following-feed-utils.ts instead of store.ts

This commit is contained in:
Hazelnoot 2024-11-02 11:23:15 -04:00
parent 38e30c0d54
commit 1ca350e45d
2 changed files with 22 additions and 11 deletions

View File

@ -45,13 +45,32 @@ export interface FollowingFeedState {
remoteWarningDismissed: boolean,
}
export const defaultFollowingFeedState: FollowingFeedState = {
withNonPublic: false,
withQuotes: false,
withBots: true,
withReplies: false,
onlyFiles: false,
userList: followingTab,
remoteWarningDismissed: false,
};
interface StorageInterface<T extends Partial<FollowingFeedState> = Partial<FollowingFeedState>> {
readonly state: Partial<T>;
readonly reactiveState: Ref<Partial<T>>;
save(updated: T): void;
}
export function createOptions(storage?: Ref<StorageInterface>): PageHeaderItem {
export function createHeaderItem(storage?: Ref<StorageInterface>): PageHeaderItem {
const menu = createOptionsMenu(storage);
return {
icon: 'ti ti-dots',
text: i18n.ts.options,
handler: ev => popupMenu(menu, ev.currentTarget ?? ev.target),
};
}
export function createOptionsMenu(storage?: Ref<StorageInterface>): MenuItem[] {
const {
userList,
withNonPublic,

View File

@ -11,7 +11,7 @@ import darkTheme from '@@/themes/d-ice.json5';
import { miLocalStorage } from './local-storage.js';
import { searchEngineMap } from './scripts/search-engine-map.js';
import type { SoundType } from '@/scripts/sound.js';
import type { FollowingFeedTab } from '@/scripts/following-feed-utils.js';
import { defaultFollowingFeedState } from '@/scripts/following-feed-utils.js';
import { Storage } from '@/pizzax.js';
interface PostFormAction {
@ -244,15 +244,7 @@ export const defaultStore = markRaw(new Storage('base', {
},
followingFeed: {
where: 'account',
default: {
withNonPublic: false,
withQuotes: false,
withBots: true,
withReplies: false,
onlyFiles: false,
userList: 'following' as FollowingFeedTab,
remoteWarningDismissed: false,
},
default: defaultFollowingFeedState,
},
overridedDeviceKind: {