From fd19f8a8c599d5f0ddc50704b01d926255a5b1ca Mon Sep 17 00:00:00 2001 From: Ayush Sehrawat <69469790+AyushSehrawat@users.noreply.github.com> Date: Sat, 16 Dec 2023 17:51:11 +0530 Subject: [PATCH] feat: frontend fixes and improvements (#29) * deps: downgrade to fix https://github.com/sveltejs/kit/issues/11317 * fix: fixed the api problems on frontend * feat: improvements to +page.server.ts and moved backend api host to localhost --- frontend/package.json | 2 +- frontend/pnpm-lock.yaml | 20 ++-- .../item.svelte => header-item.svelte} | 0 frontend/src/lib/components/header.svelte | 35 +++++- .../lib/components/status-media-card.svelte | 30 ++++-- frontend/src/lib/helpers.ts | 2 +- frontend/src/lib/types.ts | 2 +- frontend/src/routes/+error.svelte | 9 ++ frontend/src/routes/+page.server.ts | 22 ++++ frontend/src/routes/+page.svelte | 11 +- frontend/src/routes/+page.ts | 16 --- frontend/src/routes/settings/+page.svelte | 10 ++ frontend/src/routes/status/+page.server.ts | 37 +++++++ frontend/src/routes/status/+page.svelte | 100 +++++++++--------- frontend/src/routes/status/+page.ts | 26 ----- 15 files changed, 201 insertions(+), 121 deletions(-) rename frontend/src/lib/components/{header/item.svelte => header-item.svelte} (100%) create mode 100644 frontend/src/routes/+error.svelte create mode 100644 frontend/src/routes/+page.server.ts delete mode 100644 frontend/src/routes/+page.ts create mode 100644 frontend/src/routes/settings/+page.svelte create mode 100644 frontend/src/routes/status/+page.server.ts delete mode 100644 frontend/src/routes/status/+page.ts diff --git a/frontend/package.json b/frontend/package.json index ff8a67e3..a4c6a197 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,7 +15,7 @@ "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/adapter-node": "^1.3.1", - "@sveltejs/kit": "^1.27.4", + "@sveltejs/kit": "1.30.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@types/luxon": "^3.3.7", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index f46e477e..daaa645c 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -33,13 +33,13 @@ dependencies: devDependencies: '@sveltejs/adapter-auto': specifier: ^2.0.0 - version: 2.0.0(@sveltejs/kit@1.27.4) + version: 2.0.0(@sveltejs/kit@1.30.0) '@sveltejs/adapter-node': specifier: ^1.3.1 - version: 1.3.1(@sveltejs/kit@1.27.4) + version: 1.3.1(@sveltejs/kit@1.30.0) '@sveltejs/kit': - specifier: ^1.27.4 - version: 1.27.4(svelte@4.2.7)(vite@4.4.2) + specifier: 1.30.0 + version: 1.30.0(svelte@4.2.7)(vite@4.4.2) '@types/luxon': specifier: ^3.3.7 version: 3.3.7 @@ -534,16 +534,16 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@sveltejs/adapter-auto@2.0.0(@sveltejs/kit@1.27.4): + /@sveltejs/adapter-auto@2.0.0(@sveltejs/kit@1.30.0): resolution: {integrity: sha512-b+gkHFZgD771kgV3aO4avHFd7y1zhmMYy9i6xOK7m/rwmwaRO8gnF5zBc0Rgca80B2PMU1bKNxyBTHA14OzUAQ==} peerDependencies: '@sveltejs/kit': ^1.0.0 dependencies: - '@sveltejs/kit': 1.27.4(svelte@4.2.7)(vite@4.4.2) + '@sveltejs/kit': 1.30.0(svelte@4.2.7)(vite@4.4.2) import-meta-resolve: 2.2.2 dev: true - /@sveltejs/adapter-node@1.3.1(@sveltejs/kit@1.27.4): + /@sveltejs/adapter-node@1.3.1(@sveltejs/kit@1.30.0): resolution: {integrity: sha512-A0VgRQDCDPzdLNoiAbcOxGw4zT1Mc+n1LwT1OmO350R7WxrEqdMUChPPOd1iMfIDWlP4ie6E2d/WQf5es2d4Zw==} peerDependencies: '@sveltejs/kit': ^1.0.0 @@ -551,12 +551,12 @@ packages: '@rollup/plugin-commonjs': 25.0.7(rollup@3.29.4) '@rollup/plugin-json': 6.0.1(rollup@3.29.4) '@rollup/plugin-node-resolve': 15.2.3(rollup@3.29.4) - '@sveltejs/kit': 1.27.4(svelte@4.2.7)(vite@4.4.2) + '@sveltejs/kit': 1.30.0(svelte@4.2.7)(vite@4.4.2) rollup: 3.29.4 dev: true - /@sveltejs/kit@1.27.4(svelte@4.2.7)(vite@4.4.2): - resolution: {integrity: sha512-Vxl8Jf0C1+/8i/slsxFOnwJntCBDLueO/O6GJ0390KUnyW3Zs+4ZiIinD+cEcYnJPQQ9CRzVSr9Bn6DbmTn4Dw==} + /@sveltejs/kit@1.30.0(svelte@4.2.7)(vite@4.4.2): + resolution: {integrity: sha512-HK7XE8ZAL7cGreRRxCCVEpcNA3x2KM0mfJlDv7geEyCElYjJsdBoANEb00HcYlvs/2ShNAsX8lY/A60s9Xdfew==} engines: {node: ^16.14 || >=18} hasBin: true requiresBuild: true diff --git a/frontend/src/lib/components/header/item.svelte b/frontend/src/lib/components/header-item.svelte similarity index 100% rename from frontend/src/lib/components/header/item.svelte rename to frontend/src/lib/components/header-item.svelte diff --git a/frontend/src/lib/components/header.svelte b/frontend/src/lib/components/header.svelte index 41f2294a..a494d324 100644 --- a/frontend/src/lib/components/header.svelte +++ b/frontend/src/lib/components/header.svelte @@ -1,9 +1,10 @@
{plexDebridItem.title}
-{plexDebridItem.aired_at}
++ {plexDebridItem.title} +
+{plexDebridItem.aired_at.slice(0, -3)}
+Status
-Error code: {$page.status}
+Error message: {$page.error?.message}
+{data.user?.email}
Premium expires on {formatDate(data.user?.expiration, 'short')}
- {:else} -You are not logged in.
- {/if}{error.message}
+Error message: {error.message}
+