-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display claimed feed list in settings
- Loading branch information
Showing
5 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<section className="mt-4"> | ||
<div className="mb-4 space-y-2 text-sm"> | ||
<p>{t("feeds.claimTips")}</p> | ||
</div> | ||
<div className="flex flex-1 flex-col"> | ||
<ScrollArea.ScrollArea viewportClassName="max-h-[380px]"> | ||
{claimedList.data?.length ? ( | ||
<Table className="mt-4"> | ||
<TableHeader className="border-b"> | ||
<TableRow className="[&_*]:!font-semibold"> | ||
<TableHead className="w-16 text-center" size="sm"> | ||
{t("feeds.tableHeaders.name")} | ||
</TableHead> | ||
<TableHead className="text-center" size="sm"> | ||
{t("feeds.tableHeaders.entryCount")} | ||
</TableHead> | ||
<TableHead className="text-center" size="sm"> | ||
{t("feeds.tableHeaders.subscriptionCount")} | ||
</TableHead> | ||
<TableHead className="text-center" size="sm"> | ||
{t("feeds.tableHeaders.tipAmount")} | ||
</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody className="border-t-[12px] border-transparent"> | ||
{claimedList.data?.map((row) => ( | ||
<TableRow key={row.feed.id} className="h-8"> | ||
<TableCell size="sm"> | ||
<a | ||
target="_blank" | ||
href={`${WEB_URL}/feed/${row.feed.id}`} | ||
className="flex items-center" | ||
> | ||
<FeedIcon fallback feed={row.feed} size={16} /> | ||
<span className="inline-block max-w-[200px] truncate"> | ||
{row.feed.title} | ||
</span> | ||
</a> | ||
</TableCell> | ||
<TableCell align="center" className="tabular-nums" size="sm"> | ||
{row.entryCount} | ||
</TableCell> | ||
<TableCell align="center" className="tabular-nums" size="sm"> | ||
{row.subscriptionCount} | ||
</TableCell> | ||
<TableCell align="center" size="sm"> | ||
<Balance>{BigInt(row.tipAmount || 0n)}</Balance> | ||
</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
) : claimedList.isLoading ? ( | ||
<LoadingCircle size="large" className="center absolute inset-0" /> | ||
) : ( | ||
<div className="mt-36 w-full text-center text-sm text-zinc-400"> | ||
<p>{t("feeds.noFeeds")}</p> | ||
</div> | ||
)} | ||
</ScrollArea.ScrollArea> | ||
</div> | ||
</section> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<> | ||
<SettingsTitle /> | ||
<SettingFeeds /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters