From 764fc0ecf9641f5844b1ea5ec7322b0f4606daf2 Mon Sep 17 00:00:00 2001 From: Innei Date: Sun, 27 Apr 2025 22:47:43 +0800 Subject: [PATCH] refactor(discover): remove unused constants and styles - Deleted the constants file for RSSHubCategories as it is no longer needed. - Removed the recommendations.module.css file to clean up unused styles. - Updated recommendations and recommendations-card components to utilize the new import path for constants. - Enhanced the layout and styling of the Recommendations component for better user experience. Signed-off-by: Innei --- .../src/modules/discover/constants.ts | 25 -- .../modules/discover/recommendations-card.tsx | 17 +- .../discover/recommendations.module.css | 24 -- .../src/modules/discover/recommendations.tsx | 234 +++++++++++------- .../modules/new-user-guide/steps/rsshub.tsx | 2 +- .../renderer/src/modules/trending/index.tsx | 2 +- 6 files changed, 155 insertions(+), 149 deletions(-) delete mode 100644 apps/desktop/src/renderer/src/modules/discover/constants.ts delete mode 100644 apps/desktop/src/renderer/src/modules/discover/recommendations.module.css diff --git a/apps/desktop/src/renderer/src/modules/discover/constants.ts b/apps/desktop/src/renderer/src/modules/discover/constants.ts deleted file mode 100644 index 0646af072..000000000 --- a/apps/desktop/src/renderer/src/modules/discover/constants.ts +++ /dev/null @@ -1,25 +0,0 @@ -export const RSSHubCategories = [ - "all", - "social-media", - "new-media", - "traditional-media", - "bbs", - "blog", - "programming", - "design", - "live", - "multimedia", - "picture", - "anime", - "program-update", - "university", - "forecast", - "travel", - "shopping", - "game", - "reading", - "government", - "study", - "journal", - "finance", -] as const diff --git a/apps/desktop/src/renderer/src/modules/discover/recommendations-card.tsx b/apps/desktop/src/renderer/src/modules/discover/recommendations-card.tsx index cd8fcb8b0..483df5da5 100644 --- a/apps/desktop/src/renderer/src/modules/discover/recommendations-card.tsx +++ b/apps/desktop/src/renderer/src/modules/discover/recommendations-card.tsx @@ -1,4 +1,5 @@ import { Card, CardContent, CardHeader, CardTitle } from "@follow/components/ui/card/index.jsx" +import { RSSHubCategories } from "@follow/constants" import { getDominantColor } from "@follow/utils/color" import { clsx, cn, getUrlIcon } from "@follow/utils/utils" import { upperFirst } from "es-toolkit/compat" @@ -9,9 +10,7 @@ import { useTranslation } from "react-i18next" import { useModalStack } from "~/components/ui/modal/stacked/hooks" import { FeedIcon } from "~/modules/feed/feed-icon" -import { RSSHubCategories } from "./constants" import { RecommendationContent } from "./recommendation-content" -import styles from "./recommendations.module.css" import type { RSSHubRouteDeclaration } from "./types" interface RecommendationCardProps { @@ -44,7 +43,7 @@ export const RecommendationCard: FC = memo( }, [data]) return ( - +
@@ -62,14 +61,14 @@ export const RecommendationCard: FC = memo( href={`https://${data.url}`} target="_blank" rel="noreferrer" - className="ml-2 translate-y-1.5" + className="text-title2 ml-2 line-clamp-1 translate-y-1.5" > {data.name} -