From 7963733eb543fb563366269da00afed19d524768 Mon Sep 17 00:00:00 2001 From: Chloe Lim Date: Tue, 24 Sep 2024 04:45:54 +0800 Subject: [PATCH] style: fix linter --- frontend/app/home.tsx | 20 ++----------------- frontend/components/display/chip.tsx | 4 ++-- .../sidebar/sidebar-other-topics.tsx | 12 +++++------ frontend/components/news/news-article.tsx | 18 +++++++++-------- frontend/types/categories.ts | 1 - 5 files changed, 19 insertions(+), 36 deletions(-) diff --git a/frontend/app/home.tsx b/frontend/app/home.tsx index 9191e29b..b73ec8c5 100644 --- a/frontend/app/home.tsx +++ b/frontend/app/home.tsx @@ -1,30 +1,14 @@ -import Chip from "@/components/display/chip"; import NewsArticle from "@/components/news/news-article"; -import { useUserStore } from "@/store/user/user-store-provider"; -import { - categoriesToDisplayName, - categoriesToIconsMap, - Category, -} from "@/types/categories"; -import { - ArrowUpLeft, - ArrowUpLeftIcon, - ArrowUpRightIcon, - Cat, - ExternalLinkIcon, -} from "lucide-react"; -import Image from "next/image"; /* This component should only be rendered to authenticated users */ const Home = () => { - const user = useUserStore((store) => store.user); return (
-
+
{new Date().toDateString()} -

+

What happened this week

diff --git a/frontend/components/display/chip.tsx b/frontend/components/display/chip.tsx index e8dcdfe5..84643b08 100644 --- a/frontend/components/display/chip.tsx +++ b/frontend/components/display/chip.tsx @@ -1,8 +1,8 @@ import { cva, VariantProps } from "class-variance-authority"; +import { LucideIcon } from "lucide-react"; import { Box } from "@/components/ui/box"; import { cn } from "@/lib/utils"; -import { LucideIcon } from "lucide-react"; const chipVariants = cva( "inline-flex items-center justify-center whitespace-nowrap rounded-md text-xs font-medium transition-colors disabled:pointer-events-none disabled:opacity-50", @@ -36,7 +36,7 @@ interface ChipProps extends VariantProps { const Chip = ({ label, variant, size, className, Icon }: ChipProps) => { return ( - {Icon && } + {Icon && } {label} ); diff --git a/frontend/components/navigation/sidebar/sidebar-other-topics.tsx b/frontend/components/navigation/sidebar/sidebar-other-topics.tsx index 8e086e11..6bb3765e 100644 --- a/frontend/components/navigation/sidebar/sidebar-other-topics.tsx +++ b/frontend/components/navigation/sidebar/sidebar-other-topics.tsx @@ -1,5 +1,3 @@ -import { ComponentProps } from "react"; - import { categoriesToDisplayName, categoriesToIconsMap, @@ -29,14 +27,14 @@ const SidebarOtherTopics = () => { Other topics
- {otherTopics.map((topicItem) => { - const categoryLabel = categoriesToDisplayName[topicItem]; - const categoryIcon = categoriesToIconsMap[topicItem]; + {otherTopics.map((category) => { + const categoryLabel = categoriesToDisplayName[category]; + const categoryIcon = categoriesToIconsMap[category]; return ( ); })} diff --git a/frontend/components/news/news-article.tsx b/frontend/components/news/news-article.tsx index ac372d3a..bbefc91e 100644 --- a/frontend/components/news/news-article.tsx +++ b/frontend/components/news/news-article.tsx @@ -1,11 +1,12 @@ +import Image from "next/image"; +import { ArrowUpRightIcon } from "lucide-react"; + +import Chip from "@/components/display/chip"; import { categoriesToDisplayName, categoriesToIconsMap, Category, } from "@/types/categories"; -import { ArrowUpRightIcon } from "lucide-react"; -import Chip from "../display/chip"; -import Image from "next/image"; const sampleArticleCategories = [ Category.Economics, @@ -20,7 +21,7 @@ const NewsArticle = () => {
- CNA, Guardian + CNA, Guardian 21 Sep 2024
@@ -34,8 +35,9 @@ const NewsArticle = () => {
{sampleArticleCategories.map((category) => ( ))} @@ -43,15 +45,15 @@ const NewsArticle = () => {
diff --git a/frontend/types/categories.ts b/frontend/types/categories.ts index 16312619..3bc2145b 100644 --- a/frontend/types/categories.ts +++ b/frontend/types/categories.ts @@ -1,6 +1,5 @@ import { Building2, - Car, DollarSign, Film, HeartHandshake,