diff --git a/src/renderer/src/hono.ts b/src/renderer/src/hono.ts index c17401ba7..0a3454908 100644 --- a/src/renderer/src/hono.ts +++ b/src/renderer/src/hono.ts @@ -451,6 +451,34 @@ declare const routes: hono_hono_base.HonoBase; + maintainers: string[]; + location: string; + }>; + }>; + }; + outputFormat: "json"; + status: 200; + }; + }; } & { "/auth-app/new-session": { $post: { diff --git a/src/renderer/src/modules/discover/form.tsx b/src/renderer/src/modules/discover/form.tsx index c36fa9577..1e270257a 100644 --- a/src/renderer/src/modules/discover/form.tsx +++ b/src/renderer/src/modules/discover/form.tsx @@ -39,7 +39,7 @@ const info: Record< prefix?: string } > = { - general: { + search: { label: "Any URL or Keyword", }, rss: { diff --git a/src/renderer/src/modules/discover/recommendations.tsx b/src/renderer/src/modules/discover/recommendations.tsx index 04c19cba8..bc7ba5ded 100644 --- a/src/renderer/src/modules/discover/recommendations.tsx +++ b/src/renderer/src/modules/discover/recommendations.tsx @@ -1,11 +1,47 @@ -export function Recommendations({ type: _type }: { type: string }) { +import { SiteIcon } from "@renderer/components/site-icon" +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@renderer/components/ui/card" +import { useBizQuery } from "@renderer/hooks" +import { Queries } from "@renderer/queries" + +export function Recommendations() { + const rsshubPopular = useBizQuery(Queries.discover.rsshubCategory({ + category: "popular", + })) + return (
-
Suggested
- +
Popular
+ {rsshubPopular.data && ( +
+ {Object.keys(rsshubPopular.data).map((key) => ( + + + + + {rsshubPopular.data[key].name} + + + + +
    + {Object.keys(rsshubPopular.data[key].routes).map((route) => ( +
  • {rsshubPopular.data[key].routes[route].name}
  • + ))} +
+
+
+
+ ))} +
+ )}
) } diff --git a/src/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx b/src/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx index 3a92bf00c..01a1e74c9 100644 --- a/src/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx +++ b/src/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx @@ -11,8 +11,8 @@ import { Recommendations } from "@renderer/modules/discover/recommendations" export function Component() { const tabs = [ { - name: "General", - value: "general", + name: "Search", + value: "search", }, { name: "RSS", @@ -44,9 +44,9 @@ export function Component() { ] return ( -
+
Discover
- + {tabs.map((tab) => ( {tabs.map((tab) => ( - + {tab.value === "import" ? ( @@ -67,10 +67,10 @@ export function Component() { ( )} - ))} +
) } diff --git a/src/renderer/src/queries/discover.ts b/src/renderer/src/queries/discover.ts new file mode 100644 index 000000000..dd5903799 --- /dev/null +++ b/src/renderer/src/queries/discover.ts @@ -0,0 +1,18 @@ +import { apiClient } from "@renderer/lib/api-fetch" +import { defineQuery } from "@renderer/lib/defineQuery" + +export const discover = { + rsshubCategory: ({ + category, + }: { + category: string + }) => + defineQuery(["discover", "rsshub", category], async () => { + const res = await apiClient.discover.rsshub.$get({ + query: { + category, + }, + }) + return res.data + }), +} diff --git a/src/renderer/src/queries/index.ts b/src/renderer/src/queries/index.ts index 20b21ebd5..43f40df9a 100644 --- a/src/renderer/src/queries/index.ts +++ b/src/renderer/src/queries/index.ts @@ -1,6 +1,7 @@ import { action } from "./actions" import { ai } from "./ai" import { auth } from "./auth" +import { discover } from "./discover" import { entries } from "./entries" import { feed } from "./feed" import { subscription } from "./subscriptions" @@ -12,4 +13,5 @@ export const Queries = { action, auth, ai, + discover, }