Skip to content

Commit e3f1745

Browse files
committed
refactor: remove avatar comp. and used image comp.
1 parent 0891709 commit e3f1745

File tree

9 files changed

+22
-70
lines changed

9 files changed

+22
-70
lines changed

frontend/src/lib/components/header.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import QuibbleLogo from '$lib/components/icons/logos/quibble.svelte';
44
import QuibbleTextLogo from '$lib/components/icons/logos/quibble_text.svelte';
55
import NotificationIcon from '$lib/components/icons/notification.svelte';
6-
import Avatar from '$lib/components/ui/avatar.svelte';
6+
import Image from '$lib/components/ui/image.svelte';
77
import { createModalsStore } from '$lib/stores/modals.svelte';
88
import { createAuthStore } from '$lib/stores/auth.svelte';
99
import { page } from '$app/stores';
@@ -46,7 +46,7 @@
4646
<div
4747
class="ml-2 flex items-center gap-2 rounded-lg border border-neutral bg-base-100 p-1 px-1.5"
4848
>
49-
<Avatar src={$page.data.quiblet.avatar} class="!size-5" />
49+
<Image src={$page.data.quiblet.avatar} class="size-5 rounded-full" />
5050
<h5 class="whitespace-nowrap text-xs font-medium">q/{$page.data.quiblet.name}</h5>
5151
</div>
5252
{/if}
@@ -73,8 +73,8 @@
7373
</button>
7474
</div>
7575
<div class="tooltip tooltip-bottom flex before:left-0" data-tip="Profile menu">
76-
<Avatar
77-
class="btn btn-neutral !size-10 !rounded-btn p-0"
76+
<Image
77+
class="btn btn-neutral size-10 rounded-btn p-0"
7878
src={authStore.state.profile?.avatar}
7979
/>
8080
</div>

frontend/src/lib/components/modals/auth/forms/profile_select.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import QuibbleLogo from '$lib/components/icons/logos/quibble.svelte';
33
import QuibbleTextLogo from '$lib/components/icons/logos/quibble_text.svelte';
44
import type { FormProps } from '../types';
5-
import Avatar from '$lib/components/ui/avatar.svelte';
5+
import Image from '$lib/components/ui/image.svelte';
66
import { onMount } from 'svelte';
77
import { enhance } from '$app/forms';
88
import type { SubmitFunction } from '@sveltejs/kit';
@@ -94,8 +94,8 @@
9494
type="submit"
9595
class="group flex flex-col items-center justify-center gap-2.5"
9696
>
97-
<Avatar
98-
class="!size-20 !rounded-2xl outline outline-offset-4 outline-neutral"
97+
<Image
98+
class="size-20 rounded-2xl outline outline-offset-4 outline-neutral"
9999
src={profile.avatar}
100100
/>
101101
<span class="line-clamp-1 max-w-20 break-all text-xs font-medium"

frontend/src/lib/components/quib.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import type { components } from '$lib/clients/v1';
3-
import Avatar from '$lib/components/ui/avatar.svelte';
3+
import Image from '$lib/components/ui/image.svelte';
44
import readable from 'readable-numbers';
55
import { FormatDate } from '$lib/functions/date';
66
import { createAuthStore } from '$lib/stores/auth.svelte';
@@ -46,7 +46,7 @@
4646
href="/{get_name()}"
4747
class="relative flex items-center gap-2 hover:text-accent hover:underline"
4848
>
49-
<Avatar src={get_avatar()} />
49+
<Image src={get_avatar()} class="size-6 rounded-full" />
5050
<h3 class="text-xs font-semibold">{get_name()}</h3>
5151
</a>
5252
<coreicons-shape-circle variant="filled" class="size-0.5 text-base-content/75"

frontend/src/lib/components/sidebar.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import QuibbleIcon from '$lib/components/icons/logos/quibble.svelte';
3-
import Avatar from '$lib/components/ui/avatar.svelte';
3+
import Image from '$lib/components/ui/image.svelte';
44
import { createSidebarStore } from '$lib/stores/sidebar.svelte';
55
66
const sidebarStore = createSidebarStore();
@@ -45,7 +45,7 @@
4545
{#each sidebarStore.state.recent as quiblet}
4646
<div class="flex items-center gap-2">
4747
<a href="/q/{quiblet.name}" class="flex">
48-
<Avatar src={quiblet.avatar} />
48+
<Image src={quiblet.avatar} class="size-6 rounded-full" />
4949
</a>
5050
<a href="/q/{quiblet.name}" class="text-sm font-medium">q/{quiblet.name}</a>
5151
<button
@@ -77,7 +77,7 @@
7777
{#each sidebarStore.state.your as quiblet}
7878
<div class="flex items-center gap-2">
7979
<a href="q/{quiblet.name}" class="flex">
80-
<Avatar src={quiblet.avatar} />
80+
<Image src={quiblet.avatar} class="size-6 rounded-full" />
8181
</a>
8282
<a href="q/{quiblet.name}" class="text-sm font-medium">q/{quiblet.name}</a>
8383
<button

frontend/src/lib/components/ui/avatar.svelte

Lines changed: 0 additions & 50 deletions
This file was deleted.

frontend/src/lib/components/ui/image.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
let valid_src = $state(false);
1212
1313
const object_classes: string[] = [];
14-
let _klass = klass
14+
const _klass = klass
1515
?.split(/\s+/)
1616
.filter((cls) => {
1717
if (cls.startsWith('object-')) {
@@ -40,7 +40,7 @@
4040
<img {src} alt="" class={cn('h-full w-full', ...object_classes)} />
4141
{:else}
4242
<svg
43-
class="w-10 text-neutral-content"
43+
class="w-1/2 max-w-10 text-neutral-content"
4444
viewBox="0 0 157 86"
4545
fill="none"
4646
xmlns="http://www.w3.org/2000/svg"

frontend/src/routes/(app)/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import QuibsHeader from '$lib/components/quibs_header.svelte';
44
import recent_posts from '$lib/data/mock/recent_posts.json';
55
import readable from 'readable-numbers';
6-
import Avatar from '$lib/components/ui/avatar.svelte';
6+
import Image from '$lib/components/ui/image.svelte';
77
import type { PageData } from './$types';
88
99
const { data }: { data: PageData } = $props();
@@ -37,7 +37,7 @@
3737
href="/q/{post.community.name}"
3838
class="flex items-center gap-2 hover:text-accent hover:underline"
3939
>
40-
<Avatar src={post.community.avatar} />
40+
<Image src={post.community.avatar} class="size-6 rounded-full" />
4141
<h3 class="text-xs font-semibold">q/{post.community.name}</h3>
4242
</a>
4343
<a

frontend/src/routes/(app)/q/[name]/+layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { PageData } from './$types';
44
import { FormatDate } from '$lib/functions/date';
55
import { pluralize } from '$lib/functions/pluralize';
6-
import Avatar from '$lib/components/ui/avatar.svelte';
6+
import Image from '$lib/components/ui/image.svelte';
77
88
const { data, children }: { data: PageData; children: Snippet } = $props();
99
const { quiblet } = data;
@@ -53,7 +53,7 @@
5353
<div class="flex flex-col gap-2">
5454
{#each quiblet?.rangers as ranger}
5555
<div class="flex items-center gap-2">
56-
<Avatar src={ranger.avatar} />
56+
<Image src={ranger.avatar} class="size-6 rounded-full" />
5757
<div class="flex flex-col">
5858
<a href="/u/{ranger.username}" class="text-sm font-medium"
5959
>u/{ranger.username}</a

frontend/src/routes/(app)/q/[name]/+page.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script lang="ts">
22
import Quib from '$lib/components/quib.svelte';
33
import QuibsHeader from '$lib/components/quibs_header.svelte';
4-
import Avatar from '$lib/components/ui/avatar.svelte';
54
import { cn } from '$lib/functions/classnames';
65
import type { PageData } from './$types';
76
import { FormatDate } from '$lib/functions/date';
@@ -47,7 +46,10 @@
4746
/>
4847
<div class="absolute inset-x-0 -bottom-12 flex items-end justify-between px-4">
4948
<div class="flex items-end gap-2">
50-
<Avatar class="!size-20 outline outline-8 outline-base-300" src={quiblet?.avatar} />
49+
<Image
50+
class="size-20 rounded-full outline outline-8 outline-base-300"
51+
src={quiblet?.avatar}
52+
/>
5153
<h3 class="text-2xl font-bold text-info">q/{quiblet?.name}</h3>
5254
</div>
5355
<div class="flex items-center gap-2">

0 commit comments

Comments
 (0)