import { msg } from "@lingui/core/macro" import { useLingui } from "@lingui/react" import { Trans } from "@lingui/react/macro" import { Divider, Group, NumberInput, 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, changeEntriesToKeepOnTopWhenScrolling, changeExternalLinkIconDisplayMode, changeLanguage, changeMarkAllAsReadConfirmation, changeMobileFooter, changeScrollMarks, changeScrollMode, changeScrollSpeed, changeSharingSetting, changeShowRead, changeStarIconDisplayMode, changeUnreadCountFavicon, changeUnreadCountTitle, } 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 entriesToKeepOnTop = useAppSelector(state => state.user.settings?.entriesToKeepOnTopWhenScrolling) 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 unreadCountTitle = useAppSelector(state => state.user.settings?.unreadCountTitle) const unreadCountFavicon = useAppSelector(state => state.user.settings?.unreadCountFavicon) const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings) const dispatch = useAppDispatch() const { _ } = useLingui() 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: _(msg`Always`), }, { value: "on_desktop", label: _(msg`On desktop`), }, { value: "on_mobile", label: _(msg`On mobile`), }, { value: "never", label: _(msg`Never`), }, ] return ( Show star icon} value={starIconDisplayMode} data={displayModeData} onChange={async s => await dispatch(changeStarIconDisplayMode(s as IconDisplayMode))} />