Skip to content

Commit

Permalink
feat: Add policy pages (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
evadecker authored Dec 12, 2024
1 parent 27a4ed5 commit eb6b8cd
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 19 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"astro-font": "^0.1.81",
"dayjs": "^1.11.13",
"fathom-client": "^3.7.2",
"marked": "^15.0.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.4.0",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const linkGroups: LinkGroup[] = [
{ href: "/status", label: "System Status" },
],
},
{
title: "Legal",
links: [
{ href: "/terms", label: "Terms of Service" },
{ href: "/privacy", label: "Privacy Policy" },
{ href: "/abuse", label: "Restricted Use" },
],
},
];
---

Expand Down Expand Up @@ -65,9 +73,7 @@ const linkGroups: LinkGroup[] = [
<div class="copyright">
<span>{siteInfo.fullName} &copy; {year}</span>
<span class="disclaimer"
><RiHeart3Line /> T4T. <a href="https://notlegaladvice.law/"
>We’re not lawyers.</a
></span
><RiHeart3Line /> T4T. <a href="/terms">We’re not lawyers.</a></span
>
</div>
<div class="social">
Expand Down
11 changes: 7 additions & 4 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ export const collections = {
role: z.string(),
bio: z.string(),
avatar: image(),
socialLinks: z.object({
name: z.string(),
url: z.string().url()
}).array().optional(),
socialLinks: z
.object({
name: z.string(),
url: z.string().url(),
})
.array()
.optional(),
}),
}),

Expand Down
6 changes: 0 additions & 6 deletions src/content/pages/privacy.md

This file was deleted.

6 changes: 0 additions & 6 deletions src/content/pages/terms.md

This file was deleted.

12 changes: 12 additions & 0 deletions src/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { marked } from "marked";

export const smartquotes = (str: string) => {
return str
.replace(/(^|[-\u2014\s(\["])'/g, "$1\u2018") // opening singles
Expand All @@ -7,3 +9,13 @@ export const smartquotes = (str: string) => {
.replace(/--/g, "\u2014") // em-dashes
.replace(/\.\.\./g, "\u2026"); // ellipses
};

export const fetchPolicy = async (slug: string) => {
const response = await fetch(
`https://raw.githubusercontent.com/namesakefyi/policies/main/${slug}.md`,
);
const markdown = await response.text();
const markdownWithoutH1 = markdown.replace(/^# .*\n/gm, "");
const content = marked.parse(markdownWithoutH1);
return content;
};
11 changes: 11 additions & 0 deletions src/layouts/ProseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const { title, date, description, ogImage, ogAlt, annotation, color } =
text-wrap: balance;
}

*:first-child {
margin-block-start: 0;
}

p,
ul,
ol,
Expand All @@ -74,6 +78,13 @@ const { title, date, description, ogImage, ogAlt, annotation, color } =
}
}

ul ul,
ol ul,
ul ol,
ol ol {
margin-block: 0;
}

img:not(.no-filter) {
filter: grayscale(100%) contrast(120%) brightness(130%);
opacity: 0.9;
Expand Down
14 changes: 14 additions & 0 deletions src/pages/abuse.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("abuse");
---

<ProseLayout
title="Use Restrictions Policy"
description="It is not okay to use Namesake for these restricted purposes."
color="brown"
>
<article set:html={content} />
</ProseLayout>
14 changes: 14 additions & 0 deletions src/pages/privacy.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("privacy");
---

<ProseLayout
title="Privacy"
description="The privacy of your data—and it is your data, not ours!—is a big deal to us. Here’s the rundown of what we collect and why, when we access your information, and your rights."
color="brown"
>
<article set:html={content} />
</ProseLayout>
14 changes: 14 additions & 0 deletions src/pages/subprocessors.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("subprocessors");
---

<ProseLayout
title="Subprocessors"
description="All the third-party subprocessors that we use to run Namesake."
color="brown"
>
<article set:html={content} />
</ProseLayout>
14 changes: 14 additions & 0 deletions src/pages/terms.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("terms");
---

<ProseLayout
title="Terms of Service"
description="All the terms that you agree to when you sign up for Namesake."
color="brown"
>
<article set:html={content} />
</ProseLayout>

0 comments on commit eb6b8cd

Please sign in to comment.