diff --git a/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx b/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx index 6232ea55f..01b2649f6 100644 --- a/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx +++ b/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx @@ -112,6 +112,7 @@ export const FeedForm: Component<{ url, onSuccess, + isLoading: feedQuery.isLoading, subscriptionData: feedQuery.data?.subscription, entries: feedQuery.data?.entries, feed, @@ -177,6 +178,7 @@ const FeedInnerForm = ({ analytics, placeholderRef, + isLoading, }: { defaultValues?: z.infer id?: string @@ -193,6 +195,7 @@ const FeedInnerForm = ({ analytics?: FeedAnalyticsModel placeholderRef: React.RefObject + isLoading: boolean }) => { const subscription = useSubscriptionByFeedId(id || "") || subscriptionData const isSubscribed = !!subscription @@ -302,7 +305,7 @@ const FeedInnerForm = ({ return (
- +
= ({ feed, analytics, showAnalytics = true }) => { +export const FeedSummary: FC = ({ + feed, + analytics, + showAnalytics = true, + isLoading, +}) => { const { t } = useTranslation("common") + const showSkeleton = isLoading && !analytics && !("updatedAt" in feed && feed.updatedAt) + + if (!showAnalytics) { + return ( +
+ +
+ ) + } return (
- {showAnalytics && ( -
- {!analytics && !("updatedAt" in feed && "updatedAt" in feed && feed.updatedAt) ? ( - - ) : ( -
- {!!analytics?.subscriptionCount && ( -
- +
+ {showSkeleton ? ( + + ) : ( +
+ {!!analytics?.subscriptionCount && ( +
+ - - {formatNumber(analytics.subscriptionCount)}{" "} - {t("feed.follower", { count: analytics.subscriptionCount })} - -
- )} - {analytics && "updatesPerWeek" in analytics && analytics?.updatesPerWeek ? ( -
- - {t("feed.entry_week", { count: analytics.updatesPerWeek ?? 0 })} -
- ) : analytics && - "latestEntryPublishedAt" in analytics && - analytics?.latestEntryPublishedAt ? ( -
- - {t("feed.updated_at")} - -
- ) : null} - {"updatedAt" in feed && feed.updatedAt ? ( -
- - {t("feed.updated_at")} - -
- ) : null} -
- )} -
- )} + + {formatNumber(analytics.subscriptionCount)}{" "} + {t("feed.follower", { count: analytics.subscriptionCount })} + +
+ )} + {analytics && "updatesPerWeek" in analytics && analytics?.updatesPerWeek ? ( +
+ + {t("feed.entry_week", { count: analytics.updatesPerWeek ?? 0 })} +
+ ) : analytics && + "latestEntryPublishedAt" in analytics && + analytics?.latestEntryPublishedAt ? ( +
+ + {t("feed.updated_at")} + +
+ ) : 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 1dc27b409..48c63ae64 100644 --- a/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx +++ b/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx @@ -90,6 +90,7 @@ export const ListForm: Component<{ subscriptionData: feedQuery.data?.subscription, analytics: feedQuery.data?.analytics, list, + isLoading: feedQuery.isLoading, }} /> ) : feedQuery.isLoading ? ( @@ -163,6 +164,7 @@ const ListInnerForm = ({ subscriptionData, list, analytics, + isLoading, }: { defaultValues?: z.infer id?: string @@ -176,6 +178,7 @@ const ListInnerForm = ({ } list: ListModel analytics?: ListAnalyticsModel + isLoading: boolean }) => { const subscription = useSubscriptionByFeedId(id || "") || subscriptionData const isSubscribed = !!subscription @@ -266,6 +269,7 @@ const ListInnerForm = ({ return (