-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dapp): Privacy Policy and Terms of Service (#573)
Signed-off-by: Urban Vidovič <[email protected]>
- Loading branch information
Showing
8 changed files
with
404 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@blockchain-lab-um/dapp': patch | ||
--- | ||
|
||
Adds terms of service and privacy policy pages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import DOMPurify from 'dompurify'; | ||
import { JSDOM } from 'jsdom'; | ||
import { marked } from 'marked'; | ||
|
||
const getPrivacyPolicy = async () => { | ||
const renderer = { | ||
heading(text: string, level: number) { | ||
switch (level) { | ||
case 1: | ||
return ` | ||
<h${level} class="text-2xl pt-2 font-bold items-center justify-center text-center"> | ||
${text} | ||
</h${level}>`; | ||
case 2: | ||
return ` | ||
<h${level} class="text-xl font-bold pt-8 pb-2"> | ||
${text} | ||
</h${level}>`; | ||
default: | ||
return `<h${level} class="text-lg"> ${text} </h${level}>`; | ||
} | ||
}, | ||
blockquote(text: string) { | ||
return `<div class="w-full flex items-center justify-center"><blockquote class="bg-pink-500 rounded-full text-center dark:bg-orange-accent-dark dark:text-navy-blue-900 w-auto inline-block text-white px-4 my-4">${text}</blockquote></div>`; | ||
}, | ||
paragraph(text: string) { | ||
return `<p class="text-justify">${text}</p>`; | ||
}, | ||
link(href: string, title: string | null | undefined, text: string) { | ||
return `<a class="text-pink-500 dark:text-orange-accent-dark" href="${href}" title="${title}">${text}</a>`; | ||
}, | ||
}; | ||
|
||
marked.use({ renderer }); | ||
const markdown = await ( | ||
await fetch( | ||
'https://raw.githubusercontent.com/lutralabs/documents/main/privacy-policy.md', | ||
{ cache: 'no-store' } | ||
) | ||
).text(); | ||
const { window } = new JSDOM(''); | ||
const purify = DOMPurify(window); | ||
const html = purify.sanitize(await marked.parse(markdown)); | ||
return html; | ||
}; | ||
|
||
export default async function Page() { | ||
const pp = await getPrivacyPolicy(); | ||
return ( | ||
<div | ||
className="h-full w-full max-w-4xl flex-1 flex-col p-6 sm:p-16" | ||
dangerouslySetInnerHTML={{ __html: pp }} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import DOMPurify from 'dompurify'; | ||
import { JSDOM } from 'jsdom'; | ||
import { marked } from 'marked'; | ||
|
||
const getTos = async () => { | ||
const renderer = { | ||
heading(text: string, level: number) { | ||
switch (level) { | ||
case 1: | ||
return ` | ||
<h${level} class="text-2xl font-bold text-center items-center justify-center pt-2"> | ||
${text} | ||
</h${level}>`; | ||
case 2: | ||
return ` | ||
<h${level} class="text-xl font-bold pt-8 pb-2"> | ||
${text} | ||
</h${level}>`; | ||
default: | ||
return `<h${level} class="text-lg"> ${text} </h${level}>`; | ||
} | ||
}, | ||
blockquote(text: string) { | ||
return `<div class="w-full flex items-center justify-center"><blockquote class="bg-pink-500 rounded-full text-center dark:bg-orange-accent-dark dark:text-navy-blue-900 w-auto inline-block text-white px-4 my-4">${text}</blockquote></div>`; | ||
}, | ||
paragraph(text: string) { | ||
return `<p class="text-justify">${text}</p>`; | ||
}, | ||
link(href: string, title: string | null | undefined, text: string) { | ||
return `<a class="text-pink-500 dark:text-orange-accent-dark" href="${href}" title="${title}">${text}</a>`; | ||
}, | ||
}; | ||
|
||
marked.use({ renderer }); | ||
const markdown = await ( | ||
await fetch( | ||
'https://raw.githubusercontent.com/lutralabs/documents/main/ToS.md', | ||
{ cache: 'no-store' } | ||
) | ||
).text(); | ||
const { window } = new JSDOM(''); | ||
const purify = DOMPurify(window); | ||
const html = purify.sanitize(await marked.parse(markdown)); | ||
|
||
return html; | ||
}; | ||
|
||
export default async function Page() { | ||
const tos = await getTos(); | ||
return ( | ||
<div | ||
className="h-full w-full max-w-4xl flex-1 flex-col p-6 sm:p-16" | ||
dangerouslySetInnerHTML={{ __html: tos }} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use client'; | ||
|
||
import { Dispatch, SetStateAction } from 'react'; | ||
import Link from 'next/link'; | ||
|
||
interface PublicFooterProps { | ||
setIsMenuOpen: Dispatch<SetStateAction<boolean>> | null | undefined; | ||
} | ||
|
||
export default function PublicFooter({ setIsMenuOpen }: PublicFooterProps) { | ||
return ( | ||
<footer className="flex h-full w-full flex-1 items-end justify-between text-xs md:text-sm"> | ||
<p>© 2024 Lutra Labs</p> | ||
<div className="flex space-x-6 max-sm:flex-col max-sm:space-x-0 max-sm:text-right"> | ||
<Link | ||
href="/privacy" | ||
onClick={() => { | ||
if (setIsMenuOpen) { | ||
setIsMenuOpen(false); | ||
} | ||
}} | ||
> | ||
Privacy Policy | ||
</Link> | ||
<Link | ||
href="/tos" | ||
onClick={() => { | ||
if (setIsMenuOpen) { | ||
setIsMenuOpen(false); | ||
} | ||
}} | ||
> | ||
Terms of Service | ||
</Link> | ||
</div> | ||
</footer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.