Skip to content

Commit

Permalink
feat: add mock terms of service & privacy policy pages
Browse files Browse the repository at this point in the history
Signed-off-by: rajput-hemant <[email protected]>
  • Loading branch information
rajput-hemant committed Dec 16, 2023
1 parent 67ee083 commit 6158170
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 57 deletions.
31 changes: 14 additions & 17 deletions app/(auth)/components/auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,20 @@ export function AuthForm({ mode }: AuthFormProps) {
});

function signInToaster() {
toast({
const { dismiss } = toast({
title: "Signing in...",
description: "Please wait while we sign you in",
});

return { dismiss };
}

async function onSubmit({ email, username, password }: FormData) {
try {
if (mode === "login") {
signInToaster();
const { dismiss } = signInToaster();
await signIn("credentials", { username, email, password });
dismiss();
} else if (mode === "signup") {
toast({
title: "Creating account...",
Expand All @@ -93,8 +96,9 @@ export function AuthForm({ mode }: AuthFormProps) {
setOauthLoading("google");

try {
signInToaster();
const { dismiss } = signInToaster();
await signIn("google");
dismiss();
} catch (error) {
const err = error as Error;
console.error(err.message);
Expand All @@ -107,8 +111,9 @@ export function AuthForm({ mode }: AuthFormProps) {
setOauthLoading("github");

try {
signInToaster();
const { dismiss } = signInToaster();
await signIn("github");
dismiss();
} catch (error) {
const err = error as Error;
console.error(err.message);
Expand Down Expand Up @@ -281,20 +286,12 @@ export function AuthForm({ mode }: AuthFormProps) {
>
{form.formState.isSubmitting ? (
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
) : mode === "reset" ? (
<Key className="mr-2 h-4 w-4" />
) : isEmailMode ? (
<Mail className="mr-2 h-4 w-4" />
) : (
<>
{mode === "reset" ? (
<Key className="mr-2 h-4 w-4" />
) : (
<>
{isEmailMode ? (
<Mail className="mr-2 h-4 w-4" />
) : (
<Fingerprint className="mr-2 h-4 w-4" />
)}
</>
)}
</>
<Fingerprint className="mr-2 h-4 w-4" />
)}
{mode === "reset" && "Reset Password"}
{mode === "login" && (isEmailMode ? "Login with Email" : "Login")}
Expand Down
4 changes: 2 additions & 2 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ export default function AuthLayout({ children }: React.PropsWithChildren) {
By clicking continue, you agree to our{" "}
<Link
href="/terms"
className="underline-offset-4 hover:text-foreground hover:underline focus-visible:underline focus-visible:outline-none"
className="underline underline-offset-4 outline-none hover:text-foreground hover:underline"
>
Terms of Service
</Link>{" "}
and{" "}
<Link
href="/privacy"
className="underline-offset-4 hover:text-foreground hover:underline focus-visible:underline focus-visible:outline-none"
className="underline underline-offset-4 outline-none hover:text-foreground hover:underline"
>
Privacy Policy
</Link>
Expand Down
18 changes: 18 additions & 0 deletions app/(lobby)/(legal)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";

export default function LegalLayout({ children }: React.PropsWithChildren) {
return (
<main className="py-4">
{children}

<p className="text-center text-sm text-muted-foreground">
This is a mock page and does not reflect the{" "}
<span className="font-medium text-foreground">
Terms and Conditions
</span>{" "}
and <span className="font-medium text-foreground">Privacy Policy</span>{" "}
of our website.
</p>
</main>
);
}
41 changes: 41 additions & 0 deletions app/(lobby)/(legal)/privacy/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { LEGAL } from "@/lib/constants";
import { Separator } from "@/components/ui/separator";

export const metadata = {
title: "Privacy Policy",
};

export default function PrivacyPage() {
return (
<>
<section className="my-10 rounded-3xl bg-muted p-6 md:p-10 lg:p-16 xl:p-20">
<h1 className="text-center font-heading text-3xl drop-shadow-xl dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-3xl md:text-7xl">
Privacy Policy
</h1>
</section>
<section className="my-4 px-6 md:px-10 lg:px-16">
{LEGAL.privacyPolicy.sections.map((section, i) => (
<div key={i} className="mb-8 mt-4">
<h2
id={`${section.title.toLowerCase().replace(/\s/g, "-")}`}
className="font-heading text-lg dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-xl md:text-2xl"
>
{i + 1}. {section.title}
</h2>
<Separator className="my-2" />
<p className="my-2 max-w-5xl text-sm text-muted-foreground md:text-base">
{section.description}
</p>
</div>
))}

<p className="my-2 text-center text-sm font-semibold md:text-end">
Last updated:{" "}
<span className="font-medium underline underline-offset-4">
{LEGAL.privacyPolicy.lastUpdated}
</span>
</p>
</section>
</>
);
}
42 changes: 42 additions & 0 deletions app/(lobby)/(legal)/terms/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { LEGAL } from "@/lib/constants";
import { Separator } from "@/components/ui/separator";

export const metadata = {
title: "Terms of Service",
};

export default function TermsPage() {
return (
<>
<section className="my-10 rounded-3xl bg-muted p-6 md:p-10 lg:p-16 xl:p-20">
<h1 className="text-center font-heading text-3xl drop-shadow-xl dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-3xl md:text-7xl">
Terms of Service
</h1>
</section>

<section className="my-4 px-6 md:px-10 lg:px-16">
{LEGAL.termsOfService.sections.map((section, i) => (
<div key={i} className="mb-8 mt-4">
<h2
id={`${section.title.toLowerCase().replace(/\s/g, "-")}`}
className="font-heading text-lg dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-xl md:text-2xl"
>
{i + 1}. {section.title}
</h2>
<Separator className="my-2" />
<p className="my-2 max-w-5xl text-sm text-muted-foreground md:text-base">
{section.description}
</p>
</div>
))}

<p className="my-2 text-center text-sm font-semibold md:text-end">
Last updated:{" "}
<span className="font-medium underline underline-offset-4">
{LEGAL.termsOfService.lastUpdated}
</span>
</p>
</section>
</>
);
}
8 changes: 4 additions & 4 deletions app/(lobby)/pricing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export const metadata = {

export default function PricingPage() {
return (
<section className="container flex flex-col gap-6 py-8 md:max-w-[64rem] md:gap-10 md:py-12 lg:py-24">
<div className="mx-auto flex flex-col gap-4 md:max-w-[58rem]">
<h2 className="font-heading text-3xl drop-shadow-xl dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-3xl md:text-6xl">
<section className="container flex flex-col gap-6 py-8 md:gap-10">
<div className="flex flex-col gap-4 rounded-3xl bg-muted p-6 md:p-10 lg:p-16 xl:p-20">
<h1 className="text-center font-heading text-3xl drop-shadow-xl dark:bg-gradient-to-br dark:from-foreground dark:to-gray-500 dark:bg-clip-text dark:text-transparent sm:text-3xl md:text-7xl">
Simple, transparent pricing
</h2>
</h1>
<p className="text-center leading-normal text-muted-foreground sm:text-lg sm:leading-7">
Unlock all features including unlimited posts for your blog.
</p>
Expand Down
3 changes: 0 additions & 3 deletions app/(lobby)/privacy/page.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/(lobby)/terms/page.tsx

This file was deleted.

23 changes: 3 additions & 20 deletions app/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
export default function Loading() {
return (
<div className="grid animate-pulse place-items-center pt-4 text-zinc-300">
<div role="status">
<svg
aria-hidden="true"
className="mr-2 h-8 w-8 animate-spin fill-zinc-600 text-gray-200 dark:text-gray-600"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/>
</svg>
<span className="sr-only">Loading...</span>
</div>
<div className="grid h-screen w-full place-items-center">
<span className="sr-only">Loading...</span>
<div className="aspect-square h-16 animate-spin rounded-full border-y-2 border-primary lg:h-32" />
</div>
);
}
30 changes: 23 additions & 7 deletions components/sidebar/dashboard-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
"use client";

import Link from "next/link";
import { LayoutGrid, LogOut, Plus, Settings, Trash2 } from "lucide-react";
import { signOut } from "next-auth/react";

import { siteConfig } from "@/config/site";
import { cn } from "@/lib/utils";
import { toast } from "@/hooks/use-toast";
import { Logo } from "../icons";
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
import { Button, buttonVariants } from "../ui/button";
import { Dialog, DialogContent, DialogTrigger } from "../ui/dialog";
import { ScrollArea, ScrollBar } from "../ui/scroll-area";
import { FolderAccordion } from "./folder-accordion";

type DashboardSidebarProps = React.ComponentProps<"aside">;
type SidebarProps = React.ComponentProps<"aside">;

export function DashboardSidebar({ className, ...props }: SidebarProps) {
async function signOutHandler() {
const { dismiss } = toast({
title: "Signing out...",
description: "Please wait while we sign you out.",
});

await signOut();
dismiss();
}

export function DashboardSidebar({
className,
...props
}: DashboardSidebarProps) {
return (
<aside
className={cn(
Expand Down Expand Up @@ -99,8 +110,13 @@ export function DashboardSidebar({
{siteConfig.author.name}
</p>

<Button size="icon" variant="ghost" className="ml-auto">
<LogOut className="h-5 w-5" />
<Button
size="icon"
variant="ghost"
onClick={signOutHandler}
className="ml-auto"
>
<LogOut className="h-4 w-4" />
</Button>
</div>
</div>
Expand Down
84 changes: 84 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { siteConfig } from "@/config/site";

export const CLIENTS = [
{ alt: "client1", logo: "/placeholders/client-1.png" },
{ alt: "client2", logo: "/placeholders/client-2.png" },
Expand Down Expand Up @@ -141,3 +143,85 @@ export const ACCEPTED_IMAGE_TYPES = [
"image/png",
"image/webp",
];

export const LEGAL = {
termsOfService: {
lastUpdated: "December 15, 2023",
sections: [
{
title: "Acceptance of Terms",
description: `By using ${siteConfig.name}, you acknowledge that you have read, understood, and agree to be bound by these Terms of Service. If you are using ${siteConfig.name} on behalf of an organization, you represent and warrant that you have the authority to bind that organization to these terms.`,
},
{
title: "License",
description: `${siteConfig.name} is an open-source project distributed under the MIT License. You are free to use, modify, and distribute ${siteConfig.name}'s source code in accordance with the terms specified in the MIT License. A copy of the MIT License is included in the ${siteConfig.name} repository.`,
},
{
title: "Code of Conduct",
description: `When using ${siteConfig.name}, you agree to abide by our Code of Conduct, available in the project repository. The Code of Conduct outlines the expected behavior within the ${siteConfig.name} community and helps create a positive and inclusive environment for all contributors.`,
},
{
title: "No Warranty",
description: `${siteConfig.name} is provided "as is" without warranty of any kind, express or implied. The developers of ${siteConfig.name} make no guarantees regarding its functionality, security, or fitness for a particular purpose. You use ${siteConfig.name} at your own risk.`,
},
{
title: "Limitation of Liability",
description: `In no event shall the developers of ${siteConfig.name} be liable for any direct, indirect, incidental, special, or consequential damages arising out of or in any way connected with the use of ${siteConfig.name}.`,
},
{
title: "Contributions",
description: `Contributions to ${siteConfig.name} are welcome, and by submitting a pull request or contributing in any other way, you agree to license your contribution under the terms of the MIT License.`,
},
{
title: "Termination",
description: `The developers of ${siteConfig.name} reserve the right to terminate or suspend access to ${siteConfig.name} at any time, with or without cause and with or without notice.`,
},
{
title: "Changes to Terms",
description: `These Terms of Service may be updated from time to time. It is your responsibility to review these terms periodically. Your continued use of ${siteConfig.name} after changes to these terms signifies your acceptance of the updated terms.`,
},
{
title: "Contact Information",
description: `If you have any questions or concerns about these Terms of Service, please contact us at ${siteConfig.author.email}.`,
},
],
},

privacyPolicy: {
lastUpdated: "December 15, 2023",
sections: [
{
title: "Introduction",
description: `Thank you for choosing ${siteConfig.name}, an open-source web application developed under the MIT License. This Privacy Policy outlines how we collect, use, disclose, and protect your information when you use ${siteConfig.name}. By using ${siteConfig.name}, you consent to the practices described in this Privacy Policy.`,
},
{
title: "Information We Collect",
description: `- **Personal Information:** We do not collect any personal information from ${siteConfig.name} users. ${siteConfig.name} is designed to respect your privacy, and any data you enter or generate while using the application remains on your local device.`,
},
{
title: "How We Use Your Information",
description: `- **Usage Data:** ${siteConfig.name} does not collect any usage data. All data generated or processed within the application stays locally on your device.`,
},
{
title: "Cookies and Tracking Technologies",
description: `- **Cookies:** ${siteConfig.name} does not use cookies or any tracking technologies.`,
},
{
title: "Data Security",
description: `- **Data Storage:** As an open-source project, ${siteConfig.name} does not store any user data on external servers. All data remains on the user's local device.`,
},
{
title: "Third-Party Links",
description: `- **External Links:** ${siteConfig.name} may contain links to external websites or resources. This Privacy Policy applies only to ${siteConfig.name} and does not cover the privacy practices of third-party websites.`,
},
{
title: "Changes to Privacy Policy",
description: `- **Updates:** This Privacy Policy may be updated from time to time. It is your responsibility to review this policy periodically. Your continued use of ${siteConfig.name} after changes to this policy signifies your acceptance of the updated terms.`,
},
{
title: "Contact Information",
description: `If you have any questions or concerns about this Privacy Policy, please contact us at ${siteConfig.author.email}.`,
},
],
},
};
Loading

0 comments on commit 6158170

Please sign in to comment.