diff --git a/src/components/streams/LiverEventCard.vue b/src/components/streams/LiverEventCard.vue index baef3dd..f394ad3 100644 --- a/src/components/streams/LiverEventCard.vue +++ b/src/components/streams/LiverEventCard.vue @@ -16,7 +16,16 @@ const { liverEvent } = toRefs(props); const focusStore = useFocusStore(); const searchStore = useSearchStore(); -const { isFinished, liveDurationLabel, isNew, hasBookmark, hasNotify } = useLiverEvent(liverEvent); +const { + isUpcoming, + isLive, + isFinished, + isHovered, + liveDurationLabel, + isNew, + hasBookmark, + hasNotify, +} = useLiverEvent(liverEvent); const timeDisplay = computed(() => { const { isLive, startAt } = props.liverEvent; @@ -36,20 +45,6 @@ const timeDisplay = computed(() => { return strs.join(" "); }); -const isHovered = computed(() => { - if (!focusStore.hoveredTalent) return false; - - // 自身がホバー中のタレントか - if (focusStore.hoveredTalent === props.liverEvent.talent.name) return true; - - // ホバー中のタレントがコラボタレントに含まれているか - const collaboTalentSet = toRaw(props.liverEvent.collaboTalentSet); - if (collaboTalentSet.has(focusStore.hoveredTalent)) return true; - - // ホバー中のコラボタレントにタレントが含まれているか - return focusStore.hoveredCollaboTalentSet.has(props.liverEvent.talent.name); -}); - const firstHash = computed(() => { return props.liverEvent.hashtagList[0]; }); @@ -98,11 +93,11 @@ function setSearchString(str: string) { >
@@ -124,11 +119,12 @@ function setSearchString(str: string) { />
- - diff --git a/src/components/streams/useLiverEvent.ts b/src/components/streams/useLiverEvent.ts index 77d30e8..bfbacaa 100644 --- a/src/components/streams/useLiverEvent.ts +++ b/src/components/streams/useLiverEvent.ts @@ -1,8 +1,9 @@ -import { computed, type Ref } from "vue"; +import { computed, toRaw, type Ref } from "vue"; import type { LiverEvent } from "@/services/api"; import { useBookmarkStore } from "@/store/bookmarkStore"; import { useDateStore } from "@/store/dateStore"; import { useEventListStore } from "@/store/eventListStore"; +import { useFocusStore } from "@/store/focusStore"; const oneHour = 60 * 60 * 1000; @@ -14,6 +15,7 @@ export const useLiverEvent = (liverEvent: Ref) => { const dateStore = useDateStore(); const eventListStore = useEventListStore(); const bookmarkStore = useBookmarkStore(); + const focusStore = useFocusStore(); // 配信終了判定 const isFinished = computed(() => { @@ -98,8 +100,31 @@ export const useLiverEvent = (liverEvent: Ref) => { return dateStore.currentTime < startTime.value; }); + const isUpcoming = computed(() => { + return !isLive.value && !isFinished.value; + }); + const isLive = computed(() => { + return liverEvent.value.isLive; + }); + const isHovered = computed(() => { + if (!focusStore.hoveredTalent) return false; + + // 自身がホバー中のタレントか + if (focusStore.hoveredTalent === liverEvent.value.talent.name) return true; + + // ホバー中のタレントがコラボタレントに含まれているか + const collaboTalentSet = toRaw(liverEvent.value.collaboTalentSet); + if (collaboTalentSet.has(focusStore.hoveredTalent)) return true; + + // ホバー中のコラボタレントにタレントが含まれているか + return focusStore.hoveredCollaboTalentSet.has(liverEvent.value.talent.name); + }); + return { + isUpcoming, + isLive, isFinished, + isHovered, elapsedTime, liveDuration, liveDurationLabel,