import { Route, RouteObject, Routes, useLocation } from 'react-router-dom' import Login from '@/web/pages/Login' import Playlist from '@/web/pages/Playlist' import Artist from '@/web/pages/Artist' import Search from '@/web/pages/Search' import Library from '@/web/pages/Library' import Settings from '@/web/pages/Settings' import { AnimatePresence } from 'framer-motion' import React, { ReactNode, Suspense } from 'react' const My = React.lazy(() => import('@/web/pages/New/My')) const Discover = React.lazy(() => import('@/web/pages/New/Discover')) const Album = React.lazy(() => import('@/web/pages/New/Album')) const routes: RouteObject[] = [ { path: '/', element: , }, { path: '/discover', element: , }, { path: '/library', element: , }, { path: '/settings', element: , }, { path: '/login', element: , }, { path: '/search/:keywords', element: , children: [ { path: ':type', element: , }, ], }, { path: '/playlist/:id', element: , }, { path: '/album/:id', element: , }, { path: '/artist/:id', element: , }, ] const lazy = (components: ReactNode) => { return {components} } const Router = () => { const location = useLocation() return ( )} /> )} /> )} /> )} /> ) } export default Router