-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsections-loader.tsx
39 lines (35 loc) · 1.09 KB
/
sections-loader.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use client'
import { LoaderIcon } from 'lucide-react'
import { cn } from '@/lib/utils'
import { useBuilder } from '@/store'
import { SonnerCheckIc } from '@/components/icons'
export function SectionsLoader() {
const queue = useBuilder((store) => store.queue)
return (
<ul className='size-full flex flex-col gap-2 overflow-y-auto'>
{queue.jobs.map((section) => {
const { id, name, status } = section
const icon =
status === 'completed' ? (
<SonnerCheckIc />
) : (
<LoaderIcon size={18} className='animate-spin' />
)
return (
<li className='flex gap-3 animate-fade-slide' key={id}>
{icon}
<span
className={cn('transition-opacity duration-200', {
'opacity-20': status == 'idle',
'opacity-80': status == 'loading',
'font-medium': status === 'completed'
})}
>
{status === 'completed' ? 'Added' : 'Adding'} {name}...
</span>
</li>
)
})}
</ul>
)
}