import { Brush } from "@styled-icons/boxicons-solid"; import { observer } from "mobx-react-lite"; import { Link } from "react-router-dom"; // @ts-expect-error shade-blend-color does not have typings. import pSBC from "shade-blend-color"; import { Text } from "preact-i18n"; import { CategoryButton, Checkbox, ColourSwatches, ComboBox, Radio, } from "@revoltchat/ui"; import TextAreaAutoSize from "../../../lib/TextAreaAutoSize"; import { useApplicationState } from "../../../mobx/State"; import { Fonts, FONTS, FONT_KEYS, MonospaceFonts, MONOSPACE_FONTS, MONOSPACE_FONT_KEYS, } from "../../../context/Theme"; import { EmojiSelector } from "./EmojiSelector"; import { ThemeBaseSelector } from "./ThemeBaseSelector"; /** * Component providing a way to switch the base theme being used. */ export const ShimThemeBaseSelector = observer(() => { const theme = useApplicationState().settings.theme; return ( { theme.setBase(base); theme.reset(); }} /> ); }); /** * Component providing a link to the theme shop. * Only appears if experiment is enabled. */ export const ShimThemeShop = () => { return ( } action="chevron" description={ }> ); }; /** * Component providing a way to change current accent colour. */ export const ShimThemeAccent = observer(() => { const theme = useApplicationState().settings.theme; return ( <>

{ theme.setVariable("accent", colour as string); theme.setVariable("scrollbar-thumb", pSBC(-0.2, colour)); }} /> ); }); /** * Component providing a way to edit custom CSS. */ export const ShimThemeCustomCSS = observer(() => { const theme = useApplicationState().settings.theme; return ( <>

theme.setCSS(ev.currentTarget.value)} /> ); }); /** * Component providing a way to switch between compact and normal message view. */ export const ShimDisplayCompact = () => { // TODO: WIP feature return ( <>

} description={ } value={true} /> } description={ } value={false} disabled />
); }; /** * Component providing a way to change primary text font. */ export const ShimDisplayFont = observer(() => { const theme = useApplicationState().settings.theme; return ( <>

theme.setFont(e.currentTarget.value as Fonts)}> {FONT_KEYS.map((key) => ( ))} ); }); /** * Component providing a way to change secondary, monospace text font. */ export const ShimDisplayMonospaceFont = observer(() => { const theme = useApplicationState().settings.theme; return ( <>

theme.setMonospaceFont( e.currentTarget.value as MonospaceFonts, ) }> {MONOSPACE_FONT_KEYS.map((key) => ( ))} ); }); /** * Component providing a way to toggle font ligatures. */ export const ShimDisplayLigatures = observer(() => { const settings = useApplicationState().settings; if (settings.theme.getFont() !== "Inter") return null; return ( <> settings.set("appearance:ligatures", v)} title={} description={ } /> ); }); /** * Component providing a way to toggle showing the send button on desktop. */ export const ShimShowSendButton = observer(() => { const settings = useApplicationState().settings; return ( settings.set("appearance:show_send_button", v)} title={ } description={ } /> ); }); /** * Component providing a way to toggle seasonal themes. */ export const ShimDisplaySeasonal = observer(() => { const settings = useApplicationState().settings; return ( settings.set("appearance:seasonal", v)} title={ } description={ } /> ); }); /** * Component providing a way to toggle transparency effects. */ export const ShimDisplayTransparency = observer(() => { const settings = useApplicationState().settings; return ( settings.set("appearance:transparency", v)} title={ } description={ } /> ); }); /** * Component providing a way to change emoji pack. */ export const ShimDisplayEmoji = observer(() => { const settings = useApplicationState().settings; return ( settings.set("appearance:emoji", v)} /> ); });