CHORE: Fixed loading icon and added it into REPOS page.

This commit is contained in:
Luke Else 2025-05-24 14:02:52 +01:00
parent 25f3db52ec
commit 2d3046da48
2 changed files with 47 additions and 28 deletions

View File

@ -21,21 +21,21 @@
left: 0%; left: 0%;
top: 0%; top: 0%;
animation: rotate-one 1s linear infinite; animation: rotate-one 1s linear infinite;
border-bottom: 3px solid var(--fg); border-bottom: 3px solid gray;
} }
.inner.two { .inner.two {
right: 0%; right: 0%;
top: 0%; top: 0%;
animation: rotate-two 1s linear infinite; animation: rotate-two 1s linear infinite;
border-right: 3px solid var(--fg); border-right: 3px solid gray;
} }
.inner.three { .inner.three {
right: 0%; right: 0%;
bottom: 0%; bottom: 0%;
animation: rotate-three 1s linear infinite; animation: rotate-three 1s linear infinite;
border-top: 3px solid var(--fg); border-top: 3px solid gray;
} }
@keyframes rotate-one { @keyframes rotate-one {

View File

@ -1,9 +1,11 @@
<script lang="ts"> <script lang="ts">
import { loadRepos, repos } from '$lib/stores'; import { onMount } from 'svelte'; import { loadRepos, repos } from '$lib/stores';
import { timeSince, checkImage, IMAGE_URL_SUFFIX } from '$lib/api/git'; import { timeSince, checkImage, IMAGE_URL_SUFFIX } from '$lib/api/git';
import { toasts } from 'svelte-toasts';
import FlexGallery from '$lib/components/FlexGallery.svelte'; import FlexGallery from '$lib/components/FlexGallery.svelte';
import Card from '$lib/components/Cards/Card.svelte'; import Card from '$lib/components/Cards/Card.svelte';
import Loading from '$lib/components/Loading.svelte';
let repoImages: Record<string, string | null> = {}; let repoImages: Record<string, string | null> = {};
@ -18,29 +20,46 @@
} }
})(); })();
} }
onMount(loadRepos);
</script> </script>
<FlexGallery> {#await loadRepos()}
{#each $repos as repo} <Loading />
<Card {:then _}
headerLeft={repo.name} {#if $repos.length == 0}
headerRight={repo.language} {console.log("No Repos")}
footer={timeSince(repo.updated_at)} <div style="display: none;">
containerStyle="group relative flex-1 min-w-[250px] max-w-full md:min-w-[33%] opacity-100 hover:opacity-100 hover:scale-[105%] md:opacity-70 transition-all duration-300 overflow-hidden" {toasts.add({
> title: 'Error',
<div class="relative z-0"> description: 'Failed to load repositories',
{repo.description} duration: 5000,
</div> type: 'error',
{#if repoImages[repo.name]} placement: 'bottom-center',
<!-- svelte-ignore a11y_img_redundant_alt --> showProgress: true
<img })}
src={repoImages[repo.name]} </div>
alt="repo image" {/if}
class="absolute left-0 bottom-0 h-full w-full object-cover rounded-2xl transition-transform duration-500 translate-y-full group-hover:translate-y-0 z-10 pointer-events-none" <!-- Repositories loaded successfully -->
/> <FlexGallery>
{/if} {#each $repos as repo}
</Card> <!-- <Loading /> -->
{/each} <Card
</FlexGallery> headerLeft={repo.name}
headerRight={repo.language}
footer={timeSince(repo.updated_at)}
containerStyle="group relative flex-1 min-w-[250px] max-w-full md:min-w-[33%] opacity-100 hover:opacity-100 hover:scale-[105%] md:opacity-70 transition-all duration-300 overflow-hidden"
>
<div class="relative z-0">
{repo.description}
</div>
{#if repoImages[repo.name]}
<!-- svelte-ignore a11y_img_redundant_alt -->
<img
src={repoImages[repo.name]}
alt="repo image"
class="absolute left-0 bottom-0 h-full w-full object-cover rounded-2xl transition-transform duration-500 translate-y-full group-hover:translate-y-0 z-10 pointer-events-none"
/>
{/if}
</Card>
{/each}
</FlexGallery>
{/await}