From 2ab5766e02b26d7135341a83fcc7ea162982e042 Mon Sep 17 00:00:00 2001 From: ngthanhvu Date: Thu, 30 Jul 2026 21:38:01 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20s=E1=BB=ADa=20poster=20d=E1=BB=8Dc=20ng?= =?UTF-8?q?ang=20=E1=BB=9F=20home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/HeroSlider.vue | 2 +- app/components/HomeMovieCard.vue | 308 ++++++++++++++++++------------- app/pages/index.vue | 8 +- app/utils/episode.ts | 28 ++- 4 files changed, 210 insertions(+), 136 deletions(-) diff --git a/app/components/HeroSlider.vue b/app/components/HeroSlider.vue index c64601b..d5ea3ba 100644 --- a/app/components/HeroSlider.vue +++ b/app/components/HeroSlider.vue @@ -49,7 +49,7 @@ defineExpose({ goTo }) + class="absolute -inset-px h-[calc(100%+2px)] w-[calc(100%+2px)] max-w-none object-cover object-top lg:object-[72%_center]"> diff --git a/app/components/HomeMovieCard.vue b/app/components/HomeMovieCard.vue index 5347005..bdb77d4 100644 --- a/app/components/HomeMovieCard.vue +++ b/app/components/HomeMovieCard.vue @@ -1,39 +1,47 @@  diff --git a/app/pages/index.vue b/app/pages/index.vue index db94e4d..79edc43 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -470,7 +470,7 @@ useHead({ :class="index === heroIndex ? 'border-white/90 opacity-100 scale-100 shadow-md' : 'border-transparent opacity-80 scale-95 hover:scale-100 hover:opacity-100'" style="-webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black);" :aria-label="`Chuyển đến phim ${index + 1}`" @click="goToSlide(index)"> - @@ -580,7 +580,7 @@ useHead({ - {{ item.episodeName || `Tập ${(item.episodeIndex || 0) + 1}` }} + {{ item.episodeName || getEpisodeDisplay(String((item.episodeIndex || 0) + 1), '') }} @@ -667,9 +667,9 @@ useHead({
- -
diff --git a/app/utils/episode.ts b/app/utils/episode.ts index 90ed7cf..1985ead 100644 --- a/app/utils/episode.ts +++ b/app/utils/episode.ts @@ -11,15 +11,39 @@ function extractEpisodeNumber(value?: string): number { export function getEpisodeDisplay( episode?: string, episodeTotal?: string, + prefix = 'Tập', ): string | undefined { if (!episode) return undefined + const trimmed = episode.trim() + + // "Hoàn tất" status + if (/hoan.t|hoàn.t/.test(trimmed)) { + return 'Hoàn tất' + } + + // Extract "X/Y" pattern anywhere in the string (with or without spaces) + const slashMatch = trimmed.match(/(\d+)\s*\/\s*(\d+)/) + if (slashMatch) { + const epNum = Number(slashMatch[1]) + const totalNum = Number(slashMatch[2]) + if (epNum > 0 && totalNum > 0 && epNum < totalNum) { + return `${prefix} ${epNum}/${totalNum}` + } + return `${prefix} ${totalNum}` + } + + // Single number const totalNum = extractEpisodeNumber(episodeTotal) const epNum = extractEpisodeNumber(episode) if (totalNum > 0 && epNum > 0 && epNum !== totalNum) { - return `Tập ${epNum}/${totalNum}` + return `${prefix} ${epNum}/${totalNum}` } - return episode + if (epNum > 0) { + return `${prefix} ${epNum}` + } + + return trimmed }