diff --git a/src/renderer/src/components/feed-summary.tsx b/src/renderer/src/components/feed-summary.tsx index 8ece5049f..8b3bdeaf1 100644 --- a/src/renderer/src/components/feed-summary.tsx +++ b/src/renderer/src/components/feed-summary.tsx @@ -6,32 +6,34 @@ export function FollowSummary({ feed, docs, }: { - feed: Partial + feed: FeedResponse docs?: string }) { return ( -
+
{(() => { if (feed.image) { - return + return } else if (feed.siteUrl) { - return + return } else if (docs) { - return + return ( + + ) } else { return null } })()} -
+
{feed.title}
{feed.description}
-
- +
+ {feed.url || docs}
diff --git a/src/renderer/src/components/follow/form.tsx b/src/renderer/src/components/follow/form.tsx index fc7c2d8f1..92d07363c 100644 --- a/src/renderer/src/components/follow/form.tsx +++ b/src/renderer/src/components/follow/form.tsx @@ -63,7 +63,7 @@ export function FollowForm({ type }: { type: string }) { mutationFn: async (keyword: string) => { const { data } = await apiFetch<{ data: { - feed: Partial + feed: FeedResponse docs?: string entries?: Partial isSubscribed?: boolean diff --git a/src/renderer/src/components/site-icon.tsx b/src/renderer/src/components/site-icon.tsx index 13ea09afc..395a3477e 100644 --- a/src/renderer/src/components/site-icon.tsx +++ b/src/renderer/src/components/site-icon.tsx @@ -5,13 +5,15 @@ export function SiteIcon({ url, className, }: { - url: string + url?: string className?: string }) { let host let src let fallback + if (!url) return null + try { host = new URL(url).host const pureDomain = parse(host).domainWithoutSuffix diff --git a/src/renderer/src/lib/types.ts b/src/renderer/src/lib/types.ts index 43212369e..fcc829e8e 100644 --- a/src/renderer/src/lib/types.ts +++ b/src/renderer/src/lib/types.ts @@ -9,14 +9,14 @@ export type ActivedList = { export type FeedResponse = { id: string url: string - title: string - description: string - siteUrl: string - image: string + title?: string + description?: string + siteUrl?: string + image?: string checkedAt: string nextCheckAt: string - lastModifiedHeader: string - etagHeader: string + lastModifiedHeader?: string + etagHeader?: string ttl: number } @@ -24,8 +24,8 @@ export type SubscriptionResponse = { userId: string feedId: string view: number - category: string - title: string + category?: string + title?: string unread?: number feeds: FeedResponse }[]