diff --git a/locales/settings/en.json b/locales/settings/en.json index 5a14d56c1..5333abf93 100644 --- a/locales/settings/en.json +++ b/locales/settings/en.json @@ -73,6 +73,12 @@ "appearance.title": "Appearance", "appearance.ui_font": "UI Font", "appearance.unread_count": "Unread count", + "feeds.claimTips": "To claim your feeds and receive tips, right-click on the feed in your subscription list and select Claim.", + "feeds.noFeeds": "No claimed feeds", + "feeds.tableHeaders.entryCount": "Entries", + "feeds.tableHeaders.name": "Name", + "feeds.tableHeaders.subscriptionCount": "Subscriptions", + "feeds.tableHeaders.tipAmount": "Received tips", "general.app": "App", "general.data_persist.description": "Persist data locally to enable offline access and local search.", "general.data_persist.label": "Persist data for offline usage", @@ -152,6 +158,7 @@ "titles.about": "About", "titles.actions": "Actions", "titles.appearance": "Appearance", + "titles.feeds": "Feeds", "titles.general": "General", "titles.integration": "Integration", "titles.invitations": "Invitations", diff --git a/src/hono.ts b/src/hono.ts index 02bc36547..4e00c4e6a 100644 --- a/src/hono.ts +++ b/src/hono.ts @@ -4943,6 +4943,36 @@ declare const _routes: hono_hono_base.HonoBase< status: 200 } } + "/feeds/claim/list": { + $get: { + input: {} + output: { + code: 0 + data: { + feed: { + description: string | null + title: string | null + id: string + image: string | null + url: string + siteUrl: string | null + checkedAt: string + lastModifiedHeader: string | null + etagHeader: string | null + ttl: number | null + errorMessage: string | null + errorAt: string | null + ownerUserId: string | null + } + subscriptionCount: number + tipAmount: number + entryCount: number + }[] + } + outputFormat: "json" | "text" + status: 200 + } + } "/feeds": { $get: { input: { diff --git a/src/renderer/src/modules/settings/tabs/feeds.tsx b/src/renderer/src/modules/settings/tabs/feeds.tsx new file mode 100644 index 000000000..bb97c819c --- /dev/null +++ b/src/renderer/src/modules/settings/tabs/feeds.tsx @@ -0,0 +1,86 @@ +import { FeedIcon } from "@renderer/components/feed-icon" +import { LoadingCircle } from "@renderer/components/ui/loading" +import { ScrollArea } from "@renderer/components/ui/scroll-area" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@renderer/components/ui/table" +import { useAuthQuery } from "@renderer/hooks/common" +import { Balance } from "@renderer/modules/wallet/balance" +import { Queries } from "@renderer/queries" +import { WEB_URL } from "@shared/constants" +import { useTranslation } from "react-i18next" + +export const SettingFeeds = () => { + const { t } = useTranslation("settings") + const claimedList = useAuthQuery(Queries.feed.claimedList()) + + return ( +
+
+

{t("feeds.claimTips")}

+
+
+ + {claimedList.data?.length ? ( + + + + + {t("feeds.tableHeaders.name")} + + + {t("feeds.tableHeaders.entryCount")} + + + {t("feeds.tableHeaders.subscriptionCount")} + + + {t("feeds.tableHeaders.tipAmount")} + + + + + {claimedList.data?.map((row) => ( + + + + + + {row.feed.title} + + + + + {row.entryCount} + + + {row.subscriptionCount} + + + {BigInt(row.tipAmount || 0n)} + + + ))} + +
+ ) : claimedList.isLoading ? ( + + ) : ( +
+

{t("feeds.noFeeds")}

+
+ )} +
+
+
+ ) +} diff --git a/src/renderer/src/pages/settings/(settings)/feeds.tsx b/src/renderer/src/pages/settings/(settings)/feeds.tsx new file mode 100644 index 000000000..a7f3e2517 --- /dev/null +++ b/src/renderer/src/pages/settings/(settings)/feeds.tsx @@ -0,0 +1,21 @@ +import { SettingFeeds } from "@renderer/modules/settings/tabs/feeds" +import { SettingsTitle } from "@renderer/modules/settings/title" +import { defineSettingPageData } from "@renderer/modules/settings/utils" + +const iconName = "i-mgc-certificate-cute-re" +const priority = 1053 + +export const loader = defineSettingPageData({ + iconName, + name: "titles.feeds", + priority, +}) + +export function Component() { + return ( + <> + + + + ) +} diff --git a/src/renderer/src/queries/feed.ts b/src/renderer/src/queries/feed.ts index 358eba1fd..aa34ae88d 100644 --- a/src/renderer/src/queries/feed.ts +++ b/src/renderer/src/queries/feed.ts @@ -32,6 +32,11 @@ export const feed = { return res }), ), + claimedList: () => + defineQuery(["feed", "claimedList"], async () => { + const res = await apiClient.feeds.claim.list.$get() + return res.data + }), } export const useFeed = ({ id, url }: FeedQueryParams) =>