Skip to content

Commit ba8f228

Browse files
committed
feat(web): add Privacy and Terms pages with markdown content and update routing
1 parent c345432 commit ba8f228

8 files changed

Lines changed: 807 additions & 6 deletions

File tree

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"globals": "^15.15.0",
7575
"postcss": "8.5.3",
7676
"prettier": "^3.5.3",
77+
"react-markdown": "^10.1.0",
7778
"tailwind-merge": "^3.2.0",
7879
"tailwindcss": "3.4.1",
7980
"tailwindcss-animate": "^1.0.7",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { ChevronLeft } from "lucide-react";
2+
import { ReactNode } from "react";
3+
import { useNavigate } from "react-router";
4+
5+
import { cn } from "@/utils/utils";
6+
7+
import { Logo } from "../logo";
8+
9+
interface ContentLayoutProps {
10+
title: string;
11+
children: ReactNode;
12+
}
13+
14+
export function ContentLayout({ title, children }: ContentLayoutProps) {
15+
const navigate = useNavigate();
16+
17+
const handleBack = () => {
18+
if (window.history.length > 1) {
19+
navigate(-1);
20+
} else {
21+
navigate("/", { replace: true });
22+
}
23+
};
24+
25+
return (
26+
<div className="mx-auto flex h-full max-w-screen-md flex-col p-8 lg:px-12 lg:py-16">
27+
<button
28+
type="button"
29+
className={cn(
30+
"mb-10 flex items-center gap-0.5 font-bold text-muted-foreground transition-colors hover:text-foreground"
31+
)}
32+
onClick={handleBack}
33+
>
34+
<ChevronLeft className="inline h-5 w-5 *:!stroke-inherit" />
35+
Back
36+
</button>
37+
<h1 className="mb-4 text-3xl font-bold">{title}</h1>
38+
<section className="md mb-12 text-justify">{children}</section>
39+
<div className="flex w-full justify-center">
40+
<a href="/" aria-label="Dafthunk Homepage">
41+
<Logo />
42+
</a>
43+
</div>
44+
</div>
45+
);
46+
}

apps/web/src/components/login-form.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,22 @@ export function LoginForm({
6868
</div>
6969
</CardContent>
7070
</Card>
71-
<div className="text-balance text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary">
71+
<div className="text-balance text-center text-xs text-muted-foreground">
7272
By signing in, you agree to our{" "}
73-
<Link to="/terms-of-service">Terms of Service</Link> and{" "}
74-
<Link to="/privacy-policy">Privacy Policy</Link>.
73+
<Link
74+
to="/terms"
75+
className="underline underline-offset-4 hover:text-primary"
76+
>
77+
Terms of Service
78+
</Link>{" "}
79+
and{" "}
80+
<Link
81+
to="/privacy"
82+
className="underline underline-offset-4 hover:text-primary"
83+
>
84+
Privacy Policy
85+
</Link>
86+
.
7587
</div>
7688
</div>
7789
);

apps/web/src/index.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,41 @@
194194
.docs-content em:not([class]) {
195195
@apply italic;
196196
}
197+
198+
/* Markdown */
199+
.md h2 {
200+
@apply text-xl font-semibold;
201+
@apply mb-2 mt-5;
202+
}
203+
204+
.md h3 {
205+
@apply text-lg font-semibold;
206+
@apply mb-1 mt-5;
207+
}
208+
209+
.md p {
210+
@apply mb-2;
211+
}
212+
213+
.md a {
214+
@apply underline;
215+
}
216+
217+
.md ul {
218+
@apply mb-3 list-disc pl-10;
219+
}
220+
221+
.md ol {
222+
@apply mb-3 list-decimal pl-6;
223+
counter-reset: item;
224+
}
225+
226+
.md ol li {
227+
display: block;
228+
}
229+
230+
.md ol li:before {
231+
@apply me-2 text-muted-foreground;
232+
content: counter(item) ". ";
233+
counter-increment: item;
234+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Markdown from "react-markdown";
2+
3+
const privacyPolicy = `
4+
This Privacy Policy explains how we collect, use, and share your personal information when you use our website and services.
5+
6+
## Information We Collect
7+
8+
We collect information from you when you register on our site, place an order, subscribe to our newsletter, respond to a survey or fill out a form.
9+
`;
10+
11+
export function PrivacyPage() {
12+
return <Markdown>{privacyPolicy}</Markdown>;
13+
}

apps/web/src/pages/terms-page.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Markdown from "react-markdown";
2+
3+
const termsOfService = `
4+
This Terms of Service (“Terms”) governs your use of the Dafthunk platform and services (“Services”). By accessing or using our Services, you agree to be bound by these Terms. If you do not agree with these Terms, please do not use our Services.
5+
6+
## 1. Acceptance of Terms
7+
8+
By accessing or using our Services, you agree to be bound by these Terms. If you do not agree with these Terms, please do not use our Services.
9+
10+
## 2. Changes to Terms
11+
12+
We may update these Terms from time to time. We will notify you of any changes by posting the new Terms on this page.
13+
`;
14+
15+
export function TermsPage() {
16+
return <Markdown>{termsOfService}</Markdown>;
17+
}

apps/web/src/routes.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Navigate } from "react-router";
55

66
import { HeadSeo } from "./components/head-seo";
77
import { AppLayout } from "./components/layouts/app-layout";
8+
import { ContentLayout } from "./components/layouts/content-layout";
89
import { DocsLayout } from "./components/layouts/docs-layout";
910
import { ProtectedRoute } from "./components/protected-route";
1011
import { getApiBaseUrl } from "./config/api";
@@ -25,8 +26,10 @@ import { HomePage } from "./pages/home-page";
2526
import { LoginPage } from "./pages/login-page";
2627
import { NotFoundPage } from "./pages/not-found-page";
2728
import { PlaygroundPage } from "./pages/playground-page";
29+
import { PrivacyPage } from "./pages/privacy-page";
2830
import { ProfilePage } from "./pages/profile-page";
2931
import { PublicExecutionPage } from "./pages/public-execution-page";
32+
import { TermsPage } from "./pages/terms-page";
3033

3134
export interface RouteHandle {
3235
head?:
@@ -437,6 +440,24 @@ export const routes: AppRouteObject[] = [
437440
},
438441
},
439442
},
443+
{
444+
path: "/privacy",
445+
element: (
446+
<ContentLayout title="Privacy Policy">
447+
<PrivacyPage />
448+
</ContentLayout>
449+
),
450+
handle: { head: <HeadSeo title="Privacy Policy - Dafthunk" /> },
451+
},
452+
{
453+
path: "/terms",
454+
element: (
455+
<ContentLayout title="Terms of Service">
456+
<TermsPage />
457+
</ContentLayout>
458+
),
459+
handle: { head: <HeadSeo title="Terms of Service - Dafthunk" /> },
460+
},
440461
{
441462
path: "*",
442463
element: (

0 commit comments

Comments
 (0)