mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-27 08:23:02 +00:00
define defult Following Feed state in following-feed-utils.ts instead of store.ts
This commit is contained in:
parent
38e30c0d54
commit
1ca350e45d
2 changed files with 22 additions and 11 deletions
|
@ -45,13 +45,32 @@ export interface FollowingFeedState {
|
||||||
remoteWarningDismissed: boolean,
|
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>> {
|
interface StorageInterface<T extends Partial<FollowingFeedState> = Partial<FollowingFeedState>> {
|
||||||
readonly state: Partial<T>;
|
readonly state: Partial<T>;
|
||||||
readonly reactiveState: Ref<Partial<T>>;
|
readonly reactiveState: Ref<Partial<T>>;
|
||||||
save(updated: T): void;
|
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 {
|
const {
|
||||||
userList,
|
userList,
|
||||||
withNonPublic,
|
withNonPublic,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import darkTheme from '@@/themes/d-ice.json5';
|
||||||
import { miLocalStorage } from './local-storage.js';
|
import { miLocalStorage } from './local-storage.js';
|
||||||
import { searchEngineMap } from './scripts/search-engine-map.js';
|
import { searchEngineMap } from './scripts/search-engine-map.js';
|
||||||
import type { SoundType } from '@/scripts/sound.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';
|
import { Storage } from '@/pizzax.js';
|
||||||
|
|
||||||
interface PostFormAction {
|
interface PostFormAction {
|
||||||
|
@ -244,15 +244,7 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
},
|
},
|
||||||
followingFeed: {
|
followingFeed: {
|
||||||
where: 'account',
|
where: 'account',
|
||||||
default: {
|
default: defaultFollowingFeedState,
|
||||||
withNonPublic: false,
|
|
||||||
withQuotes: false,
|
|
||||||
withBots: true,
|
|
||||||
withReplies: false,
|
|
||||||
onlyFiles: false,
|
|
||||||
userList: 'following' as FollowingFeedTab,
|
|
||||||
remoteWarningDismissed: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
overridedDeviceKind: {
|
overridedDeviceKind: {
|
||||||
|
|
Loading…
Reference in a new issue