Files
gpx.studio/website/src/routes/[[language]]/help/[...guide]/+page.svelte
T

79 lines
2.7 KiB
Svelte
Raw Normal View History

2024-07-08 22:43:50 +02:00
<script lang="ts">
2026-10-31 14:37:25 +01:00
import { resolve } from '$app/paths';
2025-06-21 21:07:36 +02:00
import { page } from '$app/state';
2025-02-02 11:17:22 +01:00
import { getNextGuide, getPreviousGuide } from '$lib/components/docs/docs';
import DocsContainer from '$lib/components/docs/DocsContainer.svelte';
import { Button } from '$lib/components/ui/button';
import { getURLForLanguage } from '$lib/utils';
2025-06-21 21:07:36 +02:00
import { ChevronLeft, ChevronRight, PenLine, CornerDownRight } from '@lucide/svelte';
2026-10-11 11:18:36 +02:00
import { i18n } from '$lib/i18n/i18n.svelte';
2024-07-09 17:49:18 +02:00
2025-06-21 21:07:36 +02:00
let { data }: { data: { guideModule: any; guideTitles: Record<string, string> } } = $props();
2024-09-24 10:42:15 +02:00
2026-10-31 14:42:59 +01:00
let previousGuide = $derived(getPreviousGuide(page.params.guide ?? ''));
let nextGuide = $derived(getNextGuide(page.params.guide ?? ''));
2024-07-08 22:43:50 +02:00
</script>
2024-09-20 13:22:05 +02:00
<div class="markdown flex flex-col gap-3">
2025-02-02 11:17:22 +01:00
<DocsContainer module={data.guideModule.default} />
2024-09-20 13:22:05 +02:00
</div>
2024-07-09 17:49:18 +02:00
2024-07-09 22:15:05 +02:00
<div class="flex flex-row flex-wrap gap-3 pt-6">
2025-02-02 11:17:22 +01:00
{#if previousGuide}
<Button
variant="outline"
class="mr-auto"
2026-10-31 14:37:25 +01:00
href={resolve(getURLForLanguage(i18n.lang, `/help/${previousGuide}`))}
2025-02-02 11:17:22 +01:00
>
2025-06-21 21:07:36 +02:00
<ChevronLeft size="14" class="mt-0.5" />
2025-02-02 11:17:22 +01:00
{data.guideTitles[previousGuide]}
</Button>
{/if}
{#if nextGuide}
<Button
variant="outline"
class="ml-auto"
2026-10-31 14:37:25 +01:00
href={resolve(getURLForLanguage(i18n.lang, `/help/${nextGuide}`))}
2025-02-02 11:17:22 +01:00
>
{data.guideTitles[nextGuide]}
2025-06-21 21:07:36 +02:00
<ChevronRight size="14" class="mt-0.5" />
2025-02-02 11:17:22 +01:00
</Button>
{/if}
2024-07-09 17:49:18 +02:00
</div>
2024-09-13 13:56:28 +02:00
<div class="flex flex-row flex-wrap justify-between items-start mt-10 gap-3">
2025-02-02 11:17:22 +01:00
<div class="flex flex-col items-start">
2025-06-21 21:07:36 +02:00
<p class="text-sm text-muted-foreground">{i18n._('docs.answer_not_found')}</p>
2025-02-02 11:17:22 +01:00
<Button
variant="link"
href="https://www.reddit.com/r/gpxstudio/"
target="_blank"
class="p-0 h-6 text-link"
>
2025-06-21 21:07:36 +02:00
<CornerDownRight size="16" />
{i18n._('docs.ask_on_reddit')}
2025-02-02 11:17:22 +01:00
</Button>
</div>
2025-06-21 21:07:36 +02:00
{#if i18n.lang === 'en'}
2025-02-02 11:17:22 +01:00
<Button
variant="link"
2025-06-21 21:07:36 +02:00
href="https://github.com/gpxstudio/gpx.studio/edit/dev/website/src/lib/docs/en/{page
2025-02-02 11:17:22 +01:00
.params.guide}.mdx"
target="_blank"
2026-03-28 19:41:44 +01:00
class="p-0 has-[>svg]:px-0 h-6 ml-auto text-link"
2025-02-02 11:17:22 +01:00
>
2025-06-21 21:07:36 +02:00
<PenLine size="16" />
2025-02-02 11:17:22 +01:00
Edit this page on GitHub
</Button>
{:else}
<Button
variant="link"
2025-06-21 21:07:36 +02:00
href="https://crowdin.com/project/gpxstudio/{i18n.lang}"
2025-02-02 11:17:22 +01:00
target="_blank"
class="p-0 h-6 ml-auto text-link"
>
2025-06-21 21:07:36 +02:00
<PenLine size="16" />
{i18n._('docs.translate')}
2025-02-02 11:17:22 +01:00
</Button>
{/if}
2024-09-13 13:56:28 +02:00
</div>