mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
Add privacy policy and terms pages
Replace placeholder pages with detailed legal documents covering data handling, Google Calendar use, user rights, and service terms. Add a shared legal page layout and metadata, plus Google site verification.
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
import Link from 'next/link';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import Logo from '@/app/(dashboard)/components/Logo';
|
||||
import { ToggleTheme } from '@/components/ToggleTheme';
|
||||
import { LEGAL } from '@/lib/legal';
|
||||
|
||||
export type LegalSection = {
|
||||
id: string;
|
||||
title: string;
|
||||
body: ReactNode;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
summary: string;
|
||||
current: 'privacy-policy' | 'terms';
|
||||
sections: LegalSection[];
|
||||
};
|
||||
|
||||
const linkClass =
|
||||
'text-[#B8391A] dark:text-[#FF8F70] underline underline-offset-4 decoration-1 hover:decoration-2 rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#B8391A] dark:focus-visible:outline-[#FF8F70]';
|
||||
|
||||
export function LegalLayout({ title, summary, current, sections }: Props) {
|
||||
const other =
|
||||
current === 'privacy-policy'
|
||||
? { href: '/terms', label: 'Terms of Service' }
|
||||
: { href: '/privacy-policy', label: 'Privacy Policy' };
|
||||
|
||||
return (
|
||||
<div className="h-dvh overflow-y-auto scroll-smooth text-zinc-800 dark:text-zinc-200">
|
||||
<header className="border-b border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950">
|
||||
<div className="mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-2 sm:px-6">
|
||||
<Logo />
|
||||
<nav aria-label="Legal pages" className="flex items-center gap-1 sm:gap-3 text-sm">
|
||||
<Link
|
||||
href="/privacy-policy"
|
||||
aria-current={current === 'privacy-policy' ? 'page' : undefined}
|
||||
className="inline-flex min-h-11 items-center px-2 rounded-sm aria-[current=page]:font-semibold aria-[current=page]:underline underline-offset-8 decoration-2 decoration-his hover:text-zinc-950 dark:hover:text-white"
|
||||
>
|
||||
Privacy
|
||||
</Link>
|
||||
<Link
|
||||
href="/terms"
|
||||
aria-current={current === 'terms' ? 'page' : undefined}
|
||||
className="inline-flex min-h-11 items-center px-2 rounded-sm aria-[current=page]:font-semibold aria-[current=page]:underline underline-offset-8 decoration-2 decoration-his hover:text-zinc-950 dark:hover:text-white"
|
||||
>
|
||||
Terms
|
||||
</Link>
|
||||
<ToggleTheme />
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="mx-auto max-w-6xl px-4 py-8 sm:px-6 sm:py-12 lg:grid lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-12">
|
||||
<aside className="mb-6 lg:mb-0">
|
||||
<div className="lg:sticky lg:top-8">
|
||||
<details className="group rounded-md border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 lg:hidden">
|
||||
<summary className="flex min-h-11 cursor-pointer items-center justify-between px-4 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#B8391A] dark:focus-visible:outline-[#FF8F70]">
|
||||
On this page
|
||||
<span aria-hidden className="text-zinc-500 transition-transform group-open:rotate-180">
|
||||
▾
|
||||
</span>
|
||||
</summary>
|
||||
<TocList sections={sections} />
|
||||
</details>
|
||||
<div className="hidden lg:block">
|
||||
<p className="mb-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">On this page</p>
|
||||
<TocList sections={sections} />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<article className="min-w-0 rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 px-5 py-8 sm:px-10 sm:py-12">
|
||||
<p className="text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{LEGAL.appName} · Last updated {LEGAL.updated}
|
||||
</p>
|
||||
<h1 className="mt-2 text-3xl font-bold tracking-tight text-zinc-950 dark:text-white sm:text-4xl">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="mt-4 max-w-prose text-base leading-7 text-zinc-700 dark:text-zinc-300">{summary}</p>
|
||||
|
||||
<div className="mt-10 space-y-12">
|
||||
{sections.map((s, i) => (
|
||||
<section key={s.id} id={s.id} aria-labelledby={`${s.id}-title`} className="scroll-mt-6">
|
||||
<h2
|
||||
id={`${s.id}-title`}
|
||||
className="text-xl font-semibold tracking-tight text-zinc-950 dark:text-white"
|
||||
>
|
||||
<span className="mr-2 tabular-nums text-zinc-500 dark:text-zinc-400">{i + 1}.</span>
|
||||
{s.title}
|
||||
</h2>
|
||||
<div className="mt-4 space-y-4 text-[15px] leading-7 text-zinc-700 dark:text-zinc-300 [&_strong]:font-semibold [&_strong]:text-zinc-950 dark:[&_strong]:text-white">
|
||||
{s.body}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<footer className="mt-14 flex flex-col gap-3 border-t border-zinc-200 dark:border-zinc-800 pt-6 text-sm sm:flex-row sm:items-center sm:justify-between">
|
||||
<p className="text-zinc-600 dark:text-zinc-400">
|
||||
Questions? Write to{' '}
|
||||
<a className={linkClass} href={`mailto:${LEGAL.contactEmail}`}>
|
||||
{LEGAL.contactEmail}
|
||||
</a>
|
||||
</p>
|
||||
<div className="flex gap-4">
|
||||
<Link className={linkClass} href={other.href}>
|
||||
{other.label}
|
||||
</Link>
|
||||
<Link className={linkClass} href="/">
|
||||
Back to app
|
||||
</Link>
|
||||
</div>
|
||||
</footer>
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function TocList({ sections }: { sections: LegalSection[] }) {
|
||||
return (
|
||||
<ol className="space-y-0.5 px-2 pb-2 text-sm lg:px-0 lg:pb-0">
|
||||
{sections.map((s, i) => (
|
||||
<li key={s.id}>
|
||||
<a
|
||||
href={`#${s.id}`}
|
||||
className="flex min-h-11 items-baseline gap-2 rounded-sm px-2 py-2.5 text-zinc-700 hover:bg-zinc-100 hover:text-zinc-950 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-white focus-visible:outline-2 focus-visible:outline-[#B8391A] dark:focus-visible:outline-[#FF8F70] lg:min-h-0 lg:py-1.5"
|
||||
>
|
||||
<span className="w-5 shrink-0 tabular-nums text-zinc-500 dark:text-zinc-400">{i + 1}.</span>
|
||||
<span>{s.title}</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
);
|
||||
}
|
||||
|
||||
export function UL({ children }: { children: ReactNode }) {
|
||||
return <ul className="list-disc space-y-2 pl-5 marker:text-zinc-400">{children}</ul>;
|
||||
}
|
||||
|
||||
export function A({ href, children }: { href: string; children: ReactNode }) {
|
||||
const external = href.startsWith('http');
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
className={linkClass}
|
||||
{...(external ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
export function DataTable({ head, rows }: { head: string[]; rows: ReactNode[][] }) {
|
||||
return (
|
||||
<div className="overflow-x-auto rounded-md border border-zinc-200 dark:border-zinc-800">
|
||||
<table className="w-full min-w-136 border-collapse text-left text-sm">
|
||||
<thead className="bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100">
|
||||
<tr>
|
||||
{head.map((h) => (
|
||||
<th key={h} scope="col" className="px-4 py-3 font-semibold">
|
||||
{h}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-zinc-200 dark:divide-zinc-800 align-top">
|
||||
{rows.map((r, i) => (
|
||||
<tr key={i}>
|
||||
{r.map((c, j) => (
|
||||
<td key={j} className={j === 0 ? 'px-4 py-3 font-medium text-zinc-950 dark:text-white' : 'px-4 py-3'}>
|
||||
{c}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user