diff --git a/commafeed-client/index.html b/commafeed-client/index.html index 96e735df..b31c73fb 100644 --- a/commafeed-client/index.html +++ b/commafeed-client/index.html @@ -1,14 +1,15 @@ - - - - - - CommaFeed - - -
- - + + + + + + + CommaFeed + + +
+ + diff --git a/commafeed-client/src/components/content/FeedEntries.tsx b/commafeed-client/src/components/content/FeedEntries.tsx index c1157f8e..b4221eba 100644 --- a/commafeed-client/src/components/content/FeedEntries.tsx +++ b/commafeed-client/src/components/content/FeedEntries.tsx @@ -20,8 +20,8 @@ import { useMousetrap } from "hooks/useMousetrap" import throttle from "lodash/throttle" import { useEffect } from "react" import InfiniteScroll from "react-infinite-scroller" -import { FeedEntry } from "./FeedEntry" import { useViewMode } from "../../hooks/useViewMode" +import { FeedEntry } from "./FeedEntry" export function FeedEntries() { const source = useAppSelector(state => state.entries.source) @@ -239,6 +239,7 @@ export function FeedEntries() { if (!entries) return return ( dispatch(loadMoreEntries())} hasMore={hasMore} diff --git a/commafeed-client/src/components/settings/CustomCss.tsx b/commafeed-client/src/components/settings/CustomCss.tsx new file mode 100644 index 00000000..13097855 --- /dev/null +++ b/commafeed-client/src/components/settings/CustomCss.tsx @@ -0,0 +1,72 @@ +import { Trans } from "@lingui/macro" +import { Button, Group, Stack, Textarea } from "@mantine/core" +import { useForm } from "@mantine/form" +import { useEffect } from "react" +import { useAsyncCallback } from "react-async-hook" +import { TbDeviceFloppy } from "react-icons/tb" +import { client } from "../../app/client" +import { redirectToSelectedSource } from "../../app/slices/redirect" +import { useAppDispatch, useAppSelector } from "../../app/store" + +interface FormData { + customCss: string +} + +export function CustomCss() { + const settings = useAppSelector(state => state.user.settings) + const customCss = settings?.customCss + const dispatch = useAppDispatch() + + const form = useForm() + const { setValues } = form + + const saveCustomCss = useAsyncCallback(client.user.saveSettings, { + onSuccess: () => { + window.location.reload() + }, + }) + + useEffect(() => { + if (!customCss) return + setValues({ + customCss, + }) + }, [setValues, customCss]) + + return ( +
{ + if (!settings) return + saveCustomCss + .execute({ + ...settings, + customCss: data.customCss, + }) + .then(() => window.location.reload()) + })} + > + +