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,