mirror of
https://github.com/revanced/revanced-website.git
synced 2025-04-30 06:34:35 +02:00
parent
d808b318bc
commit
a27145d554
@ -8,14 +8,16 @@ import type {
|
|||||||
Asset,
|
Asset,
|
||||||
TeamMember,
|
TeamMember,
|
||||||
DonationPlatform,
|
DonationPlatform,
|
||||||
CryptoWallet
|
CryptoWallet,
|
||||||
|
Social
|
||||||
} from '$lib/types';
|
} from '$lib/types';
|
||||||
|
|
||||||
export type ReposData = Repository[];
|
export type ReposData = { repositories: Repository[] };
|
||||||
export type PatchesData = { patches: Patch[]; packages: string[] };
|
export type PatchesData = { patches: Patch[]; packages: string[] };
|
||||||
export type ReleaseData = { metadata: Metadata; assets: Asset[] };
|
export type ReleaseData = { metadata: Metadata; assets: Asset[] };
|
||||||
export type TeamData = { members: TeamMember[] };
|
export type TeamData = { members: TeamMember[] };
|
||||||
export type DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] };
|
export type DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] };
|
||||||
|
export type SocialsData = { socials: Social[] };
|
||||||
|
|
||||||
async function get_json(endpoint: string) {
|
async function get_json(endpoint: string) {
|
||||||
const url = `${settings.api_base_url()}/${endpoint}`;
|
const url = `${settings.api_base_url()}/${endpoint}`;
|
||||||
@ -23,7 +25,8 @@ async function get_json(endpoint: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function repositories(): Promise<ReposData> {
|
async function repositories(): Promise<ReposData> {
|
||||||
return await get_json('contributors').then((json) => json.repositories);
|
const json = await get_json('contributors');
|
||||||
|
return { repositories: json.repositories };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function manager(): Promise<ReleaseData> {
|
async function manager(): Promise<ReleaseData> {
|
||||||
@ -59,10 +62,14 @@ async function team(): Promise<TeamData> {
|
|||||||
|
|
||||||
async function donate(): Promise<DonationData> {
|
async function donate(): Promise<DonationData> {
|
||||||
const json = await get_json('v2/donations');
|
const json = await get_json('v2/donations');
|
||||||
|
|
||||||
return { wallets: json.donations.wallets, platforms: json.donations.links };
|
return { wallets: json.donations.wallets, platforms: json.donations.links };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function socials(): Promise<SocialsData> {
|
||||||
|
const json = await get_json('v2/socials');
|
||||||
|
return { socials: json.socials };
|
||||||
|
}
|
||||||
|
|
||||||
export const staleTime = 5 * 60 * 1000;
|
export const staleTime = 5 * 60 * 1000;
|
||||||
export const queries = {
|
export const queries = {
|
||||||
manager: {
|
manager: {
|
||||||
@ -89,5 +96,10 @@ export const queries = {
|
|||||||
queryKey: ['donate'],
|
queryKey: ['donate'],
|
||||||
queryFn: donate,
|
queryFn: donate,
|
||||||
staleTime
|
staleTime
|
||||||
|
},
|
||||||
|
socials: {
|
||||||
|
queryKey: ['socials'],
|
||||||
|
queryFn: socials,
|
||||||
|
staleTime
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
import { quintOut } from 'svelte/easing';
|
import { quintOut } from 'svelte/easing';
|
||||||
|
|
||||||
import { queries } from '$data/api';
|
import { queries } from '$data/api';
|
||||||
import { friendlyName } from '$util/friendlyName';
|
|
||||||
import { createQuery } from '@tanstack/svelte-query';
|
import { createQuery } from '@tanstack/svelte-query';
|
||||||
|
|
||||||
|
import { friendlyName } from '$util/friendlyName';
|
||||||
|
|
||||||
import Query from '$lib/components/Query.svelte';
|
import Query from '$lib/components/Query.svelte';
|
||||||
import FooterSection from './FooterSection.svelte';
|
import FooterSection from './FooterSection.svelte';
|
||||||
|
|
||||||
const query = createQuery(['repositories'], queries.repositories);
|
const repoQuery = createQuery(['repositories'], queries.repositories);
|
||||||
|
const socialsQuery = createQuery(['socials'], queries.socials);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- squiggly divider line -->
|
<!-- squiggly divider line -->
|
||||||
@ -55,35 +57,28 @@
|
|||||||
<li><a href="/donate">Donate</a></li>
|
<li><a href="/donate">Donate</a></li>
|
||||||
</FooterSection>
|
</FooterSection>
|
||||||
<FooterSection title="Repositories">
|
<FooterSection title="Repositories">
|
||||||
<Query {query} let:data>
|
<Query query={repoQuery} let:data>
|
||||||
{#each data as { name }}
|
{#if data}
|
||||||
|
{#each data.repositories as { name }}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/{name}" target="_blank" rel="noreferrer">
|
<a href="https://github.com/{name}" target="_blank" rel="noreferrer">
|
||||||
{friendlyName(name)}
|
{friendlyName(name)}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
|
{/if}
|
||||||
</Query>
|
</Query>
|
||||||
</FooterSection>
|
</FooterSection>
|
||||||
<FooterSection title="Socials">
|
<FooterSection title="Socials">
|
||||||
<ul>
|
<Query query={socialsQuery} let:data>
|
||||||
<!-- to replace -->
|
{#if data}
|
||||||
<li><a href="https://github.com/revanced" target="_blank" rel="noreferrer">GitHub</a></li>
|
{#each data.socials as { name, url }}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://revanced.app/discord" target="_blank" rel="noreferrer">Discord</a>
|
<a href={url} target="_blank" rel="noreferrer">{friendlyName(name)}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
{/each}
|
||||||
<a href="https://reddit.com/r/revancedapp" target="_blank" rel="noreferrer">Reddit</a>
|
{/if}
|
||||||
</li>
|
</Query>
|
||||||
<li><a href="https://t.me/app_revanced" target="_blank" rel="noreferrer">Telegram</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://twitter.com/revancedapp" target="_blank" rel="noreferrer">Twitter</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://www.youtube.com/c/ReVanced" target="_blank" rel="noreferrer">YouTube</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</FooterSection>
|
</FooterSection>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
export let src = 'github';
|
import type {Social} from '$lib/types';
|
||||||
export let href = '#';
|
export let social = '';
|
||||||
|
export let data: Social[];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a {href} rel="noreferrer" target="_blank">
|
<a href={data.find(jsonSocial => jsonSocial.name === social)?.url} rel="noreferrer" target="_blank">
|
||||||
<div>
|
<div>
|
||||||
<img src="socials/{src}.svg" alt={src} />
|
<img src="socials/{social}.svg" alt={social} />
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
import SocialButton from './SocialButton.svelte';
|
import SocialButton from './SocialButton.svelte';
|
||||||
|
import { queries } from '$data/api';
|
||||||
|
import { createQuery } from '@tanstack/svelte-query';
|
||||||
|
import Query from '$lib/components/Query.svelte';
|
||||||
|
|
||||||
|
const query = createQuery(['socials'], queries.socials);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- TODO: Use API social links -->
|
|
||||||
<div class="social-host">
|
<div class="social-host">
|
||||||
<SocialButton src="github" href="https://github.com/revanced" />
|
<Query {query} let:data>
|
||||||
<SocialButton src="discord" href="https://revanced.app/discord" />
|
{#if data}
|
||||||
<SocialButton src="reddit" href="https://reddit.com/r/revancedapp" />
|
<SocialButton social="github" data={data.socials}/>
|
||||||
<SocialButton src="telegram" href="https://t.me/app_revanced" />
|
<SocialButton social="discord" data={data.socials}/>
|
||||||
|
<SocialButton social="reddit" data={data.socials}/>
|
||||||
|
<SocialButton social="telegram" data={data.socials}/>
|
||||||
|
{/if}
|
||||||
|
</Query>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -67,3 +67,9 @@ export interface DonationPlatform {
|
|||||||
url: string;
|
url: string;
|
||||||
preferred: boolean;
|
preferred: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Social {
|
||||||
|
name: string
|
||||||
|
url: string
|
||||||
|
}
|
@ -56,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="repos">
|
<div class="repos">
|
||||||
<Query {query} let:data>
|
<Query {query} let:data>
|
||||||
{#each data as { contributors, name: repo }}
|
{#each data.repositories as { contributors, name: repo }}
|
||||||
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
|
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
|
||||||
<ContributorHost {contributors} {repo} />
|
<ContributorHost {contributors} {repo} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user