diff --git a/src/data/api/index.ts b/src/data/api/index.ts index b1cfc70..b5e45f1 100644 --- a/src/data/api/index.ts +++ b/src/data/api/index.ts @@ -8,14 +8,16 @@ import type { Asset, TeamMember, DonationPlatform, - CryptoWallet + CryptoWallet, + Social } from '$lib/types'; -export type ReposData = Repository[]; +export type ReposData = { repositories: Repository[] }; export type PatchesData = { patches: Patch[]; packages: string[] }; export type ReleaseData = { metadata: Metadata; assets: Asset[] }; export type TeamData = { members: TeamMember[] }; export type DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] }; +export type SocialsData = { socials: Social[] }; async function get_json(endpoint: string) { const url = `${settings.api_base_url()}/${endpoint}`; @@ -23,7 +25,8 @@ async function get_json(endpoint: string) { } async function repositories(): Promise { - return await get_json('contributors').then((json) => json.repositories); + const json = await get_json('contributors'); + return { repositories: json.repositories }; } async function manager(): Promise { @@ -59,10 +62,14 @@ async function team(): Promise { async function donate(): Promise { const json = await get_json('v2/donations'); - return { wallets: json.donations.wallets, platforms: json.donations.links }; } +async function socials(): Promise { + const json = await get_json('v2/socials'); + return { socials: json.socials }; +} + export const staleTime = 5 * 60 * 1000; export const queries = { manager: { @@ -89,5 +96,10 @@ export const queries = { queryKey: ['donate'], queryFn: donate, staleTime + }, + socials: { + queryKey: ['socials'], + queryFn: socials, + staleTime } }; diff --git a/src/layout/Footer/FooterHost.svelte b/src/layout/Footer/FooterHost.svelte index dfb5b66..6cb0872 100644 --- a/src/layout/Footer/FooterHost.svelte +++ b/src/layout/Footer/FooterHost.svelte @@ -3,13 +3,15 @@ import { quintOut } from 'svelte/easing'; import { queries } from '$data/api'; - import { friendlyName } from '$util/friendlyName'; import { createQuery } from '@tanstack/svelte-query'; + import { friendlyName } from '$util/friendlyName'; + import Query from '$lib/components/Query.svelte'; import FooterSection from './FooterSection.svelte'; - const query = createQuery(['repositories'], queries.repositories); + const repoQuery = createQuery(['repositories'], queries.repositories); + const socialsQuery = createQuery(['socials'], queries.socials); @@ -55,35 +57,28 @@
  • Donate
  • - - {#each data as { name }} -
  • - - {friendlyName(name)} - -
  • - {/each} + + {#if data} + {#each data.repositories as { name }} +
  • + + {friendlyName(name)} + +
  • + {/each} + {/if}
    - + + {#if data} + {#each data.socials as { name, url }} +
  • + {friendlyName(name)} +
  • + {/each} + {/if} +
    diff --git a/src/layout/Hero/SocialButton.svelte b/src/layout/Hero/SocialButton.svelte index f63356f..5a9b300 100644 --- a/src/layout/Hero/SocialButton.svelte +++ b/src/layout/Hero/SocialButton.svelte @@ -1,11 +1,12 @@ - - + jsonSocial.name === social)?.url} rel="noreferrer" target="_blank">
    - {src} + {social}
    diff --git a/src/layout/Hero/SocialHost.svelte b/src/layout/Hero/SocialHost.svelte index 67a79b3..748f6de 100644 --- a/src/layout/Hero/SocialHost.svelte +++ b/src/layout/Hero/SocialHost.svelte @@ -1,13 +1,21 @@ -