pl-fe: Remove unused code
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
97d1ce2f47
commit
14e3df65b3
6 changed files with 41 additions and 163 deletions
|
@ -23,115 +23,10 @@ type SettingOpts = {
|
|||
|
||||
const saveSuccessMessage = defineMessage({ id: 'settings.save.success', defaultMessage: 'Your preferences have been saved!' });
|
||||
|
||||
// const defaultSettings = ImmutableMap({
|
||||
// onboarded: false,
|
||||
// skinTone: 1,
|
||||
// reduceMotion: false,
|
||||
// underlineLinks: false,
|
||||
// autoPlayGif: true,
|
||||
// displayMedia: 'default',
|
||||
// displaySpoilers: false,
|
||||
// unfollowModal: true,
|
||||
// boostModal: false,
|
||||
// deleteModal: true,
|
||||
// missingDescriptionModal: true,
|
||||
// defaultPrivacy: 'public',
|
||||
// defaultContentType: 'text/plain',
|
||||
// themeMode: 'system',
|
||||
// locale: navigator.language || 'en',
|
||||
// showExplanationBox: true,
|
||||
// explanationBox: true,
|
||||
// autoloadTimelines: true,
|
||||
// autoloadMore: false,
|
||||
// preserveSpoilers: true,
|
||||
// autoTranslate: false,
|
||||
// knownLanguages: ImmutableOrderedSet(),
|
||||
|
||||
// systemFont: false,
|
||||
// demetricator: false,
|
||||
|
||||
// isDeveloper: false,
|
||||
|
||||
// chats: ImmutableMap({
|
||||
// panes: ImmutableList(),
|
||||
// mainWindow: 'minimized',
|
||||
// sound: true,
|
||||
// }),
|
||||
|
||||
// home: ImmutableMap({
|
||||
// shows: ImmutableMap({
|
||||
// reblog: true,
|
||||
// reply: true,
|
||||
// direct: false,
|
||||
// }),
|
||||
// }),
|
||||
|
||||
// notifications: ImmutableMap({
|
||||
// quickFilter: ImmutableMap({
|
||||
// active: 'all',
|
||||
// show: true,
|
||||
// advanced: false,
|
||||
// }),
|
||||
|
||||
// sounds: ImmutableMap({
|
||||
// follow: false,
|
||||
// follow_request: false,
|
||||
// favourite: false,
|
||||
// reblog: false,
|
||||
// mention: false,
|
||||
// poll: false,
|
||||
// move: false,
|
||||
// emoji_reaction: false,
|
||||
// }),
|
||||
// }),
|
||||
|
||||
// 'public:local': ImmutableMap({
|
||||
// shows: ImmutableMap({
|
||||
// reblog: false,
|
||||
// reply: true,
|
||||
// direct: false,
|
||||
// }),
|
||||
// other: ImmutableMap({
|
||||
// onlyMedia: false,
|
||||
// }),
|
||||
// }),
|
||||
|
||||
// public: ImmutableMap({
|
||||
// shows: ImmutableMap({
|
||||
// reblog: true,
|
||||
// reply: true,
|
||||
// direct: false,
|
||||
// }),
|
||||
// other: ImmutableMap({
|
||||
// onlyMedia: false,
|
||||
// }),
|
||||
// }),
|
||||
|
||||
// direct: ImmutableMap({
|
||||
// }),
|
||||
|
||||
// account_timeline: ImmutableMap({
|
||||
// shows: ImmutableMap({
|
||||
// reblog: true,
|
||||
// pinned: true,
|
||||
// direct: false,
|
||||
// }),
|
||||
// }),
|
||||
|
||||
// trends: ImmutableMap({
|
||||
// show: true,
|
||||
// }),
|
||||
|
||||
// remote_timeline: ImmutableMap({
|
||||
// pinnedHosts: ImmutableList(),
|
||||
// }),
|
||||
// });
|
||||
|
||||
const changeSetting = (path: string[], value: any, opts?: SettingOpts) =>
|
||||
(dispatch: AppDispatch) => {
|
||||
useSettingsStore.getState().changeSetting(path, value);
|
||||
return dispatch(saveSettings(opts));
|
||||
};
|
||||
const changeSetting = (path: string[], value: any, opts?: SettingOpts) => {
|
||||
useSettingsStore.getState().changeSetting(path, value);
|
||||
return saveSettings(opts);
|
||||
};
|
||||
|
||||
const saveSettings = (opts?: SettingOpts) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
|
|
|
@ -19,7 +19,7 @@ const BubbleTimeline = () => {
|
|||
const theme = useTheme();
|
||||
|
||||
const settings = useSettings();
|
||||
const onlyMedia = settings.bubble.other.onlyMedia;
|
||||
const onlyMedia = settings.timelines.bubble?.other.onlyMedia ?? false;
|
||||
|
||||
const timelineId = 'bubble';
|
||||
const isMobile = useIsMobile();
|
||||
|
|
|
@ -20,7 +20,7 @@ const CommunityTimeline = () => {
|
|||
const theme = useTheme();
|
||||
|
||||
const settings = useSettings();
|
||||
const onlyMedia = settings['public:local'].other.onlyMedia;
|
||||
const onlyMedia = settings.timelines['public:local']?.other.onlyMedia ?? false;
|
||||
|
||||
const timelineId = 'public:local';
|
||||
const isMobile = useIsMobile();
|
||||
|
|
|
@ -25,7 +25,7 @@ const CommunityTimeline = () => {
|
|||
|
||||
const instance = useInstance();
|
||||
const settings = useSettings();
|
||||
const onlyMedia = settings.public.other.onlyMedia;
|
||||
const onlyMedia = settings.timelines.public?.other.onlyMedia ?? false;
|
||||
|
||||
const timelineId = 'public';
|
||||
const isMobile = useIsMobile();
|
||||
|
|
|
@ -29,7 +29,7 @@ const RemoteTimeline: React.FC<IRemoteTimeline> = ({ params }) => {
|
|||
const settings = useSettings();
|
||||
|
||||
const timelineId = 'remote';
|
||||
const onlyMedia = settings.remote.other.onlyMedia;
|
||||
const onlyMedia = settings.timelines.remote?.other.onlyMedia ?? false;
|
||||
|
||||
const pinned = settings.remote_timeline.pinnedHosts.includes(instance);
|
||||
const isMobile = useIsMobile();
|
||||
|
|
|
@ -16,11 +16,10 @@ const settingsSchema = z.object({
|
|||
autoPlayGif: z.boolean().catch(true),
|
||||
displayMedia: z.enum(['default', 'hide_all', 'show_all']).catch('default'),
|
||||
displaySpoilers: z.boolean().catch(false),
|
||||
preserveSpoilers: z.boolean().catch(false),
|
||||
unfollowModal: z.boolean().catch(false),
|
||||
unfollowModal: z.boolean().catch(true),
|
||||
boostModal: z.boolean().catch(false),
|
||||
deleteModal: z.boolean().catch(true),
|
||||
missingDescriptionModal: z.boolean().catch(false),
|
||||
missingDescriptionModal: z.boolean().catch(true),
|
||||
defaultPrivacy: z.enum(['public', 'unlisted', 'private', 'direct']).catch('public'),
|
||||
defaultContentType: z.enum(['text/plain', 'text/markdown']).catch('text/plain'),
|
||||
themeMode: z.enum(['system', 'light', 'dark', 'black']).catch('system'),
|
||||
|
@ -29,60 +28,20 @@ const settingsSchema = z.object({
|
|||
explanationBox: z.boolean().catch(true),
|
||||
autoloadTimelines: z.boolean().catch(true),
|
||||
autoloadMore: z.boolean().catch(true),
|
||||
preserveSpoilers: z.boolean().catch(false),
|
||||
autoTranslate: z.boolean().catch(false),
|
||||
knownLanguages: z.array(z.string()).catch([]),
|
||||
|
||||
systemFont: z.boolean().catch(false),
|
||||
demetricator: z.boolean().catch(false),
|
||||
|
||||
isDeveloper: z.boolean().catch(false),
|
||||
demo: z.boolean().catch(false),
|
||||
|
||||
chats: coerceObject({
|
||||
mainWindow: z.enum(['minimized', 'open']).catch('minimized'),
|
||||
sound: z.boolean().catch(true),
|
||||
}),
|
||||
home: coerceObject({
|
||||
shows: coerceObject({
|
||||
reblog: z.boolean().catch(true),
|
||||
reply: z.boolean().catch(true),
|
||||
}),
|
||||
}),
|
||||
account_timeline: coerceObject({
|
||||
shows: coerceObject({
|
||||
pinned: z.boolean().catch(true),
|
||||
}),
|
||||
}),
|
||||
remote_timeline: coerceObject({
|
||||
pinnedHosts: z.string().array().catch([]),
|
||||
}),
|
||||
public: coerceObject({
|
||||
other: coerceObject({
|
||||
onlyMedia: z.boolean().catch(false),
|
||||
}),
|
||||
}),
|
||||
'public:local': coerceObject({
|
||||
other: coerceObject({
|
||||
onlyMedia: z.boolean().catch(false),
|
||||
}),
|
||||
}),
|
||||
remote: coerceObject({
|
||||
other: coerceObject({
|
||||
onlyMedia: z.boolean().catch(false),
|
||||
}),
|
||||
}),
|
||||
bubble: coerceObject({
|
||||
other: coerceObject({
|
||||
onlyMedia: z.boolean().catch(false),
|
||||
}),
|
||||
}),
|
||||
notifications: coerceObject({
|
||||
quickFilter: coerceObject({
|
||||
active: z.string().catch('all'),
|
||||
advanced: z.boolean().catch(false),
|
||||
show: z.boolean().catch(true),
|
||||
}),
|
||||
sounds: z.record(z.boolean()).catch({}),
|
||||
}),
|
||||
autoTranslate: z.boolean().catch(false),
|
||||
knownLanguages: z.array(z.string()).catch([]),
|
||||
frequentlyUsedEmojis: z.record(z.number()).catch({}),
|
||||
frequentlyUsedLanguages: z.record(z.number()).catch({}),
|
||||
|
||||
timelines: z.record(coerceObject({
|
||||
shows: coerceObject({
|
||||
reblog: z.boolean().catch(true),
|
||||
|
@ -94,7 +53,31 @@ const settingsSchema = z.object({
|
|||
}),
|
||||
})).catch({}),
|
||||
|
||||
account_timeline: coerceObject({
|
||||
shows: coerceObject({
|
||||
pinned: z.boolean().catch(true),
|
||||
}),
|
||||
}),
|
||||
|
||||
remote_timeline: coerceObject({
|
||||
pinnedHosts: z.string().array().catch([]),
|
||||
}),
|
||||
|
||||
notifications: coerceObject({
|
||||
quickFilter: coerceObject({
|
||||
active: z.string().catch('all'),
|
||||
advanced: z.boolean().catch(false),
|
||||
show: z.boolean().catch(true),
|
||||
}),
|
||||
sounds: z.record(z.boolean()).catch({}),
|
||||
}),
|
||||
|
||||
frequentlyUsedEmojis: z.record(z.number()).catch({}),
|
||||
frequentlyUsedLanguages: z.record(z.number()).catch({}),
|
||||
|
||||
saved: z.boolean().catch(true),
|
||||
|
||||
demo: z.boolean().catch(false),
|
||||
});
|
||||
|
||||
type Settings = z.infer<typeof settingsSchema>;
|
||||
|
|
Loading…
Reference in a new issue