@@ -14,17 +14,16 @@ import {
14
14
} from '@/components/ui/dialog' ;
15
15
import { Button } from '@/components/ui/button' ;
16
16
import { SquarePlus } from 'lucide-react' ;
17
+ import { useNavigate } from 'react-router-dom' ;
17
18
18
- export function List ( { data, listPath, listName, isLoading, setIsLoading } ) {
19
+ export function List ( { data, listPath, listName, isLoading } ) {
19
20
const [ search , setSearch ] = useState ( '' ) ;
20
21
const [ allData , setAllData ] = useState ( [ ] ) ;
21
22
const [ displayData , setDisplayData ] = useState ( [ ] ) ;
22
23
const [ isOpen , setIsOpen ] = useState ( false ) ;
23
24
const [ openItemId , setOpenItemId ] = useState ( null ) ;
24
- const [ noData , setNoData ] = useState ( false ) ;
25
25
26
26
useEffect ( ( ) => {
27
- setIsLoading ( true ) ;
28
27
const arrayWithIndicator = data . map ( ( item ) => ( {
29
28
...item ,
30
29
indicator : getIndicator ( item ) ,
@@ -34,19 +33,6 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
34
33
setDisplayData ( urgencyData ) ;
35
34
} , [ data ] ) ;
36
35
37
- useEffect ( ( ) => {
38
- if ( displayData . length > 1 ) {
39
- setIsLoading ( false ) ;
40
- }
41
- } , [ displayData ] ) ;
42
-
43
- setTimeout ( ( ) => {
44
- if ( data . length === 0 ) {
45
- setIsLoading ( false ) ;
46
- setNoData ( true ) ;
47
- }
48
- } , 2000 ) ;
49
-
50
36
const handleAddModal = ( ) => {
51
37
if ( search . length > 0 ) {
52
38
setDisplayData ( allData ) ;
@@ -60,20 +46,38 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
60
46
setOpenItemId ( ( prevId ) => ( prevId === id ? null : id ) ) ;
61
47
} ;
62
48
49
+ const navigate = useNavigate ( ) ;
50
+
51
+ function handleClick ( ) {
52
+ navigate ( '/' ) ;
53
+ }
54
+
63
55
return (
64
56
< >
65
- { listPath === '' ? (
66
- < div className = "flex flex-col space-y-10 justify-center items-center" >
57
+ { listPath === '' || ! listPath ? (
58
+ < div className = "flex flex-col space-y-10 justify-center items-center gap-3 " >
67
59
< div className = "relative inline-block" >
68
60
< h1 className = "font-[montserrat] text-3xl font-bold text-gray" >
69
61
< span className = "relative inline-block" > No list selected</ span >
70
62
</ h1 >
71
63
< img
72
- src = "/img/underline.png"
64
+ src = "/img/ruby-underline.png"
65
+ alt = "Description"
66
+ className = "absolute bottom-[-12px] -right-3 w-14 h-3 dark:hidden"
67
+ />
68
+ < img
69
+ src = "/img/light-pink-underline.png"
73
70
alt = "Description"
74
- className = "absolute bottom-[-12px] -right-3 w-14 h-3"
71
+ className = "absolute bottom-[-12px] -right-3 w-14 h-3 hidden dark:block "
75
72
/>
76
73
</ div >
74
+ < Button
75
+ onClick = { handleClick }
76
+ className = "bg-ruby-pink text-white rounded-xl dark:bg-primary-green dark:text-black w-full hover:bg-ruby-pink dark:hover:bg-primary-green hover:bg-opacity-75 dark:hover:bg-opacity-75 text-sm md:text-base font-semibold max-w-[250px]"
77
+ >
78
+ < SquarePlus className = "h-5 w-5 md:w-6 md:h-6 mr-2" />
79
+ Let's get you started!
80
+ </ Button >
77
81
</ div >
78
82
) : (
79
83
< div className = "flex flex-col space-y-10 justify-center items-center" >
@@ -104,7 +108,7 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
104
108
< Dialog open = { isOpen } onOpenChange = { handleAddModal } >
105
109
< DialogTrigger asChild className = "items-start mt-[19px]" >
106
110
< Button className = "bg-transparen hover:bg-transparen p-0" >
107
- < SquarePlus className = "h-10 w-10 text-primary-green dark:text-primary-pink transition-opacity hover:opacity-75" />
111
+ < SquarePlus className = "h-10 w-10 mt-2 text-primary-green dark:text-primary-pink transition-opacity hover:opacity-75" />
108
112
</ Button >
109
113
</ DialogTrigger >
110
114
< DialogContent >
@@ -165,13 +169,13 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
165
169
) ) }
166
170
</ ul >
167
171
) }
168
- { ! isLoading && noData && displayData . length === 0 && (
172
+ { ! isLoading && data . length === 0 && (
169
173
< div className = "flex flex-col justify-center items-center gap-4 w-full mx-auto" >
170
174
< p className = "text-grey text-center" >
171
175
Your list is empty. Start adding some items now!
172
176
</ p >
173
177
< Button
174
- className = "bg-primary-pink text-white rounded-xl dark:bg-primary-green dark:text-black w-full hover:bg-primary-pink hover:bg-opacity-75 text-sm font-semibold max-w-[150px]"
178
+ className = "bg-primary-pink text-white rounded-xl dark:bg-primary-green dark:text-black w-full hover:bg-primary-pink dark:hover:bg-primary-green hover:bg-opacity-75 dark: hover:bg-opacity-75 text-sm font-semibold max-w-[150px]"
175
179
id = "addFirstItem"
176
180
onClick = { ( ) => setIsOpen ( ( prev ) => ! prev ) }
177
181
>
0 commit comments