@@ -14,17 +14,16 @@ import {
1414} from '@/components/ui/dialog' ;
1515import { Button } from '@/components/ui/button' ;
1616import { SquarePlus } from 'lucide-react' ;
17+ import { useNavigate } from 'react-router-dom' ;
1718
18- export function List ( { data, listPath, listName, isLoading, setIsLoading } ) {
19+ export function List ( { data, listPath, listName, isLoading } ) {
1920 const [ search , setSearch ] = useState ( '' ) ;
2021 const [ allData , setAllData ] = useState ( [ ] ) ;
2122 const [ displayData , setDisplayData ] = useState ( [ ] ) ;
2223 const [ isOpen , setIsOpen ] = useState ( false ) ;
2324 const [ openItemId , setOpenItemId ] = useState ( null ) ;
24- const [ noData , setNoData ] = useState ( false ) ;
2525
2626 useEffect ( ( ) => {
27- setIsLoading ( true ) ;
2827 const arrayWithIndicator = data . map ( ( item ) => ( {
2928 ...item ,
3029 indicator : getIndicator ( item ) ,
@@ -34,19 +33,6 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
3433 setDisplayData ( urgencyData ) ;
3534 } , [ data ] ) ;
3635
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-
5036 const handleAddModal = ( ) => {
5137 if ( search . length > 0 ) {
5238 setDisplayData ( allData ) ;
@@ -60,20 +46,38 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
6046 setOpenItemId ( ( prevId ) => ( prevId === id ? null : id ) ) ;
6147 } ;
6248
49+ const navigate = useNavigate ( ) ;
50+
51+ function handleClick ( ) {
52+ navigate ( '/' ) ;
53+ }
54+
6355 return (
6456 < >
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 " >
6759 < div className = "relative inline-block" >
6860 < h1 className = "font-[montserrat] text-3xl font-bold text-gray" >
6961 < span className = "relative inline-block" > No list selected</ span >
7062 </ h1 >
7163 < 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"
7370 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 "
7572 />
7673 </ 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 >
7781 </ div >
7882 ) : (
7983 < div className = "flex flex-col space-y-10 justify-center items-center" >
@@ -104,7 +108,7 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
104108 < Dialog open = { isOpen } onOpenChange = { handleAddModal } >
105109 < DialogTrigger asChild className = "items-start mt-[19px]" >
106110 < 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" />
108112 </ Button >
109113 </ DialogTrigger >
110114 < DialogContent >
@@ -165,13 +169,13 @@ export function List({ data, listPath, listName, isLoading, setIsLoading }) {
165169 ) ) }
166170 </ ul >
167171 ) }
168- { ! isLoading && noData && displayData . length === 0 && (
172+ { ! isLoading && data . length === 0 && (
169173 < div className = "flex flex-col justify-center items-center gap-4 w-full mx-auto" >
170174 < p className = "text-grey text-center" >
171175 Your list is empty. Start adding some items now!
172176 </ p >
173177 < 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]"
175179 id = "addFirstItem"
176180 onClick = { ( ) => setIsOpen ( ( prev ) => ! prev ) }
177181 >
0 commit comments