import { Trans, t } from "@lingui/macro" import { Divider, Group, Radio, Select, SimpleGrid, Stack, Switch } from "@mantine/core" import type { ComboboxData } from "@mantine/core/lib/components/Combobox/Combobox.types" import { Constants } from "app/constants" import { useAppDispatch, useAppSelector } from "app/store" import type { IconDisplayMode, ScrollMode, SharingSettings } from "app/types" import { changeCustomContextMenu, changeExternalLinkIconDisplayMode, changeLanguage, changeMarkAllAsReadConfirmation, changeMobileFooter, changeScrollMarks, changeScrollMode, changeScrollSpeed, changeSharingSetting, changeShowRead, changeStarIconDisplayMode, } from "app/user/thunks" import { locales } from "i18n" import type { ReactNode } from "react" export function DisplaySettings() { const language = useAppSelector(state => state.user.settings?.language) const scrollSpeed = useAppSelector(state => state.user.settings?.scrollSpeed) const showRead = useAppSelector(state => state.user.settings?.showRead) const scrollMarks = useAppSelector(state => state.user.settings?.scrollMarks) const scrollMode = useAppSelector(state => state.user.settings?.scrollMode) const starIconDisplayMode = useAppSelector(state => state.user.settings?.starIconDisplayMode) const externalLinkIconDisplayMode = useAppSelector(state => state.user.settings?.externalLinkIconDisplayMode) const markAllAsReadConfirmation = useAppSelector(state => state.user.settings?.markAllAsReadConfirmation) const customContextMenu = useAppSelector(state => state.user.settings?.customContextMenu) const mobileFooter = useAppSelector(state => state.user.settings?.mobileFooter) const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings) const dispatch = useAppDispatch() const scrollModeOptions: Record = { always: Always, never: Never, if_needed: If the entry doesn't entirely fit on the screen, } const displayModeData: ComboboxData = [ { value: "always", label: t`Always`, }, { value: "on_desktop", label: t`On desktop`, }, { value: "on_mobile", label: t`On mobile`, }, { value: "never", label: t`Never`, }, ] return ( Show star icon} value={starIconDisplayMode} data={displayModeData} onChange={async s => await dispatch(changeStarIconDisplayMode(s as IconDisplayMode))} />