Skip to content

Commit

Permalink
Merge pull request #953 from rainlanguage/2024-10-21-license
Browse files Browse the repository at this point in the history
Adding license link to sidebar
  • Loading branch information
thedavidmeister authored Oct 23, 2024
2 parents 953150f + 765fb4a commit ef772ec
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tauri-app/package-lock.json

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

1 change: 1 addition & 0 deletions tauri-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"lodash": "^4.17.21",
"npm": "^10.6.0",
"svelte-codemirror-editor": "^1.3.0",
"svelte-markdown": "^0.4.1",
"thememirror": "^2.0.1",
"uuid": "^9.0.1",
"viem": "^2.4.0"
Expand Down
7 changes: 7 additions & 0 deletions tauri-app/src/lib/components/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import WalletSolid from 'flowbite-svelte-icons/WalletSolid.svelte';
import ReceiptSolid from 'flowbite-svelte-icons/ReceiptSolid.svelte';
import GearSolid from 'flowbite-svelte-icons/GearSolid.svelte';
import FileLinesSolid from 'flowbite-svelte-icons/FileLinesSolid.svelte';
import IconExternalLink from '$lib/components/IconExternalLink.svelte';
import { page } from '$app/stores';
import ButtonDarkMode from '$lib/components/ButtonDarkMode.svelte';
Expand Down Expand Up @@ -98,6 +99,12 @@
<span data-testid="sidebar-telegram"></span>
</svelte:fragment>
</SidebarItem>
<SidebarItem label="License" href="/license">
<svelte:fragment slot="icon">
<FileLinesSolid />
<span data-testid="sidebar-license"></span>
</svelte:fragment>
</SidebarItem>
</SidebarGroup>
<SidebarGroup border class="flex justify-start">
<ButtonDarkMode />
Expand Down
32 changes: 32 additions & 0 deletions tauri-app/src/routes/license/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script>
import Heading from './Heading.svelte';
import Markdown from 'svelte-markdown';
import { onMount } from 'svelte';
import Text from './Text.svelte';
import BlockQuote from './BlockQuote.svelte';
let source = '';
onMount(async () => {
try {
const response = await fetch(
'https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md',
);
if (response.ok) {
source = await response.text();
}
} catch {
source = '';
}
});
</script>

<Markdown
{source}
renderers={{
text: Text,
heading: Heading,
blockquote: BlockQuote,
}}
/>
1 change: 1 addition & 0 deletions tauri-app/src/routes/license/BlockQuote.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<blockquote class="p-2 py-1"><slot /></blockquote>
19 changes: 19 additions & 0 deletions tauri-app/src/routes/license/Heading.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script>
export let depth;
</script>

{#if depth === 1}
<div class="mb-4 text-4xl font-medium dark:text-white"><slot /></div>
{:else if depth === 2}
<div class="my-4 text-2xl font-medium dark:text-white"><slot /></div>
{:else if depth === 3}
<div class="my-4 text-xl font-medium dark:text-white"><slot /></div>
{:else if depth === 4}
<div class="my-4 text-lg font-medium dark:text-white"><slot /></div>
{:else if depth === 5}
<h5><slot /></h5>
{:else if depth === 6}
<h6><slot /></h6>
{:else}
<slot />
{/if}
8 changes: 8 additions & 0 deletions tauri-app/src/routes/license/Text.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
export let text;
text;
export let raw;
raw;
</script>

<div class="my-2 mb-3"><slot /></div>

0 comments on commit ef772ec

Please sign in to comment.