g1t/apps/web/app/routes/repo/soon.tsx
| 1 | import { ArrowRight, Check, Sparkles } from "lucide-react"; |
| 2 | import { Link, data } from "react-router"; |
| 3 | |
| 4 | import type { Route } from "./+types/soon"; |
| 5 | import { page } from "../../lib/meta"; |
| 6 | import { ROADMAP, roadmapIn, roadmapItem } from "../../lib/roadmap"; |
| 7 | |
| 8 | export function meta({ params, ...args }: Route.MetaArgs) { |
| 9 | const item = roadmapItem(params.feature); |
| 10 | return page(args, { |
| 11 | title: `${item?.title ?? "Soon"} · ${params.owner}/${params.repo} · g1t`, |
| 12 | description: item ? `Soon on g1t: ${item.summary}` : null, |
| 13 | version: item ? [item.title, item.summary] : undefined, |
| 14 | }); |
| 15 | } |
| 16 | |
| 17 | export function loader({ params }: Route.LoaderArgs) { |
| 18 | const item = roadmapItem(params.feature); |
| 19 | if (!item) throw data(null, { status: 404 }); |
| 20 | return { item }; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * A page a project will have: what it is for, what it will do, and what |
| 25 | * to use until then. Reached from the project menu's Soon items. |
| 26 | */ |
| 27 | export default function Soon({ loaderData, params }: Route.ComponentProps) { |
| 28 | const { item } = loaderData; |
| 29 | const base = `/${params.owner}/${params.repo}`; |
| 30 | const siblings = roadmapIn(item.section).filter((other) => other.key !== item.key); |
| 31 | return ( |
| 32 | <div className="mx-auto max-w-3xl"> |
| 33 | <p className="flex items-center gap-2 text-sm text-muted"> |
| 34 | <span>{item.section}</span> |
| 35 | <span className="text-line-strong">/</span> |
| 36 | <span className="text-fg">{item.title}</span> |
| 37 | </p> |
| 38 | <div className="mt-4 flex flex-wrap items-center gap-3"> |
| 39 | <h1 className="text-3xl font-semibold tracking-tight">{item.title}</h1> |
| 40 | <span className="inline-flex items-center gap-1.5 rounded-full border border-accent/40 bg-accent/10 px-2.5 py-0.5 text-xs font-medium text-accent"> |
| 41 | <Sparkles size={12} /> |
| 42 | Soon |
| 43 | </span> |
| 44 | </div> |
| 45 | <p className="mt-3 text-lg text-muted">{item.summary}</p> |
| 46 | |
| 47 | <section className="mt-8 rounded-xl border border-line bg-surface p-6"> |
| 48 | <p className="leading-relaxed">{item.why}</p> |
| 49 | <h2 className="mt-6 text-sm font-medium text-muted">What it will do</h2> |
| 50 | <ul className="mt-3 space-y-2.5"> |
| 51 | {item.plans.map((plan) => ( |
| 52 | <li key={plan} className="flex gap-3 text-sm"> |
| 53 | <Check size={16} className="mt-0.5 shrink-0 text-accent" /> |
| 54 | <span>{plan}</span> |
| 55 | </li> |
| 56 | ))} |
| 57 | </ul> |
| 58 | </section> |
| 59 | |
| 60 | {item.today && ( |
| 61 | <Link |
| 62 | to={`${base}/${item.today.path}`} |
| 63 | className="group mt-4 flex items-center justify-between gap-4 rounded-xl border border-line px-5 py-4 transition-colors hover:border-line-strong hover:bg-surface" |
| 64 | > |
| 65 | <span> |
| 66 | <span className="block text-xs text-faint">Until then</span> |
| 67 | <span className="mt-0.5 block text-sm font-medium">{item.today.label}</span> |
| 68 | </span> |
| 69 | <ArrowRight size={16} className="text-faint transition-transform group-hover:translate-x-0.5 group-hover:text-fg" /> |
| 70 | </Link> |
| 71 | )} |
| 72 | |
| 73 | {siblings.length > 0 && ( |
| 74 | <section className="mt-10"> |
| 75 | <h2 className="text-sm font-medium text-muted">Also coming to {item.section}</h2> |
| 76 | <ul className="mt-3 grid gap-3 sm:grid-cols-2"> |
| 77 | {siblings.map((other) => ( |
| 78 | <li key={other.key}> |
| 79 | <Link |
| 80 | to={`${base}/soon/${other.key}`} |
| 81 | className="block h-full rounded-xl border border-line p-4 transition-colors hover:border-line-strong hover:bg-surface" |
| 82 | > |
| 83 | <span className="text-sm font-medium">{other.title}</span> |
| 84 | <span className="mt-1 block text-sm text-muted">{other.summary}</span> |
| 85 | </Link> |
| 86 | </li> |
| 87 | ))} |
| 88 | </ul> |
| 89 | </section> |
| 90 | )} |
| 91 | |
| 92 | <p className="mt-10 text-xs text-faint"> |
| 93 | {ROADMAP.length} things are on the way to every project. Want this one sooner, or something else?{" "} |
| 94 | <a href="https://g1t.sh/syntaqx/g1t/issues/new" className="text-muted hover:text-fg"> |
| 95 | Tell us |
| 96 | </a> |
| 97 | . |
| 98 | </p> |
| 99 | </div> |
| 100 | ); |
| 101 | } |