diff --git a/public/r/delivery-tracker.json b/public/r/delivery-tracker.json index ab55cd1..1a1a7de 100644 --- a/public/r/delivery-tracker.json +++ b/public/r/delivery-tracker.json @@ -15,7 +15,7 @@ "files": [ { "path": "src/registry/blocks/delivery-tracker/page.tsx", - "content": "\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { Clock3, Utensils, Truck, UserRound } from \"lucide-react\";\n\nimport {\n Map,\n MapMarker,\n MapRoute,\n MarkerContent,\n MarkerTooltip,\n} from \"@/components/ui/map\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\n\ninterface DeliveryMeal {\n name: string;\n price: string;\n quantity: number;\n}\n\ninterface OsrmRouteData {\n coordinates: [number, number][];\n duration: number;\n distance: number;\n}\n\nconst deliveryMeals: DeliveryMeal[] = [\n {\n name: \"Spicy Tofu Grain Bowl\",\n price: \"$44.00\",\n quantity: 1,\n },\n {\n name: \"Herb Chicken Rice Box\",\n price: \"$58.00\",\n quantity: 2,\n },\n {\n name: \"Roasted Veggie Wrap\",\n price: \"$29.00\",\n quantity: 1,\n },\n];\n\nconst pickup = { lng: -122.466, lat: 37.716 };\nconst dropoff = { lng: -122.399, lat: 37.683 };\n\nfunction formatDistance(meters?: number) {\n if (!meters) return \"--\";\n if (meters < 1000) return `${Math.round(meters)} m`;\n return `${(meters / 1000).toFixed(1)} km`;\n}\n\nfunction formatDuration(seconds?: number) {\n if (!seconds) return \"--\";\n const minutes = Math.round(seconds / 60);\n if (minutes < 60) return `${minutes} min`;\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n return `${hours}h ${remainingMinutes}m`;\n}\n\nexport default function Page() {\n const [routeData, setRouteData] = useState(null);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n async function fetchRoute() {\n setLoading(true);\n try {\n const response = await fetch(\n `https://router.project-osrm.org/route/v1/driving/${pickup.lng},${pickup.lat};${dropoff.lng},${dropoff.lat}?overview=full&geometries=geojson`\n );\n const data = await response.json();\n const route = data?.routes?.[0];\n if (!route?.geometry?.coordinates) return;\n\n setRouteData({\n coordinates: route.geometry.coordinates as [number, number][],\n duration: route.duration as number,\n distance: route.distance as number,\n });\n } catch (error) {\n console.error(\"Failed to fetch route:\", error);\n } finally {\n setLoading(false);\n }\n }\n\n fetchRoute();\n }, []);\n\n const progressCoordinates = useMemo(() => {\n const progressCount = Math.max(\n 2,\n Math.floor(\n (routeData?.coordinates?.length ?? 0) * (routeData ? 0.62 : 0.66)\n )\n );\n return routeData?.coordinates?.slice(0, progressCount) ?? [];\n }, [routeData]);\n\n const courierPosition = progressCoordinates[progressCoordinates.length - 1];\n\n return (\n
\n
\n
\n
\n

\n Track Delivery\n

\n

Mon Feb 10 - 2-3 PM

\n
\n\n \n \n \n Order items ({deliveryMeals.length})\n \n \n \n {deliveryMeals.map((meal) => (\n
\n
\n \n
\n
\n

\n {meal.name}\n

\n

\n {meal.price}\n

\n
\n \n x{meal.quantity}\n \n
\n ))}\n
\n Bundle total\n $189.00\n
\n
\n
\n\n
\n \n \n

\n Pickup confirmed\n

\n

Mon, Feb 10 at 1:48 PM

\n
\n
\n \n \n

\n Remaining travel\n

\n

\n {formatDuration(routeData?.duration)}\n

\n
\n
\n
\n\n
\n \n \n
\n
\n\n
\n \n \n \n\n {courierPosition && (\n \n \n
\n \n
\n
\n \n
\n

\n Order {formatDuration(routeData?.duration)} away\n

\n

\n Route {formatDistance(routeData?.distance)}\n

\n
\n
\n \n )}\n\n \n \n
\n \n \n

Origin

\n
\n \n\n \n \n
\n \n \n

Destination

\n
\n \n \n
\n
\n
\n );\n}\n", + "content": "\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { Clock3, Utensils, Truck, UserRound } from \"lucide-react\";\n\nimport {\n Map,\n MapMarker,\n MapRoute,\n MarkerContent,\n MarkerTooltip,\n} from \"@/components/ui/map\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\n\ninterface DeliveryMeal {\n name: string;\n price: string;\n quantity: number;\n}\n\ninterface OsrmRouteData {\n coordinates: [number, number][];\n duration: number;\n distance: number;\n}\n\nconst deliveryMeals: DeliveryMeal[] = [\n {\n name: \"Spicy Tofu Grain Bowl\",\n price: \"$44.00\",\n quantity: 1,\n },\n {\n name: \"Herb Chicken Rice Box\",\n price: \"$58.00\",\n quantity: 2,\n },\n {\n name: \"Roasted Veggie Wrap\",\n price: \"$29.00\",\n quantity: 1,\n },\n];\n\nconst pickup = { lng: -122.466, lat: 37.716 };\nconst dropoff = { lng: -122.399, lat: 37.683 };\n\nfunction formatDistance(meters?: number) {\n if (!meters) return \"--\";\n if (meters < 1000) return `${Math.round(meters)} m`;\n return `${(meters / 1000).toFixed(1)} km`;\n}\n\nfunction formatDuration(seconds?: number) {\n if (!seconds) return \"--\";\n const minutes = Math.round(seconds / 60);\n if (minutes < 60) return `${minutes} min`;\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n return `${hours}h ${remainingMinutes}m`;\n}\n\nexport default function Page() {\n const [routeData, setRouteData] = useState(null);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n async function fetchRoute() {\n setLoading(true);\n try {\n const response = await fetch(\n `https://router.project-osrm.org/route/v1/driving/${pickup.lng},${pickup.lat};${dropoff.lng},${dropoff.lat}?overview=full&geometries=geojson`,\n );\n const data = await response.json();\n const route = data?.routes?.[0];\n if (!route?.geometry?.coordinates) return;\n\n setRouteData({\n coordinates: route.geometry.coordinates as [number, number][],\n duration: route.duration as number,\n distance: route.distance as number,\n });\n } catch (error) {\n console.error(\"Failed to fetch route:\", error);\n } finally {\n setLoading(false);\n }\n }\n\n fetchRoute();\n }, []);\n\n const progressCoordinates = useMemo(() => {\n const progressCount = Math.max(\n 2,\n Math.floor(\n (routeData?.coordinates?.length ?? 0) * (routeData ? 0.62 : 0.66),\n ),\n );\n return routeData?.coordinates?.slice(0, progressCount) ?? [];\n }, [routeData]);\n\n const courierPosition = progressCoordinates[progressCoordinates.length - 1];\n\n return (\n
\n
\n
\n
\n

\n Track Delivery\n

\n

Mon Feb 10 - 2-3 PM

\n
\n\n \n \n \n Order items ({deliveryMeals.length})\n \n \n \n {deliveryMeals.map((meal) => (\n
\n
\n \n
\n
\n

\n {meal.name}\n

\n

\n {meal.price}\n

\n
\n \n x{meal.quantity}\n \n
\n ))}\n
\n Bundle total\n $189.00\n
\n
\n
\n\n
\n \n \n

\n Pickup confirmed\n

\n

Mon, Feb 10 at 1:48 PM

\n
\n
\n \n \n

\n Remaining travel\n

\n

\n {formatDuration(routeData?.duration)}\n

\n
\n
\n
\n\n
\n \n \n
\n
\n\n
\n \n \n \n\n {courierPosition && (\n \n \n
\n \n
\n
\n \n
\n

\n Order {formatDuration(routeData?.duration)} away\n

\n

\n Route {formatDistance(routeData?.distance)}\n

\n
\n
\n \n )}\n\n \n \n
\n \n Origin\n \n\n \n \n
\n \n Destination\n \n \n
\n
\n
\n );\n}\n", "type": "registry:page", "target": "app/delivery/page.tsx" } diff --git a/src/app/(main)/(home)/_components/examples-grid.tsx b/src/app/(main)/(home)/_components/examples-grid.tsx index f4f8f46..2921c99 100644 --- a/src/app/(main)/(home)/_components/examples-grid.tsx +++ b/src/app/(main)/(home)/_components/examples-grid.tsx @@ -9,7 +9,7 @@ import { FlyToExample } from "./examples/flyto-example"; export function ExamplesGrid() { return ( -
+
diff --git a/src/app/(main)/(home)/_components/examples/analytics-example.tsx b/src/app/(main)/(home)/_components/examples/analytics-example.tsx index 4bd47d3..17b7a4d 100644 --- a/src/app/(main)/(home)/_components/examples/analytics-example.tsx +++ b/src/app/(main)/(home)/_components/examples/analytics-example.tsx @@ -20,36 +20,18 @@ const analyticsData = [ export function AnalyticsExample() { return ( -
-
+
+
Active Users
-
2,847
-
+
2,847
+
+12.5% - vs last hour -
-
- -
-
-
-
- High -
-
-
- Medium -
-
-
- Low -
+ vs last hour
@@ -66,7 +48,7 @@ export function AnalyticsExample() { }} />
{loc.city}
-
+
{loc.users}
-
+
active users
diff --git a/src/app/(main)/(home)/_components/examples/delivery-example.tsx b/src/app/(main)/(home)/_components/examples/delivery-example.tsx index 0056752..46ba944 100644 --- a/src/app/(main)/(home)/_components/examples/delivery-example.tsx +++ b/src/app/(main)/(home)/_components/examples/delivery-example.tsx @@ -18,14 +18,14 @@ const home = { lng: -0.07, lat: 51.51 }; export function DeliveryExample() { const [route, setRoute] = useState<[number, number][]>([]); const [truckPosition, setTruckPosition] = useState<[number, number] | null>( - null + null, ); useEffect(() => { async function fetchRoute() { try { const response = await fetch( - `https://router.project-osrm.org/route/v1/driving/${store.lng},${store.lat};${home.lng},${home.lat}?overview=full&geometries=geojson` + `https://router.project-osrm.org/route/v1/driving/${store.lng},${store.lat};${home.lng},${home.lat}?overview=full&geometries=geojson`, ); const data = await response.json(); @@ -48,7 +48,7 @@ export function DeliveryExample() { {route.length > 0 && ( @@ -56,14 +56,14 @@ export function DeliveryExample() { )} -
+
Store {truckPosition && ( -
+
@@ -72,7 +72,7 @@ export function DeliveryExample() { )} -
+
Home diff --git a/src/app/(main)/(home)/_components/examples/ev-charging-example.tsx b/src/app/(main)/(home)/_components/examples/ev-charging-example.tsx index 2c6f4fa..a6fe83a 100644 --- a/src/app/(main)/(home)/_components/examples/ev-charging-example.tsx +++ b/src/app/(main)/(home)/_components/examples/ev-charging-example.tsx @@ -117,11 +117,7 @@ const statusConfig: Record< export function EVChargingExample() { return ( - + {stations.map((station) => { const config = statusConfig[station.status]; @@ -144,7 +140,7 @@ export function EVChargingExample() { {config.label}
{station.detail && ( -
+
{station.detail}
)} diff --git a/src/app/(main)/(home)/_components/examples/example-card.tsx b/src/app/(main)/(home)/_components/examples/example-card.tsx index 7fc3481..855b00d 100644 --- a/src/app/(main)/(home)/_components/examples/example-card.tsx +++ b/src/app/(main)/(home)/_components/examples/example-card.tsx @@ -1,27 +1,32 @@ "use client"; +import { CSSProperties } from "react"; import { cn } from "@/lib/utils"; interface ExampleCardProps { - label: string; + label?: string; className?: string; - delay?: string; + stagger?: number; children: React.ReactNode; } export function ExampleCard({ label, className, - delay = "delay-500", + stagger = 5, children, }: ExampleCardProps) { return (
{label && (
diff --git a/src/app/(main)/(home)/_components/examples/flyto-example.tsx b/src/app/(main)/(home)/_components/examples/flyto-example.tsx index 75653e2..e12a00c 100644 --- a/src/app/(main)/(home)/_components/examples/flyto-example.tsx +++ b/src/app/(main)/(home)/_components/examples/flyto-example.tsx @@ -23,7 +23,7 @@ export function FlyToExample() { const mapRef = useRef(null); return ( - +
-
-
+
+
{destination.name}
-
+
{destination.description}
diff --git a/src/app/(main)/(home)/_components/examples/trail-example.tsx b/src/app/(main)/(home)/_components/examples/trail-example.tsx index 2c3f676..7daaa3b 100644 --- a/src/app/(main)/(home)/_components/examples/trail-example.tsx +++ b/src/app/(main)/(home)/_components/examples/trail-example.tsx @@ -25,37 +25,37 @@ const end = trailCoordinates[trailCoordinates.length - 1]; export function TrailExample() { return ( - -
-
+ +
+
Central Park Loop
-
+
6.2
-
+
Miles
-
+
32
-
+
Mins
-
+
285
-
+
Cal
@@ -72,13 +72,13 @@ export function TrailExample() { -
+
-
+
diff --git a/src/app/(main)/(home)/_components/examples/trending-example.tsx b/src/app/(main)/(home)/_components/examples/trending-example.tsx index f69e4e0..be36568 100644 --- a/src/app/(main)/(home)/_components/examples/trending-example.tsx +++ b/src/app/(main)/(home)/_components/examples/trending-example.tsx @@ -6,63 +6,57 @@ import { ExampleCard } from "./example-card"; export function TrendingExample() { return ( - +
-
+
-
+
-
-
Times Square
-
- - 2.4k visitors -
+

Times Square

+
+ + 2.4k visitors
-
-
+
+
-
-
Central Park
-
- - 1.8k visitors -
+

Central Park

+
+ + 1.8k visitors
-
-
+
+
-
-
Statue of Liberty
-
- - 890 visitors -
+

Statue of Liberty

+
+ + 890 visitors
diff --git a/src/app/(main)/(home)/page.tsx b/src/app/(main)/(home)/page.tsx index fbb7e94..da0b26e 100644 --- a/src/app/(main)/(home)/page.tsx +++ b/src/app/(main)/(home)/page.tsx @@ -1,3 +1,6 @@ +import Link from "next/link"; +import { CSSProperties } from "react"; + import { ExamplesGrid } from "./_components/examples-grid"; import { Footer } from "@/components/footer"; import { @@ -7,7 +10,6 @@ import { PageActions, } from "@/components/page-header"; import { Button } from "@/components/ui/button"; -import Link from "next/link"; export default function Page() { return ( @@ -19,7 +21,6 @@ export default function Page() {
Built on MapLibre. Styled with Tailwind. -
- + {children} - + diff --git a/src/app/(main)/blocks/_components/block-viewer-code.tsx b/src/app/(main)/blocks/_components/block-viewer-code.tsx index 87dd6c9..5ca6fca 100644 --- a/src/app/(main)/blocks/_components/block-viewer-code.tsx +++ b/src/app/(main)/blocks/_components/block-viewer-code.tsx @@ -36,7 +36,7 @@ interface BlockViewerCodeContext { } const BlockViewerCodeCtx = React.createContext( - null + null, ); function useBlockViewerCode() { @@ -57,12 +57,12 @@ export function BlockViewerCode({ highlightedFiles, }: BlockViewerCodeProps) { const [activeFile, setActiveFile] = React.useState( - highlightedFiles[0]?.target ?? "" + highlightedFiles[0]?.target ?? "", ); const file = React.useMemo( () => highlightedFiles.find((f) => f.target === activeFile), - [highlightedFiles, activeFile] + [highlightedFiles, activeFile], ); if (!file) return null; @@ -71,12 +71,12 @@ export function BlockViewerCode({ -
+
-
-
+
+
{file.target}
@@ -85,7 +85,7 @@ export function BlockViewerCode({
@@ -98,7 +98,7 @@ function FileTreeSidebar() { return ( - + Files @@ -125,7 +125,7 @@ function TreeNode({ item, index }: { item: FileTree; index: number }) { item.path && setActiveFile(item.path)} - className="hover:bg-muted-foreground/15 focus:bg-muted-foreground/15 focus-visible:bg-muted-foreground/15 active:bg-muted-foreground/15 data-[active=true]:bg-muted-foreground/15 rounded-none whitespace-nowrap pl-(--index)" + className="hover:bg-muted-foreground/15 focus:bg-muted-foreground/15 focus-visible:bg-muted-foreground/15 active:bg-muted-foreground/15 data-[active=true]:bg-muted-foreground/15 rounded-none pl-(--index) whitespace-nowrap" data-index={index} style={ { @@ -149,7 +149,7 @@ function TreeNode({ item, index }: { item: FileTree; index: number }) { > highlightedFiles.find((f) => f.target === activeFile), - [highlightedFiles, activeFile] + [highlightedFiles, activeFile], ); if (!file) return null; @@ -187,8 +187,7 @@ function CopyCodeButton() { return ( @@ -41,8 +42,13 @@ export default async function Page() {
{blocks.map((block) => ( diff --git a/src/app/(main)/docs/_components/code-block.tsx b/src/app/(main)/docs/_components/code-block.tsx index 69a1e5d..6229997 100644 --- a/src/app/(main)/docs/_components/code-block.tsx +++ b/src/app/(main)/docs/_components/code-block.tsx @@ -15,14 +15,14 @@ export async function CodeBlock({ const highlighted = await highlightCode(code, language); return ( -
+
{showCopyButton && ( -
+
)}
diff --git a/src/app/(main)/docs/_components/component-preview-client.tsx b/src/app/(main)/docs/_components/component-preview-client.tsx index 9f4f14b..16637eb 100644 --- a/src/app/(main)/docs/_components/component-preview-client.tsx +++ b/src/app/(main)/docs/_components/component-preview-client.tsx @@ -2,6 +2,7 @@ import { useState } from "react"; import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; import { CopyButton } from "./copy-button"; interface ComponentPreviewClientProps { @@ -17,48 +18,49 @@ export function ComponentPreviewClient({ highlightedCode, className, }: ComponentPreviewClientProps) { - const [activeTab, setActiveTab] = useState<"preview" | "code">("preview"); + const [expanded, setExpanded] = useState(false); return ( -
-
-
- - -
- - +
+
+ {children}
-
- {activeTab === "preview" ? ( -
{children}
- ) : ( -
- )} +
+
+ +
+
+
+ {!expanded && ( + + )} +
); diff --git a/src/app/(main)/docs/_components/copy-button.tsx b/src/app/(main)/docs/_components/copy-button.tsx index 6ab4c7f..4796d1a 100644 --- a/src/app/(main)/docs/_components/copy-button.tsx +++ b/src/app/(main)/docs/_components/copy-button.tsx @@ -2,14 +2,13 @@ import { useState } from "react"; import { Check, Copy } from "lucide-react"; -import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; interface CopyButtonProps { text: string; - className?: string; } -export function CopyButton({ text, className }: CopyButtonProps) { +export function CopyButton({ text }: CopyButtonProps) { const [copied, setCopied] = useState(false); const copy = async () => { @@ -19,19 +18,14 @@ export function CopyButton({ text, className }: CopyButtonProps) { }; return ( - + {copied ? : } + ); } diff --git a/src/app/(main)/docs/_components/docs-sidebar.tsx b/src/app/(main)/docs/_components/docs-sidebar.tsx index dcae248..8a95789 100644 --- a/src/app/(main)/docs/_components/docs-sidebar.tsx +++ b/src/app/(main)/docs/_components/docs-sidebar.tsx @@ -22,15 +22,13 @@ export function DocsSidebar() { return ( {docsNavigation.map((group) => ( - - {group.title} - + {group.title} {group.items.map((item) => ( @@ -38,7 +36,7 @@ export function DocsSidebar() { -

+

); } diff --git a/src/app/(main)/docs/_components/docs.tsx b/src/app/(main)/docs/_components/docs.tsx index ff9e235..86dcba3 100644 --- a/src/app/(main)/docs/_components/docs.tsx +++ b/src/app/(main)/docs/_components/docs.tsx @@ -33,10 +33,10 @@ interface DocsTitleProps { function DocsTitle({ title, description }: DocsTitleProps) { return (
-

+

{title}

-

+

{description}

@@ -62,18 +62,18 @@ export function DocsLayout({ toc = [], }: DocsLayoutProps) { return ( -
-
+
+
-
{children}
+
{children}
{(prev || next) && ( -
+
{prev ? (
-