···11<script lang="ts">
22- import { replaceState } from "$app/navigation";
33- import { page } from "$app/state";
44- import type { PuzzleView } from "$lib/lexicon/types/org/lichess/puzzle/defs";
55- import CasualPuzzle from "$lib/components/CasualPuzzle.svelte";
22+ import { replaceState } from '$app/navigation';
33+ import { resolve } from '$app/paths';
44+ import { page } from '$app/state';
55+ import type { PuzzleView } from '$lib/lexicon/types/org/lichess/puzzle/defs';
66+ import CasualPuzzle from '$lib/components/CasualPuzzle.svelte';
6777- let current = $state<PuzzleView | null>(null);
88+ let current = $state<PuzzleView | null>(null);
8999- // Reflect the loaded puzzle in the address bar (shallow routing — no
1010- // navigation, no remount) so users can copy/share a /puzzle/<id> link.
1111- // Guard against rewriting to the URL we're already on: that avoids calling
1212- // replaceState before the client router is initialized on the first paint.
1313- function reflect(puzzle: PuzzleView) {
1414- current = puzzle;
1515- const path = `/puzzle/${puzzle.id}`;
1616- if (page.url.pathname !== path) replaceState(path, {});
1717- }
1010+ // Reflect the loaded puzzle in the address bar (shallow routing — no
1111+ // navigation, no remount) so users can copy/share a /puzzle/<id> link.
1212+ // Guard against rewriting to the URL we're already on: that avoids calling
1313+ // replaceState before the client router is initialized on the first paint.
1414+ function reflect(puzzle: PuzzleView) {
1515+ current = puzzle;
1616+ const path = `/puzzle/${puzzle.id}`;
1717+ if (page.url.pathname !== path) replaceState(resolve('/puzzle/[id]', { id: puzzle.id }), {});
1818+ }
1819</script>
19202021<svelte:head>
2121- {#if current}
2222- <title>Puzzle {current.id} — PuzzleMeThis</title>
2323- {:else}
2424- <title>PuzzleMeThis — casual practice</title>
2525- {/if}
2222+ {#if current}
2323+ <title>Puzzle {current.id} — PuzzleMeThis</title>
2424+ {:else}
2525+ <title>PuzzleMeThis — casual practice</title>
2626+ {/if}
2627</svelte:head>
27282829<CasualPuzzle onPuzzle={reflect} />
···11<script lang="ts">
22 import { PUBLIC_API_URL } from '$env/static/public';
33+ import { resolve } from '$app/paths';
3445 const repoUrl = 'https://tangled.org/pds.dad/puzzle-me-this';
56</script>
···2021 >lichess's Puzzle Database</a
2122 >. What does atproto mean? Well, you can interact with our
2223 <a class="link" href="https://atproto.com/specs/xrpc">XRPC</a>
2323- endpoint at <a class="link" href={PUBLIC_API_URL}>{PUBLIC_API_URL}</a>. You can make calls
2424- like
2525- <a class="link" href="{PUBLIC_API_URL}/xrpc/org.lichess.puzzle.getRandom"
2424+ endpoint at <a class="link" href={PUBLIC_API_URL} rel="external">{PUBLIC_API_URL}</a>. You can
2525+ make calls like
2626+ <a class="link" href="{PUBLIC_API_URL}/xrpc/org.lichess.puzzle.getRandom" rel="external"
2627 >{PUBLIC_API_URL}/xrpc/org.lichess.puzzle.getRandom</a
2728 >
2829 to get a random puzzle. Or login with the same account you use with other Atmosphere apps to save
2930 your attempts to your public
3031 <a class="link" href="https://atproto.com/specs/repository">atproto repo</a>, you can even
3132 submit them to our XRPC service to show up on the
3232- <a class="link" href="/leaderboard">leaderboard</a>. You can see all of the endpoints I
3333- support and types
3333+ <a class="link" href={resolve('/leaderboard')}>leaderboard</a>. You can see all of the
3434+ endpoints I support and types
3435 <a class="link" href="https://tangled.org/pds.dad/puzzle-me-this/tree/main/lexicons"
3536 >right here in our git repo</a
3637 >. They're <a class="link" href="https://atproto.com/specs/lexicon">lexicon schema files</a> meaning