From 6620bc00fdf5173ffb20a9057a4580b59410dbd7 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 8 Jan 2024 15:27:28 -0800 Subject: feat(tools): new tools url method --- src/routes/birthdays/+server.ts | 12 ++- src/routes/tools/+page.svelte | 150 ++++++-------------------------- src/routes/tools/[tool]/+page.server.ts | 5 ++ src/routes/tools/[tool]/+page.svelte | 63 ++++++++++++++ src/routes/wrapped/+server.ts | 10 ++- 5 files changed, 108 insertions(+), 132 deletions(-) create mode 100644 src/routes/tools/[tool]/+page.server.ts create mode 100644 src/routes/tools/[tool]/+page.svelte (limited to 'src/routes') diff --git a/src/routes/birthdays/+server.ts b/src/routes/birthdays/+server.ts index 2b9219b5..7f0fd833 100644 --- a/src/routes/birthdays/+server.ts +++ b/src/routes/birthdays/+server.ts @@ -1,7 +1,11 @@ +import root from '$lib/Utility/root.js'; + export const GET = ({ url }) => Response.redirect( - `https://due.moe/tools?tool=birthdays${ - url.searchParams.values.length > 0 ? `&${url.searchParams.toString()}` : '' - }`, - 301 + root( + `/tools/birthdays${ + url.searchParams.values.length > 0 ? `&${url.searchParams.toString()}` : '' + }` + ), + 307 ); diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index e5bda954..6293d0b1 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -1,133 +1,35 @@ -
- -
- -{#if !Object.keys(tools).includes(tool)} - - -{:else} - + - {#if tool === 'default'} -
-

Select a tool to continue.

+
+

Select a tool to continue.

-
    - {#each Object.keys(tools) as t} - {#if t !== 'default'} -
  • - (tool = t)}>{tools[t].name} - {#if tools[t].description} -
    {tools[t].description}
    - {/if} -
  • +
      + {#each Object.keys(tools) as t} + {#if t !== 'default'} +
    • + (tool = t)}>{tools[t].name} + {#if tools[t].description} +
      {tools[t].description}
      {/if} - {/each} -
    - -

    - - Have any requests for cool tools that you think others might find useful? Send a message to - @fuwn on AniList! -

- {:else if tool === 'activity_history'} - - {:else if tool === 'wrapped'} - - {:else if tool === 'discussions'} - - {:else if tool === 'birthdays'} - - {:else if tool === 'sequel_spy'} - - {:else if tool === 'random_follower'} - - {:else if tool === 'dump_profile'} - - {/if} -{/if} + + {/if} + {/each} + + +

+ +

+ Have any requests for cool tools that you think others might find useful? Send a message to + @fuwn on AniList! +
+
diff --git a/src/routes/tools/[tool]/+page.server.ts b/src/routes/tools/[tool]/+page.server.ts new file mode 100644 index 00000000..c7e72d18 --- /dev/null +++ b/src/routes/tools/[tool]/+page.server.ts @@ -0,0 +1,5 @@ +export const load = ({ params }) => { + return { + tool: params.tool + }; +}; diff --git a/src/routes/tools/[tool]/+page.svelte b/src/routes/tools/[tool]/+page.svelte new file mode 100644 index 00000000..bd236d11 --- /dev/null +++ b/src/routes/tools/[tool]/+page.svelte @@ -0,0 +1,63 @@ + + + + +{#if !Object.keys(tools).includes(tool)} + + + +{:else} + + + {#if tool === 'activity_history'} + + {:else if tool === 'wrapped'} + + {:else if tool === 'discussions'} + + {:else if tool === 'birthdays'} + + {:else if tool === 'sequel_spy'} + + {:else if tool === 'random_follower'} + + {:else if tool === 'dump_profile'} + + {/if} +{/if} diff --git a/src/routes/wrapped/+server.ts b/src/routes/wrapped/+server.ts index 2eee34f0..cc070af0 100644 --- a/src/routes/wrapped/+server.ts +++ b/src/routes/wrapped/+server.ts @@ -1,7 +1,9 @@ +import root from '$lib/Utility/root.js'; + export const GET = ({ url }) => Response.redirect( - `https://due.moe/tools?tool=wrapped${ - url.searchParams.values.length > 0 ? `&${url.searchParams.toString()}` : '' - }`, - 301 + root( + `/tools/wrapped${url.searchParams.values.length > 0 ? `&${url.searchParams.toString()}` : ''}` + ), + 307 ); -- cgit v1.2.3