({ children })
| 8 | import { dummyStoreData } from "@/assets/assets" |
| 9 | |
| 10 | const StoreLayout = ({ children }) => { |
| 11 | |
| 12 | |
| 13 | const [isSeller, setIsSeller] = useState(false) |
| 14 | const [loading, setLoading] = useState(true) |
| 15 | const [storeInfo, setStoreInfo] = useState(null) |
| 16 | |
| 17 | const fetchIsSeller = async () => { |
| 18 | setIsSeller(true) |
| 19 | setStoreInfo(dummyStoreData) |
| 20 | setLoading(false) |
| 21 | } |
| 22 | |
| 23 | useEffect(() => { |
| 24 | fetchIsSeller() |
| 25 | }, []) |
| 26 | |
| 27 | return loading ? ( |
| 28 | <Loading /> |
| 29 | ) : isSeller ? ( |
| 30 | <div className="flex flex-col h-screen"> |
| 31 | <SellerNavbar /> |
| 32 | <div className="flex flex-1 items-start h-full overflow-y-scroll no-scrollbar"> |
| 33 | <SellerSidebar storeInfo={storeInfo} /> |
| 34 | <div className="flex-1 h-full p-5 lg:pl-12 lg:pt-12 overflow-y-scroll"> |
| 35 | {children} |
| 36 | </div> |
| 37 | </div> |
| 38 | </div> |
| 39 | ) : ( |
| 40 | <div className="min-h-screen flex flex-col items-center justify-center text-center px-6"> |
| 41 | <h1 className="text-2xl sm:text-4xl font-semibold text-slate-400">You are not authorized to access this page</h1> |
| 42 | <Link href="/" className="bg-slate-700 text-white flex items-center gap-2 mt-8 p-2 px-6 max-sm:text-sm rounded-full"> |
| 43 | Go to home <ArrowRightIcon size={18} /> |
| 44 | </Link> |
| 45 | </div> |
| 46 | ) |
| 47 | } |
| 48 | |
| 49 | export default StoreLayout |
nothing calls this directly
no test coverage detected