aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-08 05:56:17 -0800
committerFuwn <[email protected]>2022-03-08 05:56:17 -0800
commit89b902d193de0320ea962cf83683b29470763cde (patch)
tree194ecdc7f671521536a021ae63f0d717159e2d53 /src/routes
downloadfrontend-next-89b902d193de0320ea962cf83683b29470763cde.tar.xz
frontend-next-89b902d193de0320ea962cf83683b29470763cde.zip
feat(frontend-next): 0.1.0 :star:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/__layout.svelte34
-rw-r--r--src/routes/index.svelte59
-rw-r--r--src/routes/language.svelte58
-rw-r--r--src/routes/languages.svelte54
4 files changed, 205 insertions, 0 deletions
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte
new file mode 100644
index 0000000..8d3337a
--- /dev/null
+++ b/src/routes/__layout.svelte
@@ -0,0 +1,34 @@
+<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>.
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+SPDX-License-Identifier: GPL-3.0-only -->
+<script lang="ts">
+ import Header from "$lib/header/Header.svelte";
+ import "../app.css";
+</script>
+
+<Header />
+
+<main>
+ <slot />
+</main>
+
+<footer>
+ <p>
+ String copyright = "2022-{new Date().getFullYear()}
+ <a href="https://github.com/Fuwn">Fuwn</a>";
+ </p>
+</footer>
diff --git a/src/routes/index.svelte b/src/routes/index.svelte
new file mode 100644
index 0000000..efa4d00
--- /dev/null
+++ b/src/routes/index.svelte
@@ -0,0 +1,59 @@
+<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>.
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+SPDX-License-Identifier: GPL-3.0-only -->
+<script>
+ import { onMount } from "svelte";
+ import { fetchRandomImage } from "$lib/api";
+
+ let image;
+ let complete = false;
+
+ onMount(async () => {
+ image = (await fetchRandomImage()).image;
+ complete = true;
+ });
+</script>
+
+<svelte:head>
+ <title>home | senpy-club</title>
+</svelte:head>
+
+<section>
+ <h1>Home</h1>
+
+ {#if !complete}
+ <p>Fetching a random image...</p>
+ {:else}
+ <div id="random-image">
+ <a href={image}>
+ <img
+ src={image}
+ alt="Image of an anime girl holding a programming book"
+ />
+ </a>
+ </div>
+ {/if}
+
+ <h2>Contributing</h2>
+ <p>
+ If you'd like to support the project in any way, check out the repositories:
+ </p>
+ <ul>
+ <li><a href="https://github.com/senpy-club/api-worker">API</a></li>
+ <li><a href="https://github.com/senpy-club/frontend-next">Frontend</a></li>
+ </ul>
+</section>
diff --git a/src/routes/language.svelte b/src/routes/language.svelte
new file mode 100644
index 0000000..dacbf72
--- /dev/null
+++ b/src/routes/language.svelte
@@ -0,0 +1,58 @@
+<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>.
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+SPDX-License-Identifier: GPL-3.0-only -->
+<script>
+ import { onMount } from "svelte";
+ import { fetchImages } from "$lib/api";
+ import { page } from "$app/stores";
+
+ let language = $page.url.searchParams.get("language");
+ let images;
+ let complete = false;
+
+ onMount(async () => {
+ images = await fetchImages(language);
+ complete = true;
+ });
+</script>
+
+<svelte:head>
+ <title>{language} | senpy-club</title>
+</svelte:head>
+
+<div class="content">
+ <h1>{language}</h1>
+
+ {#if !complete}
+ <p>Fetching images...</p>
+ {:else if images.length === 0}
+ <p>Sorry, no images were found for this language.</p>
+ {:else}
+ <ul class="image-rack">
+ {#each images as image}
+ <li id="image-rack-item">
+ <a href={image}>
+ <img
+ src={image}
+ alt="Image of an anime girl holding a programming book"
+ />
+ </a>
+ </li>
+ {/each}
+ </ul>
+ {/if}
+</div>
diff --git a/src/routes/languages.svelte b/src/routes/languages.svelte
new file mode 100644
index 0000000..9f14e18
--- /dev/null
+++ b/src/routes/languages.svelte
@@ -0,0 +1,54 @@
+<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>.
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+SPDX-License-Identifier: GPL-3.0-only -->
+<script>
+ import { onMount } from "svelte";
+ import { fetchLanguages } from "$lib/api";
+ let languages;
+ let complete = false;
+
+ onMount(async () => {
+ languages = await fetchLanguages();
+ complete = true;
+ });
+</script>
+
+<svelte:head>
+ <title>languages | senpy-club</title>
+</svelte:head>
+
+<div class="content">
+ <h1>Languages</h1>
+
+ {#if !complete}
+ <p>Fetching languages...</p>
+ {:else}
+ <ul>
+ {#each languages as language}
+ <li>
+ {#if language === "C#"}
+ <a href={"/language?language=C%23"}>C#</a>
+ {:else}
+ <a href={"/language?language=" + language}>
+ {language}
+ </a>
+ {/if}
+ </li>
+ {/each}
+ </ul>
+ {/if}
+</div>