From 5d2f28fe009e8d838c90b01d9fa3d8101c57b043 Mon Sep 17 00:00:00 2001 From: Mikhail Chandran Date: Tue, 24 Nov 2026 14:45:02 +0530 Subject: [PATCH] chore: remove three unused components left over from the #313 pass recent-additions-feed needs an added-on date the schema does not have, place-review-badge needs rating data that the contribution rules make meaningless (4.0+ and 50+ reviews are already required), and the checkbox primitive has no importer. All three can be restored from history. The switch primitive stays for the 'Only places in this view' toggle (#351). Closes #359 --- src/components/home/recent-additions-feed.tsx | 70 ------------------- src/components/pins/place-review-badge.tsx | 61 ---------------- src/components/ui/checkbox.tsx | 32 --------- 3 files changed, 163 deletions(-) delete mode 100644 src/components/home/recent-additions-feed.tsx delete mode 100644 src/components/pins/place-review-badge.tsx delete mode 100644 src/components/ui/checkbox.tsx diff --git a/src/components/home/recent-additions-feed.tsx b/src/components/home/recent-additions-feed.tsx deleted file mode 100644 index 04077aa..0000000 --- a/src/components/home/recent-additions-feed.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import Link from "next/link"; - -import type { Place } from "@/lib/types"; -import { PLACE_TYPE_LABELS, humanizeCity } from "@/lib/types"; -import { Badge } from "@/components/ui/badge"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; - -interface RecentAdditionsFeedProps { - /** - * Already ordered by the caller, most-recent-first, however the caller - * decides "recent" (e.g. from git history on `data/places/*.json`, or a - * future `added_on`/`created_at` field). - * - * The `Place` schema (`src/lib/types.ts`, `data/places.schema.json`) has - * no date/timestamp field recording when a place was added - only - * `added_by` (a GitHub username) and, unrelated, an optional - * `verified.on` date that records when someone last *re-checked* a place, - * not when it was first added. So this component does not sort, infer, or - * fabricate a recency order itself: it is presentation-only, and a real - * "recent additions" feed needs that data field added first. - */ - places: Place[]; - limit?: number; - className?: string; -} - -/** A clean scrolling list of places: name, type badge, city, and who added it. */ -export function RecentAdditionsFeed({ - places, - limit = 10, - className, -}: RecentAdditionsFeedProps) { - const shown = places.slice(0, limit); - - return ( - - - Recent additions - - - {shown.length === 0 ? ( -

Nothing to show yet.

- ) : ( -
    - {shown.map((place) => ( -
  • - - - - {place.name} - - - {humanizeCity(place.city)} · added by {place.added_by} - - - - {PLACE_TYPE_LABELS[place.type]} - - -
  • - ))} -
- )} -
-
- ); -} diff --git a/src/components/pins/place-review-badge.tsx b/src/components/pins/place-review-badge.tsx deleted file mode 100644 index 4ac871c..0000000 --- a/src/components/pins/place-review-badge.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { Star } from "lucide-react"; - -import { cn } from "@/lib/utils"; - -/** - * Formats a review count compactly: exact below 1000, otherwise one decimal - * (dropped when whole) plus a k/m suffix, e.g. 950 -> "950", 5000 -> "5k", - * 1200 -> "1.2k", 2_300_000 -> "2.3m". - */ -function formatReviewCount(count: number): string { - const n = Math.max(0, Math.round(count)); - if (n < 1000) return String(n); - const [divisor, suffix] = n < 1_000_000 ? [1_000, "k"] : [1_000_000, "m"]; - const value = Math.round((n / divisor) * 10) / 10; - return `${value % 1 === 0 ? value.toFixed(0) : value.toFixed(1)}${suffix}`; -} - -export interface PlaceReviewBadgeProps { - /** 0-5 star rating. */ - rating?: number; - /** Review count backing the rating. */ - reviewCount?: number; - className?: string; -} - -/** - * Small star-rating badge for a place card. `rating`/`reviewCount` are explicit - * props, NOT read off a `Place` object: the schema (data/places.schema.json, - * `additionalProperties: false`) has no rating fields, since ratings are - * verified at contribution time but not stored in the dataset. This exists - * for a future UI layer that sources ratings from elsewhere (e.g. hardcoded - * on a features/showcase list) and passes them in directly. - */ -export function PlaceReviewBadge({ - rating, - reviewCount, - className, -}: PlaceReviewBadgeProps) { - if (rating == null && reviewCount == null) return null; - - let label: string; - if (rating != null && reviewCount != null) { - label = `${rating.toFixed(1)} (${formatReviewCount(reviewCount)})`; - } else if (rating != null) { - label = rating.toFixed(1); - } else { - label = `${formatReviewCount(reviewCount as number)} reviews`; - } - - return ( - - - {label} - - ); -} diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx deleted file mode 100644 index 2394f49..0000000 --- a/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,32 +0,0 @@ -"use client"; - -import * as React from "react"; -import { Checkbox as CheckboxPrimitive } from "radix-ui"; - -import { cn } from "@/lib/utils"; -import { CheckIcon } from "lucide-react"; - -function Checkbox({ - className, - ...props -}: React.ComponentProps) { - return ( - - - - - - ); -} - -export { Checkbox };