mirror of
https://github.com/revanced/revanced-website.git
synced 2025-06-12 21:27:42 +02:00
refactor: api client
This commit is contained in:
@ -7,14 +7,14 @@
|
||||
|
||||
<section class="error">
|
||||
<h1>{status}</h1>
|
||||
{#if status == 500}
|
||||
<p>
|
||||
{$page.error.message}
|
||||
</p>
|
||||
{:else if status == 404}
|
||||
{#if status == 404}
|
||||
<p>That page received a cease and desist letter from a multi-billion dollar tech company.</p>
|
||||
<br />
|
||||
<Navigation href="/" is_selected={() => true}>Home</Navigation>
|
||||
{:else}
|
||||
<p>
|
||||
{$page.error.message}
|
||||
</p>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
|
@ -6,13 +6,6 @@
|
||||
import RouterEvents from '../data/RouterEvents';
|
||||
import '../app.css';
|
||||
|
||||
import type { PageData } from './$types';
|
||||
|
||||
import { contributors } from "../data/api";
|
||||
|
||||
export let data: PageData;
|
||||
contributors.init(data);
|
||||
|
||||
// Just like the set/clearInterval example found here: https://svelte.dev/docs#run-time-svelte-store-derived
|
||||
const show_loading_animation = derived(RouterEvents, ($event, set) => {
|
||||
if ($event.navigating) {
|
||||
@ -44,3 +37,6 @@
|
||||
{:else}
|
||||
<slot />
|
||||
{/if}
|
||||
<!--
|
||||
afn if you are moving the footer here, please make it not use the repositories store directly and instead use component props :) -->
|
||||
<!-- <Footer repos={$repositories}> -->
|
||||
|
@ -1,7 +1,14 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
import { contributors } from '../data/api';
|
||||
import { repositories } from '../data/api';
|
||||
|
||||
export const prerender = true;
|
||||
|
||||
export const load: PageLoad = contributors.page_load_impl();
|
||||
const base = repositories.page_load_impl();
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
// The entire site may softlock if the user sets a bad API url if we don't do this.
|
||||
try {
|
||||
return await base({ fetch });
|
||||
} catch(_) { }
|
||||
}
|
||||
|
@ -5,11 +5,7 @@
|
||||
import ContributorHost from '$lib/components/molecules/ContributorHost.svelte';
|
||||
import Footer from '$lib/components/molecules/Footer.svelte';
|
||||
|
||||
// Handled by `+layout.ts`.
|
||||
import { contributors } from '../../data/api';
|
||||
|
||||
import type { PageData } from './$types';
|
||||
export let data: PageData;
|
||||
import { repositories } from '../../data/api';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@ -25,7 +21,7 @@
|
||||
<h2>Want to show up here? <span><a href="https://github.com/revanced" target="_blank" rel="noreferrer">Become a contributor</a></span></h2>
|
||||
</div>
|
||||
<div class="contrib-grid">
|
||||
{#each $contributors.repositories as { contributors: contribs, name }}
|
||||
{#each $repositories as { contributors: contribs, name }}
|
||||
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
|
||||
<ContributorHost {contribs} repo={name} />
|
||||
</div>
|
||||
@ -34,7 +30,7 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<Footer {...data} />
|
||||
<Footer />
|
||||
|
||||
<style>
|
||||
.contrib-grid {
|
||||
|
5
src/routes/contributors/+page.ts
Normal file
5
src/routes/contributors/+page.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
import { repositories } from '../../data/api';
|
||||
|
||||
export const load: PageLoad = repositories.page_load_impl();
|
@ -1,13 +1,9 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { tools as api_tools } from '../../data/api';
|
||||
import { tools } from '../../data/api';
|
||||
import Button from '$lib/components/atoms/Button.svelte';
|
||||
import Footer from '$lib/components/molecules/Footer.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
api_tools.init(data);
|
||||
|
||||
$: manager = $api_tools.tools["revanced/revanced-manager"];
|
||||
$: manager = $tools["revanced/revanced-manager"];
|
||||
</script>
|
||||
|
||||
<div class="wrapper">
|
||||
@ -17,7 +13,7 @@
|
||||
<img src="../manager_two.png" alt="Manager Screenshot"/>
|
||||
</div>
|
||||
|
||||
<Footer {...data}/>
|
||||
<Footer />
|
||||
|
||||
<style>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
|
||||
import { fly } from 'svelte/transition';
|
||||
import { quintOut } from 'svelte/easing';
|
||||
|
||||
@ -12,10 +10,6 @@
|
||||
import PatchCell from '$lib/components/molecules/PatchCell.svelte';
|
||||
import Footer from '$lib/components/molecules/Footer.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
// Needed when someone navigates directly to the page.
|
||||
api_patches.init(data);
|
||||
|
||||
$: ({ patches, packages } = $api_patches);
|
||||
|
||||
let current: boolean = false;
|
||||
@ -55,7 +49,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
</main>
|
||||
<Footer {...data} />
|
||||
<Footer />
|
||||
|
||||
<style>
|
||||
main {
|
||||
|
Reference in New Issue
Block a user