mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
98 lines
3.9 KiB
Handlebars
98 lines
3.9 KiB
Handlebars
{{#if (eq api "orpc")}}
|
|
import { orpc } from "@/utils/orpc";
|
|
{{/if}}
|
|
{{#if (eq api "trpc")}}
|
|
import { trpc } from "@/utils/trpc";
|
|
{{/if}}
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { createFileRoute } from "@tanstack/react-router";
|
|
|
|
export const Route = createFileRoute("/")({
|
|
component: HomeComponent,
|
|
});
|
|
|
|
const TITLE_TEXT = `
|
|
██████╗ ███████╗████████╗████████╗███████╗██████╗
|
|
██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗
|
|
██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝
|
|
██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗
|
|
██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║
|
|
╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
|
|
|
|
████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗
|
|
╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝
|
|
██║ ███████╗ ██║ ███████║██║ █████╔╝
|
|
██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗
|
|
██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗
|
|
╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
|
|
`;
|
|
|
|
function HomeComponent() {
|
|
{{#if (eq api "orpc")}}
|
|
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
{{/if}}
|
|
{{#if (eq api "trpc")}}
|
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
{{/if}}
|
|
|
|
return (
|
|
<div className="container mx-auto max-w-3xl px-4 py-2">
|
|
<pre className="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
|
|
<div className="grid gap-6">
|
|
<section className="rounded-lg border p-4">
|
|
<h2 className="mb-2 font-medium">API Status</h2>
|
|
<div className="flex items-center gap-2">
|
|
<div
|
|
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
/>
|
|
<span className="text-sm text-muted-foreground">
|
|
{healthCheck.isLoading
|
|
? "Checking..."
|
|
: healthCheck.data
|
|
? "Connected"
|
|
: "Disconnected"}
|
|
</span>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<h2 className="mb-3 font-medium">Core Features</h2>
|
|
<ul className="grid grid-cols-2 gap-3">
|
|
<FeatureItem
|
|
title="Type-Safe API"
|
|
description="End-to-end type safety with tRPC"
|
|
/>
|
|
<FeatureItem
|
|
title="Modern React"
|
|
description="TanStack Router + TanStack Query"
|
|
/>
|
|
<FeatureItem
|
|
title="Fast Backend"
|
|
description="Lightweight Hono server"
|
|
/>
|
|
<FeatureItem
|
|
title="Beautiful UI"
|
|
description="TailwindCSS + shadcn/ui components"
|
|
/>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function FeatureItem({
|
|
title,
|
|
description,
|
|
}: {
|
|
title: string;
|
|
description: string;
|
|
}) {
|
|
return (
|
|
<li className="border-l-2 border-primary py-1 pl-3">
|
|
<h3 className="font-medium">{title}</h3>
|
|
<p className="text-sm text-muted-foreground">{description}</p>
|
|
</li>
|
|
);
|
|
}
|