Skip to content

A self-hosted media server and file management system

feat: use lazy image in more locations

aminnausin19d5e6931ea5
diff --git a/resources/js/components/cards/data/LrcLibCard.vue b/resources/js/components/cards/data/LrcLibCard.vue
index 80ec8cce..efeaa9c0 100644
--- a/resources/js/components/cards/data/LrcLibCard.vue
+++ b/resources/js/components/cards/data/LrcLibCard.vue
@@ -8,9 +8,10 @@ import { ButtonIcon } from '@/components/cedar-ui/button';
import { computed } from 'vue';
import { cn } from '@aminnausin/cedar-ui';
+import MediaTag from '@/components/labels/MediaTag.vue';
+
import ProiconsEye from '~icons/proicons/eye';
import PrimeSave from '~icons/prime/save';
-import MediaTag from '@/components/labels/MediaTag.vue';
const { dirtyLyric } = storeToRefs(useLyricStore());
@@ -72,7 +73,7 @@ const tags = computed(() => {
</h4>
</span>
- <span class="hidden max-h-[22px] justify-end gap-1 overflow-clip [overflow-clip-margin:4px] sm:flex">
+ <span class="hidden max-h-5.5 justify-end gap-1 overflow-clip [overflow-clip-margin:4px] sm:flex">
<MediaTag
v-for="(tag, index) in tags"
:key="index"
diff --git a/resources/js/components/cards/data/TaskCard.vue b/resources/js/components/cards/data/TaskCard.vue
index 10f81779..063aed7c 100644
--- a/resources/js/components/cards/data/TaskCard.vue
+++ b/resources/js/components/cards/data/TaskCard.vue
@@ -13,6 +13,7 @@ import { cn } from '@aminnausin/cedar-ui';
import PulseDoughnutChart from '@/components/charts/PulseDoughnutChart.vue';
import SubTaskCard from '@/components/cards/data/SubTaskCard.vue';
+import LazyImage from '@/components/lazy/LazyImage.vue';
import ProiconsMoreVertical from '~icons/proicons/more-vertical';
import ProiconsChevronDown from '~icons/proicons/chevron-down';
@@ -78,9 +79,9 @@ watch(
<div class="dark:bg-primary-dark-800/50 bg-primary-800 flex w-full flex-col rounded-xl text-left text-xs shadow-sm ring-1 ring-gray-900/5">
<section class="data-card flex w-full flex-wrap items-center gap-4 rounded-xl p-3 ring-1 ring-gray-900/5">
<div class="text-foreground-1 relative flex flex-1 flex-col gap-2 sm:gap-1">
- <HoverCard :content="data.description ?? ''" :content-title="data.summary" class="flex items-center gap-x-4 gap-y-2">
+ <HoverCard :content="data.description" :content-title="data.summary" class="flex items-center gap-x-4 gap-y-2">
<template #trigger>
- <h2 class="group text-foreground-0 truncate text-base capitalize">{{ data.id }} - {{ data.name }}</h2>
+ <h2 class="group text-foreground-0 line-clamp-1 text-base capitalize">{{ data.id }} - {{ data.name }}</h2>
<p v-if="data.summary" class="hidden max-w-64 truncate md:block">
{{ data.summary }}
</p>
@@ -88,10 +89,11 @@ watch(
</HoverCard>
<div class="flex w-full flex-1 flex-wrap gap-1 gap-x-4 md:grid md:grid-cols-3 xl:grid-cols-5">
<div class="flex h-fit gap-1">
- <img
- class="xs:rounded-full my-auto aspect-square h-4 rounded-t-xl object-cover"
+ <LazyImage
+ :wrapper-class="'w-fit shrink-0 my-auto relative'"
+ class="aspect-square size-4 rounded-full object-cover"
:src="`https://ui-avatars.com/api/?name=${data.user[0]}&amp;color=7F9CF5&amp;background=random`"
- alt="username"
+ alt="user"
/>
<h4>
{{ data.user }}
@@ -186,11 +188,11 @@ watch(
</div>
</div>
<div class="ml-auto flex items-center gap-1">
- <span class="mr-1 flex w-24 items-center justify-end">
+ <span class="mr-1 flex items-center justify-end sm:w-24">
<BadgeTag
:class="
cn(
- 'flex h-6 items-center',
+ 'xs:text-sm flex h-6 items-center text-xs',
data.status === 'pending' ? 'bg-[#e4e4e4] text-gray-900 dark:bg-white' : 'text-white',
{ 'bg-primary dark:bg-primary-dark': data.status === 'processing' },
{ 'bg-amber-500 dark:bg-amber-600': data.status === 'incomplete' },
@@ -258,7 +260,7 @@ watch(
</section>
<section
- :class="`scrollbar-hide flex flex-col gap-1 rounded-xl px-1 transition-all duration-300 ease-in-out ${expanded ? `max-h-[800px] overflow-y-auto py-1` : 'max-h-0 overflow-hidden'}`"
+ :class="`scrollbar-hide flex flex-col gap-1 rounded-xl px-1 transition-all duration-300 ease-in-out ${expanded ? `max-h-200 overflow-y-auto py-1` : 'max-h-0 overflow-hidden'}`"
>
<TableBase
:class="'p-1'"
diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vue
index 78f7222b..1a99f2d6 100755
--- a/resources/js/components/panels/NavBar.vue
+++ b/resources/js/components/panels/NavBar.vue
@@ -13,6 +13,7 @@ import DashboardSidebarDrawer from '@/components/drawers/DashboardSidebarDrawer.
import SettingsSidebarDrawer from '@/components/drawers/SettingsSidebarDrawer.vue';
import VideoSidebarDrawer from '@/components/drawers/VideoSidebarDrawer.vue';
import ToggleLightMode from '@/components/inputs/ToggleLightMode.vue';
+import LazyImage from '@/components/lazy/LazyImage.vue';
import MaterialSymbolsLightHistory from '~icons/material-symbols-light/history';
import CircumFolderOn from '~icons/circum/folder-on';
@@ -86,9 +87,10 @@ const toggleLeftSidebar = (sidebar: 'dashboard' | 'settings') => {
{{ isLoadingUserData ? '' : userData?.name || 'Guest' }}
</h2>
- <img
- :src="userData?.avatar ?? '/storage/avatars/default.jpg'"
+ <LazyImage
+ :wrapper-class="'relative h-fit w-fit'"
class="ring-primary-active aspect-square size-7 rounded-full object-cover shadow-sm ring"
+ :src="userData?.avatar ?? '/storage/avatars/default.jpg'"
alt="profile"
/>
</button>
@@ -145,7 +147,7 @@ const toggleLeftSidebar = (sidebar: 'dashboard' | 'settings') => {
<CircumMonitor height="24" width="24" />
</NavLink>
</span>
- <ToggleLightMode class="dark:hover:border-primary w-[68px] border border-gray-900/5 shadow-sm" />
+ <ToggleLightMode class="dark:hover:border-primary w-17 border border-gray-900/5 shadow-sm" />
</div>
<hr class="text-hr block w-full shrink-0" />
</nav>
diff --git a/resources/js/components/profile/ProfileHeader.vue b/resources/js/components/profile/ProfileHeader.vue
index 227d493b..894ddfac 100644
--- a/resources/js/components/profile/ProfileHeader.vue
+++ b/resources/js/components/profile/ProfileHeader.vue
@@ -4,10 +4,17 @@ import { toTimeSpan } from '@/service/util';
import { useRoute } from 'vue-router';
import { computed } from 'vue';
+import LazyImage from '@/components/lazy/LazyImage.vue';
+
const route = useRoute();
const username = computed(() => route.params.username.toString());
const { data: userProfile } = useUserProfile(username);
+
+const profilePicture = computed(() => {
+ if (!userProfile.value?.name || userProfile.value.name[0] === 'a') return '/storage/avatars/default.jpg';
+ return userProfile.value.avatar ?? `https://ui-avatars.com/api/?name=${userProfile.value.name[0]}&amp;color=7F9CF5&amp;background=random`;
+});
</script>
<template>
<section
@@ -16,13 +23,10 @@ const { data: userProfile } = useUserProfile(username);
class="flex h-52 items-end overflow-clip bg-cover text-white lg:h-64"
>
<section id="profile-header" class="flex w-full flex-wrap items-end gap-4 bg-linear-to-b from-transparent to-neutral-950/40 p-3 text-center">
- <img
- :src="
- userProfile?.name[0] === 'a'
- ? '/storage/avatars/default.jpg'
- : (userProfile?.avatar ?? `https://ui-avatars.com/api/?name=${userProfile?.name[0]}&amp;color=7F9CF5&amp;background=random`)
- "
+ <LazyImage
+ :wrapper-class="'relative h-fit w-fit'"
class="ring-primary-active/70 mx-auto aspect-square w-24 min-w-24 rounded-full object-cover ring-2 md:h-32 md:w-32"
+ :src="profilePicture"
alt="profile"
/>
<section class="text-centre flex flex-1 flex-wrap items-end justify-center sm:pb-2 xl:pb-4">