From 0a4b9d538d2fd2c89d43f80ad430b71a408a876d Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Fri, 21 May 2021 15:00:33 +0200 Subject: [PATCH] list chapters --- .routify/routes.js | 56 ++++++++++++++++++++++++++++++-- assets/global.css | 10 ++++++ src/pages/[manga]/_layout.svelte | 18 ++++++++++ src/pages/[manga]/index.svelte | 34 +++++++++++++++++++ src/pages/index.svelte | 12 +++---- src/util/request.js | 2 +- 6 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 src/pages/[manga]/_layout.svelte create mode 100644 src/pages/[manga]/index.svelte diff --git a/.routify/routes.js b/.routify/routes.js index 65ebd3a..87ebbdf 100644 --- a/.routify/routes.js +++ b/.routify/routes.js @@ -1,11 +1,11 @@ /** * @roxi/routify 2.18.1 - * File generated Thu May 20 2021 16:57:51 GMT+0200 (GMT+02:00) + * File generated Thu May 20 2021 18:09:03 GMT+0200 (GMT+02:00) */ export const __version = "2.18.1" -export const __timestamp = "2021-05-20T14:57:51.330Z" +export const __timestamp = "2021-05-20T16:09:03.946Z" //buildRoutes import { buildClientTree } from "@roxi/routify/runtime/buildRoutes" @@ -51,6 +51,58 @@ export const _tree = { "id": "__fallback", "component": () => import('../src/pages/_fallback.svelte').then(m => m.default) }, + { + "isFile": true, + "isDir": true, + "file": "_layout.svelte", + "filepath": "/[manga]/_layout.svelte", + "name": "_layout", + "ext": "svelte", + "badExt": false, + "absolutePath": "/home/dan/Documents/node_projects/mangades/src/pages/[manga]/_layout.svelte", + "children": [ + { + "isFile": true, + "isDir": false, + "file": "index.svelte", + "filepath": "/[manga]/index.svelte", + "name": "index", + "ext": "svelte", + "badExt": false, + "absolutePath": "/home/dan/Documents/node_projects/mangades/src/pages/[manga]/index.svelte", + "importPath": "../src/pages/[manga]/index.svelte", + "isLayout": false, + "isReset": false, + "isIndex": true, + "isFallback": false, + "isPage": true, + "ownMeta": {}, + "meta": { + "recursive": true, + "preload": "proximity", + "prerender": true + }, + "path": "/:manga/index", + "id": "__manga_index", + "component": () => import('../src/pages/[manga]/index.svelte').then(m => m.default) + } + ], + "isLayout": true, + "isReset": false, + "isIndex": false, + "isFallback": false, + "isPage": false, + "importPath": "../src/pages/[manga]/_layout.svelte", + "ownMeta": {}, + "meta": { + "recursive": true, + "preload": "proximity", + "prerender": true + }, + "path": "/:manga", + "id": "__manga__layout", + "component": () => import('../src/pages/[manga]/_layout.svelte').then(m => m.default) + }, { "isFile": true, "isDir": false, diff --git a/assets/global.css b/assets/global.css index ec905f5..ddacd19 100644 --- a/assets/global.css +++ b/assets/global.css @@ -12,6 +12,16 @@ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } +h1 { + text-align: center; +} + +main +{ + max-width: 450px; + margin: auto; +} + a { color: rgb(0,100,200); text-decoration: none; diff --git a/src/pages/[manga]/_layout.svelte b/src/pages/[manga]/_layout.svelte new file mode 100644 index 0000000..24029e7 --- /dev/null +++ b/src/pages/[manga]/_layout.svelte @@ -0,0 +1,18 @@ + + +{#await mangaData} + loading... +{:then manga} + +{/await} \ No newline at end of file diff --git a/src/pages/[manga]/index.svelte b/src/pages/[manga]/index.svelte new file mode 100644 index 0000000..f8e57d9 --- /dev/null +++ b/src/pages/[manga]/index.svelte @@ -0,0 +1,34 @@ + + +
+

{manga.title.en}

+ + {#await chapters} + Loading chapters... + {:then chapters} +
    + {#each chapters.results as chapter} +
  1. {chapter.data.attributes.title}
  2. + {/each} +
+ {/await} +
\ No newline at end of file diff --git a/src/pages/index.svelte b/src/pages/index.svelte index 599a589..bd33319 100644 --- a/src/pages/index.svelte +++ b/src/pages/index.svelte @@ -2,11 +2,12 @@ import { params } from '@roxi/routify' import request from "../util/request"; import ratelimit from "../util/ratelimit"; + import { url } from '@roxi/routify/runtime/helpers'; var name = $params.search; $: { const url = new URL(window.location.toString()); - url.searchParams.set("search", name); + url.searchParams.set("search", name || ""); history.replaceState(history.state, "", url.toString()); } /** @@ -41,7 +42,9 @@ @@ -49,11 +52,6 @@