Skip to content

Commit aedd10c

Browse files
committed
実況のコメ数の表示を修正
1 parent ab6ba94 commit aedd10c

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/components/slot-item/counts.tsx

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
import type { StateSlotDetail } from '@/ncoverlay/state'
22

3-
import { cn, Skeleton } from '@nextui-org/react'
3+
import { Skeleton } from '@nextui-org/react'
44
import { PlayIcon, MessageSquareTextIcon } from 'lucide-react'
55

66
export type CountsProps = {
7+
status: StateSlotDetail['status']
78
infoCount: StateSlotDetail['info']['count']
89
isSearch?: boolean
910
}
1011

11-
export const Counts: React.FC<CountsProps> = ({ infoCount, isSearch }) => {
12+
export const Counts: React.FC<CountsProps> = ({
13+
status,
14+
infoCount,
15+
isSearch,
16+
}) => {
1217
return (
1318
<div className="flex flex-row items-center gap-4">
1419
{/* 再生数 */}
1520
{'view' in infoCount && (
1621
<div className="flex h-full flex-row items-center gap-1">
1722
<PlayIcon className={isSearch ? 'size-mini' : 'size-tiny'} />
23+
1824
<span className={isSearch ? 'text-mini' : 'text-tiny'}>
1925
{infoCount.view.toLocaleString('ja-JP')}
2026
</span>
@@ -26,13 +32,16 @@ export const Counts: React.FC<CountsProps> = ({ infoCount, isSearch }) => {
2632
<MessageSquareTextIcon
2733
className={isSearch ? 'size-mini' : 'size-tiny'}
2834
/>
29-
<span className={isSearch ? 'text-mini' : 'text-tiny'}>
30-
{infoCount.comment ? (
31-
infoCount.comment.toLocaleString('ja-JP')
32-
) : (
33-
<Skeleton className={cn('w-16', isSearch ? 'h-mini' : 'h-tiny')} />
34-
)}
35-
</span>
35+
36+
<Skeleton
37+
classNames={{
38+
base: ['min-w-12 data-[loaded=true]:min-w-0', 'rounded-[4px]'],
39+
content: [isSearch ? 'text-mini' : 'text-tiny'],
40+
}}
41+
isLoaded={0 < infoCount.comment || status === 'ready'}
42+
>
43+
{infoCount.comment.toLocaleString('ja-JP')}
44+
</Skeleton>
3645
</div>
3746
</div>
3847
)

src/components/slot-item/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ export const SlotItem: React.FC<SlotItemProps> = ({
161161
)}
162162
>
163163
{/* 再生数・コメント数 */}
164-
<Counts infoCount={detail.info.count} isSearch={isSearch} />
164+
<Counts
165+
status={detail.status}
166+
infoCount={detail.info.count}
167+
isSearch={isSearch}
168+
/>
165169

166170
{/* オフセット */}
167171
{!isSearch && <Offset offsetMs={detail.offsetMs} />}

0 commit comments

Comments
 (0)