From bea18cb5c479e5302c18d0499927eb84f2f3b599 Mon Sep 17 00:00:00 2001 From: Gus Date: Tue, 30 Sep 2025 15:46:08 +0800 Subject: [PATCH 1/4] Add loading placeholder for article thumbnails --- src/partials/ArticleItemPartial.vue | 72 ++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/src/partials/ArticleItemPartial.vue b/src/partials/ArticleItemPartial.vue index e5ee8d32..638cadb7 100644 --- a/src/partials/ArticleItemPartial.vue +++ b/src/partials/ArticleItemPartial.vue @@ -1,8 +1,38 @@ From 5050e02eb974ca488fc630ba50a30903036cedbf Mon Sep 17 00:00:00 2001 From: Gus Date: Tue, 30 Sep 2025 15:53:33 +0800 Subject: [PATCH 2/4] Refine article thumbnail image status handling --- src/partials/ArticleItemPartial.vue | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/partials/ArticleItemPartial.vue b/src/partials/ArticleItemPartial.vue index 638cadb7..dded12e1 100644 --- a/src/partials/ArticleItemPartial.vue +++ b/src/partials/ArticleItemPartial.vue @@ -3,12 +3,12 @@
(); -const imageLoaded = ref(false); -const imageError = ref(false); +type ImageStatus = 'loading' | 'loaded' | 'error'; + +const imageStatus = ref('loading'); const handleImageLoad = () => { - imageLoaded.value = true; + imageStatus.value = 'loaded'; }; const handleImageError = () => { - imageError.value = true; - imageLoaded.value = true; + imageStatus.value = 'error'; }; -const showSkeleton = computed(() => !imageLoaded.value || imageError.value); +const isImageError = computed(() => imageStatus.value === 'error'); +const isImageLoaded = computed(() => imageStatus.value === 'loaded'); +const showSkeleton = computed(() => imageStatus.value !== 'loaded'); watch( () => props.item?.cover_image_url, (newSrc) => { if (!newSrc) { - imageLoaded.value = true; - imageError.value = true; + imageStatus.value = 'error'; return; } - imageLoaded.value = false; - imageError.value = false; + imageStatus.value = 'loading'; }, { immediate: true }, ); From a01854f31708ec5a47e307a9e8d711c3b1baa5ff Mon Sep 17 00:00:00 2001 From: Gus Date: Tue, 30 Sep 2025 15:56:30 +0800 Subject: [PATCH 3/4] Use broken image icon for thumbnail errors --- src/partials/ArticleItemPartial.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/partials/ArticleItemPartial.vue b/src/partials/ArticleItemPartial.vue index dded12e1..bcf3d036 100644 --- a/src/partials/ArticleItemPartial.vue +++ b/src/partials/ArticleItemPartial.vue @@ -28,7 +28,22 @@ stroke-width="1.5" stroke="currentColor" > - + + + +
From 11040796be02774466885457570122035a73a0c0 Mon Sep 17 00:00:00 2001 From: Gustavo Ocanto Date: Tue, 30 Sep 2025 15:58:09 +0800 Subject: [PATCH 4/4] fotmat --- src/partials/ArticleItemPartial.vue | 112 +++++++++++++--------------- 1 file changed, 50 insertions(+), 62 deletions(-) diff --git a/src/partials/ArticleItemPartial.vue b/src/partials/ArticleItemPartial.vue index bcf3d036..ab5b089f 100644 --- a/src/partials/ArticleItemPartial.vue +++ b/src/partials/ArticleItemPartial.vue @@ -1,53 +1,41 @@