diff --git a/apps/desktop/layer/renderer/src/modules/discover/FeedSummary.tsx b/apps/desktop/layer/renderer/src/modules/discover/FeedSummary.tsx index 17e6d2286..a2811be72 100644 --- a/apps/desktop/layer/renderer/src/modules/discover/FeedSummary.tsx +++ b/apps/desktop/layer/renderer/src/modules/discover/FeedSummary.tsx @@ -1,5 +1,5 @@ import { Skeleton } from "@follow/components/ui/skeleton/index.js" -import type { FeedOrListRespModel } from "@follow/models" +import type { FeedAnalyticsModel, FeedOrListRespModel, ListAnalyticsModel } from "@follow/models" import type { FC } from "react" import { useMemo } from "react" import { useTranslation } from "react-i18next" @@ -11,11 +11,7 @@ import { FollowSummary } from "../feed/feed-summary" export interface FeedSummaryProps { feed: FeedOrListRespModel - analytics?: { - updatesPerWeek: number | null - subscriptionCount: number | null - latestEntryPublishedAt: string | null - } + analytics?: FeedAnalyticsModel | ListAnalyticsModel showAnalytics?: boolean } @@ -28,7 +24,7 @@ export const FeedSummary: FC = ({ feed, analytics, showAnalyti {showAnalytics && (
- {!analytics ? ( + {!analytics && !("updatedAt" in feed && "updatedAt" in feed && feed.updatedAt) ? ( ) : (
@@ -42,12 +38,14 @@ export const FeedSummary: FC = ({ feed, analytics, showAnalyti
)} - {analytics?.updatesPerWeek ? ( + {analytics && "updatesPerWeek" in analytics && analytics?.updatesPerWeek ? (
{t("feed.entry_week", { count: analytics.updatesPerWeek ?? 0 })}
- ) : analytics?.latestEntryPublishedAt ? ( + ) : analytics && + "latestEntryPublishedAt" in analytics && + analytics?.latestEntryPublishedAt ? (
{t("feed.updated_at")} @@ -57,6 +55,13 @@ export const FeedSummary: FC = ({ feed, analytics, showAnalyti />
) : null} + {"updatedAt" in feed && feed.updatedAt ? ( +
+ + {t("feed.updated_at")} + +
+ ) : null}
)} diff --git a/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx b/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx index be001b0a2..ddb32236f 100644 --- a/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx +++ b/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx @@ -1,5 +1,4 @@ import { Button } from "@follow/components/ui/button/index.js" -import { Card, CardHeader } from "@follow/components/ui/card/index.jsx" import { Form, FormControl, @@ -13,7 +12,7 @@ import { Input } from "@follow/components/ui/input/index.js" import { LoadingCircle } from "@follow/components/ui/loading/index.jsx" import { Switch } from "@follow/components/ui/switch/index.jsx" import { FeedViewType } from "@follow/constants" -import type { ListModel } from "@follow/models/types" +import type { ListAnalyticsModel, ListModel } from "@follow/models/types" import { tracker } from "@follow/tracker" import { cn } from "@follow/utils/utils" import { zodResolver } from "@hookform/resolvers/zod" @@ -31,7 +30,6 @@ import { apiClient } from "~/lib/api-fetch" import { tipcClient } from "~/lib/client" import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser" import { getNewIssueUrl } from "~/lib/issues" -import { FollowSummary } from "~/modules/feed/feed-summary" import { entries as entriesQuery } from "~/queries/entries" import { lists as listsQuery, useList } from "~/queries/lists" import { subscription as subscriptionQuery } from "~/queries/subscriptions" @@ -41,6 +39,7 @@ import { feedUnreadActions } from "~/store/unread" import { useTOTPModalWrapper } from "../profile/hooks" import { ViewSelectorRadioGroup } from "../shared/ViewSelectorRadioGroup" +import { FeedSummary } from "./FeedSummary" const formSchema = z.object({ view: z.string(), @@ -92,6 +91,7 @@ export const ListForm: Component<{ onSuccess, subscriptionData: feedQuery.data?.subscription, + analytics: feedQuery.data?.analytics, list, }} /> @@ -165,6 +165,7 @@ const ListInnerForm = ({ onSuccess, subscriptionData, list, + analytics, }: { defaultValues?: z.infer id?: string @@ -177,6 +178,7 @@ const ListInnerForm = ({ title?: string | null } list: ListModel + analytics?: ListAnalyticsModel }) => { const subscription = useSubscriptionByFeedId(id || "") || subscriptionData const isSubscribed = !!subscription @@ -272,11 +274,7 @@ const ListInnerForm = ({ return (
- - - - - +
- {!simple && ( + {!simple && feed.description && ( {feed.description} diff --git a/packages/internal/models/src/types.ts b/packages/internal/models/src/types.ts index a89e9f3f6..ff907f3a6 100644 --- a/packages/internal/models/src/types.ts +++ b/packages/internal/models/src/types.ts @@ -38,6 +38,10 @@ export type FeedAnalyticsModel = ExtractBizResponse< typeof _apiClient.feeds.$get >["data"]["analytics"] +export type ListAnalyticsModel = ExtractBizResponse< + typeof _apiClient.lists.$get +>["data"]["analytics"] + export type ListModel = Omit export type ListModelPoplutedFeeds = ExtractBizResponse< typeof _apiClient.lists.$get diff --git a/packages/internal/shared/src/hono.ts b/packages/internal/shared/src/hono.ts index 8de20634d..d6fd32270 100644 --- a/packages/internal/shared/src/hono.ts +++ b/packages/internal/shared/src/hono.ts @@ -19638,6 +19638,10 @@ declare const _routes: hono_hono_base.HonoBase