|
|
@ -11,19 +11,89 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
<script lang="ts"> |
|
|
|
import ng from "../api"; |
|
|
|
import ng from "../api"; |
|
|
|
import { onMount } from "svelte"; |
|
|
|
import { onMount, tick } from "svelte"; |
|
|
|
|
|
|
|
import { current_lang, available_languages } from "../store"; |
|
|
|
|
|
|
|
import { Language } from "svelte-heros-v2"; |
|
|
|
|
|
|
|
|
|
|
|
let locales = []; |
|
|
|
export let displayFooter = false; |
|
|
|
onMount(async () => { |
|
|
|
|
|
|
|
locales = await ng.locales(); |
|
|
|
let changingLang = false; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const changeLang = () => { |
|
|
|
|
|
|
|
changingLang = true; |
|
|
|
|
|
|
|
scrollToTop(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let top; |
|
|
|
|
|
|
|
function scrollToTop() { |
|
|
|
|
|
|
|
top.scrollIntoView(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selectLang = async (lang) => { |
|
|
|
|
|
|
|
current_lang.set(lang); |
|
|
|
|
|
|
|
changingLang = false; |
|
|
|
|
|
|
|
await tick(); |
|
|
|
|
|
|
|
scrollToTop(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let tauri_platform = import.meta.env.TAURI_PLATFORM; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const displayPopup = async (url, title) => { |
|
|
|
|
|
|
|
if (!tauri_platform || tauri_platform == "android") { |
|
|
|
|
|
|
|
window.open(url, "_blank").focus(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await ng.open_window(url, "viewer", title); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const displayNextgraphOrg = async () => { |
|
|
|
|
|
|
|
await displayPopup("https://nextgraph.org", "NextGraph.org"); |
|
|
|
|
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<div class="centered"> |
|
|
|
<div bind:this={top}> |
|
|
|
{#each locales as loc} |
|
|
|
{#if !changingLang} |
|
|
|
{loc} |
|
|
|
<div class="centered"> |
|
|
|
{/each} |
|
|
|
|
|
|
|
<slot /> |
|
|
|
<slot /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{#if displayFooter} |
|
|
|
|
|
|
|
<div class="centered"> |
|
|
|
|
|
|
|
<div class="mb-20 mt-10"> |
|
|
|
|
|
|
|
<button |
|
|
|
|
|
|
|
on:click={changeLang} |
|
|
|
|
|
|
|
class="text-primary-700 bg-[#f6f6f6] bg-none ring-0 hover:bg-primary-100/90 focus:ring-4 focus:ring-primary-100/50 font-medium rounded-lg text-lg px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-primary-100/55" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<Language |
|
|
|
|
|
|
|
tabindex="-1" |
|
|
|
|
|
|
|
class="w-7 h-7 mr-2 transition duration-75 " |
|
|
|
|
|
|
|
/>Change language <!--note to translator: DO NOT TRANSLATE! it should stay in english always--> |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
<button |
|
|
|
|
|
|
|
on:click={displayNextgraphOrg} |
|
|
|
|
|
|
|
class="text-primary-700 bg-[#f6f6f6] bg-none ring-0 hover:bg-primary-100/90 focus:ring-4 focus:ring-primary-100/50 font-medium rounded-lg px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-primary-100/55 mb-2" |
|
|
|
|
|
|
|
>About NextGraph |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{/if} |
|
|
|
|
|
|
|
{:else} |
|
|
|
|
|
|
|
<div class="centered"> |
|
|
|
|
|
|
|
<ul class="mb-20 mt-10"> |
|
|
|
|
|
|
|
{#each Object.entries(available_languages) as lang} |
|
|
|
|
|
|
|
<li |
|
|
|
|
|
|
|
tabindex="0" |
|
|
|
|
|
|
|
role="menuitem" |
|
|
|
|
|
|
|
class="flex items-center p-2 text-lg mb-2 font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700" |
|
|
|
|
|
|
|
on:keypress={() => selectLang(lang[0])} |
|
|
|
|
|
|
|
on:click={() => selectLang(lang[0])} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span class="mx-3">{lang[1]}</span> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
{/each} |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{/if} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
<style> |
|
|
@ -34,4 +104,7 @@ |
|
|
|
text-align: center; |
|
|
|
text-align: center; |
|
|
|
width: fit-content; |
|
|
|
width: fit-content; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
li.clickable { |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|