@imksh/create 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -0
- package/bin/index.js +3 -0
- package/package.json +43 -0
- package/src/commands/create.js +90 -0
- package/src/index.js +41 -0
- package/src/utils/askTemplate.js +25 -0
- package/src/utils/copyTemplate.js +36 -0
- package/src/utils/installPackages.js +25 -0
- package/src/utils/logger.js +17 -0
- package/src/utils/runGit.js +11 -0
- package/templates/mern/_gitignore +2 -0
- package/templates/mern/client/_gitignore +24 -0
- package/templates/mern/client/index.html +14 -0
- package/templates/mern/client/package.json +39 -0
- package/templates/mern/client/public/_redirects +1 -0
- package/templates/mern/client/public/favicon.ico +0 -0
- package/templates/mern/client/public/favicon.svg +1 -0
- package/templates/mern/client/public/logo.png +0 -0
- package/templates/mern/client/public/manifest.json +24 -0
- package/templates/mern/client/public/sw.js +56 -0
- package/templates/mern/client/src/App.jsx +68 -0
- package/templates/mern/client/src/assets/animations/loading.json +1 -0
- package/templates/mern/client/src/assets/data/navigation.js +29 -0
- package/templates/mern/client/src/assets/images/logo.png +0 -0
- package/templates/mern/client/src/components/common/Breadcrumbs.jsx +27 -0
- package/templates/mern/client/src/components/common/Loading.jsx +19 -0
- package/templates/mern/client/src/components/common/LottieIcon.jsx +36 -0
- package/templates/mern/client/src/components/common/NotFound.jsx +78 -0
- package/templates/mern/client/src/components/common/PwaInstallPrompt.jsx +72 -0
- package/templates/mern/client/src/components/common/SEO.jsx +67 -0
- package/templates/mern/client/src/components/common/Scroll.jsx +25 -0
- package/templates/mern/client/src/components/common/Table.jsx +110 -0
- package/templates/mern/client/src/components/common/ToggleSwitch.jsx +38 -0
- package/templates/mern/client/src/components/common/Unauthorized.jsx +76 -0
- package/templates/mern/client/src/components/layout/ProtectedRoute.jsx +17 -0
- package/templates/mern/client/src/components/layout/PublicLayout.jsx +13 -0
- package/templates/mern/client/src/components/layout/SidebarLayout.jsx +37 -0
- package/templates/mern/client/src/components/modals/ConfirmModal.jsx +135 -0
- package/templates/mern/client/src/components/modals/Modal.jsx +94 -0
- package/templates/mern/client/src/components/skeletons/common/CardSkeleton.jsx +23 -0
- package/templates/mern/client/src/components/skeletons/common/DashboardSkeleton.jsx +19 -0
- package/templates/mern/client/src/components/skeletons/common/ListSkeleton.jsx +24 -0
- package/templates/mern/client/src/components/skeletons/common/PageSkeleton.jsx +26 -0
- package/templates/mern/client/src/components/skeletons/common/ProfileSkeleton.jsx +23 -0
- package/templates/mern/client/src/components/skeletons/common/Skeleton.jsx +18 -0
- package/templates/mern/client/src/components/skeletons/common/TableSkeleton.jsx +33 -0
- package/templates/mern/client/src/components/ui/Header.jsx +230 -0
- package/templates/mern/client/src/components/ui/SidebarHeader.jsx +27 -0
- package/templates/mern/client/src/components/ui/sidebar.jsx +152 -0
- package/templates/mern/client/src/config/api.js +22 -0
- package/templates/mern/client/src/config/appConfig.js +44 -0
- package/templates/mern/client/src/config/navigation.js +14 -0
- package/templates/mern/client/src/hooks/useLenis.js +28 -0
- package/templates/mern/client/src/hooks/usePwaInstall.js +45 -0
- package/templates/mern/client/src/hooks/useWindowSize.js +25 -0
- package/templates/mern/client/src/index.css +158 -0
- package/templates/mern/client/src/main.jsx +24 -0
- package/templates/mern/client/src/pages/Home.jsx +154 -0
- package/templates/mern/client/src/pages/Login.jsx +196 -0
- package/templates/mern/client/src/pages/Profile.jsx +9 -0
- package/templates/mern/client/src/services/authService.js +16 -0
- package/templates/mern/client/src/store/useAuthStore.js +98 -0
- package/templates/mern/client/src/store/useUiStore.js +54 -0
- package/templates/mern/client/src/utils/getInitials.js +10 -0
- package/templates/mern/client/vite.config.js +8 -0
- package/templates/mern/package.json +18 -0
- package/templates/mern/server/.env.example +62 -0
- package/templates/mern/server/README.md +65 -0
- package/templates/mern/server/_gitignore +24 -0
- package/templates/mern/server/package.json +32 -0
- package/templates/mern/server/src/app.js +42 -0
- package/templates/mern/server/src/config/cloudinary.js +9 -0
- package/templates/mern/server/src/config/db.js +14 -0
- package/templates/mern/server/src/config/dotenv.js +2 -0
- package/templates/mern/server/src/config/email.js +30 -0
- package/templates/mern/server/src/config/socket.js +54 -0
- package/templates/mern/server/src/config/webPush.js +9 -0
- package/templates/mern/server/src/controllers/auth.controller.js +153 -0
- package/templates/mern/server/src/controllers/upload.controller.js +26 -0
- package/templates/mern/server/src/index.js +24 -0
- package/templates/mern/server/src/middleware/auth.middleware.js +43 -0
- package/templates/mern/server/src/middleware/errorHandler.js +22 -0
- package/templates/mern/server/src/middleware/multer.js +21 -0
- package/templates/mern/server/src/middleware/rateLimiter.js +57 -0
- package/templates/mern/server/src/models/otp.model.js +21 -0
- package/templates/mern/server/src/models/pushSubscription.model.js +32 -0
- package/templates/mern/server/src/models/user.model.js +43 -0
- package/templates/mern/server/src/routes/auth.route.js +22 -0
- package/templates/mern/server/src/routes/index.js +10 -0
- package/templates/mern/server/src/routes/upload.route.js +12 -0
- package/templates/mern/server/src/services/auth.service.js +162 -0
- package/templates/mern/server/src/services/auth.service.ts +0 -0
- package/templates/mern/server/src/utils/authToken.js +26 -0
- package/templates/mern/server/src/utils/cloudinary.js +27 -0
- package/templates/mern/server/src/utils/cloudinaryUpload.js +87 -0
- package/templates/mern/server/src/utils/emailOtp.js +190 -0
- package/templates/mern/server/src/utils/genOtpToken.js +20 -0
- package/templates/mern/server/src/utils/generateVapidKeys.js +12 -0
- package/templates/mern/server/src/utils/jwt.js +25 -0
- package/templates/mern/server/src/utils/logger.js +25 -0
- package/templates/mern-ts/_gitignore +2 -0
- package/templates/mern-ts/client/_gitignore +24 -0
- package/templates/mern-ts/client/index.html +14 -0
- package/templates/mern-ts/client/package.json +45 -0
- package/templates/mern-ts/client/public/_redirects +1 -0
- package/templates/mern-ts/client/public/favicon.ico +0 -0
- package/templates/mern-ts/client/public/favicon.svg +1 -0
- package/templates/mern-ts/client/public/logo.png +0 -0
- package/templates/mern-ts/client/public/manifest.json +24 -0
- package/templates/mern-ts/client/public/sw.js +56 -0
- package/templates/mern-ts/client/src/App.tsx +68 -0
- package/templates/mern-ts/client/src/assets/animations/loading.json +1 -0
- package/templates/mern-ts/client/src/assets/data/navigation.ts +29 -0
- package/templates/mern-ts/client/src/assets/images/logo.png +0 -0
- package/templates/mern-ts/client/src/components/common/Breadcrumbs.tsx +27 -0
- package/templates/mern-ts/client/src/components/common/Loading.tsx +19 -0
- package/templates/mern-ts/client/src/components/common/LottieIcon.tsx +36 -0
- package/templates/mern-ts/client/src/components/common/NotFound.tsx +78 -0
- package/templates/mern-ts/client/src/components/common/PwaInstallPrompt.tsx +72 -0
- package/templates/mern-ts/client/src/components/common/SEO.tsx +67 -0
- package/templates/mern-ts/client/src/components/common/Scroll.tsx +25 -0
- package/templates/mern-ts/client/src/components/common/Table.tsx +118 -0
- package/templates/mern-ts/client/src/components/common/ToggleSwitch.tsx +38 -0
- package/templates/mern-ts/client/src/components/common/Unauthorized.tsx +76 -0
- package/templates/mern-ts/client/src/components/layout/ProtectedRoute.tsx +23 -0
- package/templates/mern-ts/client/src/components/layout/PublicLayout.tsx +13 -0
- package/templates/mern-ts/client/src/components/layout/SidebarLayout.tsx +37 -0
- package/templates/mern-ts/client/src/components/modals/ConfirmModal.tsx +135 -0
- package/templates/mern-ts/client/src/components/modals/Modal.tsx +94 -0
- package/templates/mern-ts/client/src/components/skeletons/common/CardSkeleton.tsx +23 -0
- package/templates/mern-ts/client/src/components/skeletons/common/DashboardSkeleton.tsx +19 -0
- package/templates/mern-ts/client/src/components/skeletons/common/ListSkeleton.tsx +24 -0
- package/templates/mern-ts/client/src/components/skeletons/common/PageSkeleton.tsx +26 -0
- package/templates/mern-ts/client/src/components/skeletons/common/ProfileSkeleton.tsx +23 -0
- package/templates/mern-ts/client/src/components/skeletons/common/Skeleton.tsx +18 -0
- package/templates/mern-ts/client/src/components/skeletons/common/TableSkeleton.tsx +33 -0
- package/templates/mern-ts/client/src/components/ui/Header.tsx +230 -0
- package/templates/mern-ts/client/src/components/ui/SidebarHeader.tsx +27 -0
- package/templates/mern-ts/client/src/components/ui/sidebar.tsx +152 -0
- package/templates/mern-ts/client/src/config/api.ts +22 -0
- package/templates/mern-ts/client/src/config/appConfig.ts +44 -0
- package/templates/mern-ts/client/src/config/navigation.ts +14 -0
- package/templates/mern-ts/client/src/hooks/useLenis.ts +28 -0
- package/templates/mern-ts/client/src/hooks/usePwaInstall.ts +45 -0
- package/templates/mern-ts/client/src/hooks/useWindowSize.ts +25 -0
- package/templates/mern-ts/client/src/index.css +158 -0
- package/templates/mern-ts/client/src/main.tsx +24 -0
- package/templates/mern-ts/client/src/pages/Home.tsx +154 -0
- package/templates/mern-ts/client/src/pages/Login.tsx +196 -0
- package/templates/mern-ts/client/src/pages/Profile.tsx +9 -0
- package/templates/mern-ts/client/src/services/authService.ts +16 -0
- package/templates/mern-ts/client/src/store/useAuthStore.ts +98 -0
- package/templates/mern-ts/client/src/store/useUiStore.ts +54 -0
- package/templates/mern-ts/client/src/utils/getInitials.ts +10 -0
- package/templates/mern-ts/client/tsconfig.json +25 -0
- package/templates/mern-ts/client/tsconfig.node.json +10 -0
- package/templates/mern-ts/client/vite.config.ts +8 -0
- package/templates/mern-ts/package.json +19 -0
- package/templates/mern-ts/server/.env.example +62 -0
- package/templates/mern-ts/server/README.md +69 -0
- package/templates/mern-ts/server/_gitignore +24 -0
- package/templates/mern-ts/server/package.json +47 -0
- package/templates/mern-ts/server/src/app.ts +36 -0
- package/templates/mern-ts/server/src/config/cloudinary.ts +9 -0
- package/templates/mern-ts/server/src/config/db.ts +15 -0
- package/templates/mern-ts/server/src/config/dotenv.ts +2 -0
- package/templates/mern-ts/server/src/config/email.ts +28 -0
- package/templates/mern-ts/server/src/config/socket.ts +54 -0
- package/templates/mern-ts/server/src/config/webPush.ts +9 -0
- package/templates/mern-ts/server/src/controllers/auth.controller.ts +126 -0
- package/templates/mern-ts/server/src/controllers/upload.controller.ts +22 -0
- package/templates/mern-ts/server/src/index.ts +17 -0
- package/templates/mern-ts/server/src/middleware/auth.middleware.ts +38 -0
- package/templates/mern-ts/server/src/middleware/errorHandler.ts +16 -0
- package/templates/mern-ts/server/src/middleware/multer.ts +20 -0
- package/templates/mern-ts/server/src/middleware/rateLimiter.ts +53 -0
- package/templates/mern-ts/server/src/models/otp.model.ts +21 -0
- package/templates/mern-ts/server/src/models/pushSubscription.model.ts +32 -0
- package/templates/mern-ts/server/src/models/user.model.ts +43 -0
- package/templates/mern-ts/server/src/routes/auth.route.ts +22 -0
- package/templates/mern-ts/server/src/routes/index.ts +10 -0
- package/templates/mern-ts/server/src/routes/upload.route.ts +11 -0
- package/templates/mern-ts/server/src/services/auth.service.ts +115 -0
- package/templates/mern-ts/server/src/types/express.d.ts +10 -0
- package/templates/mern-ts/server/src/utils/cloudinaryUpload.ts +44 -0
- package/templates/mern-ts/server/src/utils/emailOtp.ts +30 -0
- package/templates/mern-ts/server/src/utils/genOtpToken.ts +22 -0
- package/templates/mern-ts/server/src/utils/generateVapidKeys.ts +12 -0
- package/templates/mern-ts/server/src/utils/jwt.ts +27 -0
- package/templates/mern-ts/server/src/utils/logger.ts +27 -0
- package/templates/mern-ts/server/tsconfig.json +14 -0
- package/templates/next/_gitignore +24 -0
- package/templates/next/package.json +20 -0
- package/templates/next/src/app/layout.js +7 -0
- package/templates/next/src/app/page.js +218 -0
- package/templates/next-ts/_gitignore +24 -0
- package/templates/next-ts/package.json +24 -0
- package/templates/next-ts/src/app/layout.tsx +9 -0
- package/templates/next-ts/src/app/page.tsx +218 -0
- package/templates/next-ts/tsconfig.json +27 -0
- package/templates/node/.env.example +62 -0
- package/templates/node/README.md +65 -0
- package/templates/node/_gitignore +24 -0
- package/templates/node/package.json +32 -0
- package/templates/node/src/app.js +42 -0
- package/templates/node/src/config/cloudinary.js +9 -0
- package/templates/node/src/config/db.js +14 -0
- package/templates/node/src/config/dotenv.js +2 -0
- package/templates/node/src/config/email.js +30 -0
- package/templates/node/src/config/socket.js +54 -0
- package/templates/node/src/config/webPush.js +9 -0
- package/templates/node/src/controllers/auth.controller.js +153 -0
- package/templates/node/src/controllers/upload.controller.js +26 -0
- package/templates/node/src/index.js +24 -0
- package/templates/node/src/middleware/auth.middleware.js +43 -0
- package/templates/node/src/middleware/errorHandler.js +22 -0
- package/templates/node/src/middleware/multer.js +21 -0
- package/templates/node/src/middleware/rateLimiter.js +57 -0
- package/templates/node/src/models/otp.model.js +21 -0
- package/templates/node/src/models/pushSubscription.model.js +32 -0
- package/templates/node/src/models/user.model.js +43 -0
- package/templates/node/src/routes/auth.route.js +22 -0
- package/templates/node/src/routes/index.js +10 -0
- package/templates/node/src/routes/upload.route.js +12 -0
- package/templates/node/src/services/auth.service.js +162 -0
- package/templates/node/src/services/auth.service.ts +0 -0
- package/templates/node/src/utils/authToken.js +26 -0
- package/templates/node/src/utils/cloudinary.js +27 -0
- package/templates/node/src/utils/cloudinaryUpload.js +87 -0
- package/templates/node/src/utils/emailOtp.js +190 -0
- package/templates/node/src/utils/genOtpToken.js +20 -0
- package/templates/node/src/utils/generateVapidKeys.js +12 -0
- package/templates/node/src/utils/jwt.js +25 -0
- package/templates/node/src/utils/logger.js +25 -0
- package/templates/node-prisma/.env.example +63 -0
- package/templates/node-prisma/README.md +69 -0
- package/templates/node-prisma/_gitignore +24 -0
- package/templates/node-prisma/package.json +35 -0
- package/templates/node-prisma/prisma/schema.prisma +41 -0
- package/templates/node-prisma/src/app.js +42 -0
- package/templates/node-prisma/src/config/cloudinary.js +9 -0
- package/templates/node-prisma/src/config/db.js +16 -0
- package/templates/node-prisma/src/config/dotenv.js +2 -0
- package/templates/node-prisma/src/config/email.js +30 -0
- package/templates/node-prisma/src/config/socket.js +54 -0
- package/templates/node-prisma/src/config/webPush.js +9 -0
- package/templates/node-prisma/src/controllers/auth.controller.js +146 -0
- package/templates/node-prisma/src/controllers/upload.controller.js +26 -0
- package/templates/node-prisma/src/index.js +24 -0
- package/templates/node-prisma/src/middleware/auth.middleware.js +44 -0
- package/templates/node-prisma/src/middleware/errorHandler.js +22 -0
- package/templates/node-prisma/src/middleware/multer.js +21 -0
- package/templates/node-prisma/src/middleware/rateLimiter.js +57 -0
- package/templates/node-prisma/src/routes/auth.route.js +22 -0
- package/templates/node-prisma/src/routes/index.js +10 -0
- package/templates/node-prisma/src/routes/upload.route.js +12 -0
- package/templates/node-prisma/src/services/auth.service.js +163 -0
- package/templates/node-prisma/src/services/auth.service.ts +0 -0
- package/templates/node-prisma/src/utils/authToken.js +26 -0
- package/templates/node-prisma/src/utils/cloudinary.js +27 -0
- package/templates/node-prisma/src/utils/cloudinaryUpload.js +87 -0
- package/templates/node-prisma/src/utils/emailOtp.js +190 -0
- package/templates/node-prisma/src/utils/genOtpToken.js +20 -0
- package/templates/node-prisma/src/utils/generateVapidKeys.js +12 -0
- package/templates/node-prisma/src/utils/jwt.js +25 -0
- package/templates/node-prisma/src/utils/logger.js +25 -0
- package/templates/node-prisma-ts/.env.example +63 -0
- package/templates/node-prisma-ts/README.md +73 -0
- package/templates/node-prisma-ts/_gitignore +24 -0
- package/templates/node-prisma-ts/package.json +48 -0
- package/templates/node-prisma-ts/prisma/schema.prisma +41 -0
- package/templates/node-prisma-ts/src/app.ts +36 -0
- package/templates/node-prisma-ts/src/config/cloudinary.ts +9 -0
- package/templates/node-prisma-ts/src/config/db.ts +16 -0
- package/templates/node-prisma-ts/src/config/dotenv.ts +2 -0
- package/templates/node-prisma-ts/src/config/email.ts +28 -0
- package/templates/node-prisma-ts/src/config/socket.ts +54 -0
- package/templates/node-prisma-ts/src/config/webPush.ts +9 -0
- package/templates/node-prisma-ts/src/controllers/auth.controller.ts +124 -0
- package/templates/node-prisma-ts/src/controllers/upload.controller.ts +22 -0
- package/templates/node-prisma-ts/src/index.ts +17 -0
- package/templates/node-prisma-ts/src/middleware/auth.middleware.ts +45 -0
- package/templates/node-prisma-ts/src/middleware/errorHandler.ts +16 -0
- package/templates/node-prisma-ts/src/middleware/multer.ts +20 -0
- package/templates/node-prisma-ts/src/middleware/rateLimiter.ts +53 -0
- package/templates/node-prisma-ts/src/routes/auth.route.ts +22 -0
- package/templates/node-prisma-ts/src/routes/index.ts +10 -0
- package/templates/node-prisma-ts/src/routes/upload.route.ts +11 -0
- package/templates/node-prisma-ts/src/services/auth.service.ts +163 -0
- package/templates/node-prisma-ts/src/types/express.d.ts +10 -0
- package/templates/node-prisma-ts/src/utils/cloudinaryUpload.ts +44 -0
- package/templates/node-prisma-ts/src/utils/emailOtp.ts +30 -0
- package/templates/node-prisma-ts/src/utils/genOtpToken.ts +22 -0
- package/templates/node-prisma-ts/src/utils/generateVapidKeys.ts +12 -0
- package/templates/node-prisma-ts/src/utils/jwt.ts +27 -0
- package/templates/node-prisma-ts/src/utils/logger.ts +27 -0
- package/templates/node-prisma-ts/tsconfig.json +14 -0
- package/templates/node-ts/.env.example +62 -0
- package/templates/node-ts/README.md +69 -0
- package/templates/node-ts/_gitignore +24 -0
- package/templates/node-ts/package.json +47 -0
- package/templates/node-ts/src/app.ts +36 -0
- package/templates/node-ts/src/config/cloudinary.ts +9 -0
- package/templates/node-ts/src/config/db.ts +15 -0
- package/templates/node-ts/src/config/dotenv.ts +2 -0
- package/templates/node-ts/src/config/email.ts +28 -0
- package/templates/node-ts/src/config/socket.ts +54 -0
- package/templates/node-ts/src/config/webPush.ts +9 -0
- package/templates/node-ts/src/controllers/auth.controller.ts +126 -0
- package/templates/node-ts/src/controllers/upload.controller.ts +22 -0
- package/templates/node-ts/src/index.ts +17 -0
- package/templates/node-ts/src/middleware/auth.middleware.ts +38 -0
- package/templates/node-ts/src/middleware/errorHandler.ts +16 -0
- package/templates/node-ts/src/middleware/multer.ts +20 -0
- package/templates/node-ts/src/middleware/rateLimiter.ts +53 -0
- package/templates/node-ts/src/models/otp.model.ts +21 -0
- package/templates/node-ts/src/models/pushSubscription.model.ts +32 -0
- package/templates/node-ts/src/models/user.model.ts +43 -0
- package/templates/node-ts/src/routes/auth.route.ts +22 -0
- package/templates/node-ts/src/routes/index.ts +10 -0
- package/templates/node-ts/src/routes/upload.route.ts +11 -0
- package/templates/node-ts/src/services/auth.service.ts +115 -0
- package/templates/node-ts/src/types/express.d.ts +10 -0
- package/templates/node-ts/src/utils/cloudinaryUpload.ts +44 -0
- package/templates/node-ts/src/utils/emailOtp.ts +30 -0
- package/templates/node-ts/src/utils/genOtpToken.ts +22 -0
- package/templates/node-ts/src/utils/generateVapidKeys.ts +12 -0
- package/templates/node-ts/src/utils/jwt.ts +27 -0
- package/templates/node-ts/src/utils/logger.ts +27 -0
- package/templates/node-ts/tsconfig.json +18 -0
- package/templates/react/.env.example +1 -0
- package/templates/react/_gitignore +24 -0
- package/templates/react/index.html +14 -0
- package/templates/react/package.json +39 -0
- package/templates/react/public/_redirects +1 -0
- package/templates/react/public/favicon.ico +0 -0
- package/templates/react/public/favicon.svg +1 -0
- package/templates/react/public/logo.png +0 -0
- package/templates/react/public/manifest.json +24 -0
- package/templates/react/public/sw.js +56 -0
- package/templates/react/src/App.jsx +68 -0
- package/templates/react/src/assets/animations/loading.json +1 -0
- package/templates/react/src/assets/data/navigation.js +29 -0
- package/templates/react/src/assets/images/logo.png +0 -0
- package/templates/react/src/components/common/Breadcrumbs.jsx +27 -0
- package/templates/react/src/components/common/Loading.jsx +19 -0
- package/templates/react/src/components/common/LottieIcon.jsx +36 -0
- package/templates/react/src/components/common/NotFound.jsx +78 -0
- package/templates/react/src/components/common/PwaInstallPrompt.jsx +72 -0
- package/templates/react/src/components/common/SEO.jsx +67 -0
- package/templates/react/src/components/common/Scroll.jsx +25 -0
- package/templates/react/src/components/common/Table.jsx +110 -0
- package/templates/react/src/components/common/ToggleSwitch.jsx +38 -0
- package/templates/react/src/components/common/Unauthorized.jsx +76 -0
- package/templates/react/src/components/layout/ProtectedRoute.jsx +17 -0
- package/templates/react/src/components/layout/PublicLayout.jsx +13 -0
- package/templates/react/src/components/layout/SidebarLayout.jsx +37 -0
- package/templates/react/src/components/modals/ConfirmModal.jsx +135 -0
- package/templates/react/src/components/modals/Modal.jsx +94 -0
- package/templates/react/src/components/skeletons/common/CardSkeleton.jsx +23 -0
- package/templates/react/src/components/skeletons/common/DashboardSkeleton.jsx +19 -0
- package/templates/react/src/components/skeletons/common/ListSkeleton.jsx +24 -0
- package/templates/react/src/components/skeletons/common/PageSkeleton.jsx +26 -0
- package/templates/react/src/components/skeletons/common/ProfileSkeleton.jsx +23 -0
- package/templates/react/src/components/skeletons/common/Skeleton.jsx +18 -0
- package/templates/react/src/components/skeletons/common/TableSkeleton.jsx +33 -0
- package/templates/react/src/components/ui/Header.jsx +230 -0
- package/templates/react/src/components/ui/SidebarHeader.jsx +27 -0
- package/templates/react/src/components/ui/sidebar.jsx +152 -0
- package/templates/react/src/config/api.js +22 -0
- package/templates/react/src/config/appConfig.js +44 -0
- package/templates/react/src/config/navigation.js +14 -0
- package/templates/react/src/hooks/useLenis.js +28 -0
- package/templates/react/src/hooks/usePwaInstall.js +45 -0
- package/templates/react/src/hooks/useWindowSize.js +25 -0
- package/templates/react/src/index.css +158 -0
- package/templates/react/src/main.jsx +24 -0
- package/templates/react/src/pages/Home.jsx +154 -0
- package/templates/react/src/pages/Login.jsx +196 -0
- package/templates/react/src/pages/Profile.jsx +9 -0
- package/templates/react/src/services/authService.js +16 -0
- package/templates/react/src/store/useAuthStore.js +98 -0
- package/templates/react/src/store/useUiStore.js +54 -0
- package/templates/react/src/utils/getInitials.js +10 -0
- package/templates/react/vite.config.js +8 -0
- package/templates/react-ts/_gitignore +24 -0
- package/templates/react-ts/index.html +14 -0
- package/templates/react-ts/package.json +45 -0
- package/templates/react-ts/public/_redirects +1 -0
- package/templates/react-ts/public/favicon.ico +0 -0
- package/templates/react-ts/public/favicon.svg +1 -0
- package/templates/react-ts/public/logo.png +0 -0
- package/templates/react-ts/public/manifest.json +24 -0
- package/templates/react-ts/public/sw.js +56 -0
- package/templates/react-ts/src/App.tsx +68 -0
- package/templates/react-ts/src/assets/animations/loading.json +1 -0
- package/templates/react-ts/src/assets/data/navigation.ts +29 -0
- package/templates/react-ts/src/assets/images/logo.png +0 -0
- package/templates/react-ts/src/components/common/Breadcrumbs.tsx +27 -0
- package/templates/react-ts/src/components/common/Loading.tsx +19 -0
- package/templates/react-ts/src/components/common/LottieIcon.tsx +36 -0
- package/templates/react-ts/src/components/common/NotFound.tsx +78 -0
- package/templates/react-ts/src/components/common/PwaInstallPrompt.tsx +72 -0
- package/templates/react-ts/src/components/common/SEO.tsx +67 -0
- package/templates/react-ts/src/components/common/Scroll.tsx +25 -0
- package/templates/react-ts/src/components/common/Table.tsx +118 -0
- package/templates/react-ts/src/components/common/ToggleSwitch.tsx +38 -0
- package/templates/react-ts/src/components/common/Unauthorized.tsx +76 -0
- package/templates/react-ts/src/components/layout/ProtectedRoute.tsx +23 -0
- package/templates/react-ts/src/components/layout/PublicLayout.tsx +13 -0
- package/templates/react-ts/src/components/layout/SidebarLayout.tsx +37 -0
- package/templates/react-ts/src/components/modals/ConfirmModal.tsx +135 -0
- package/templates/react-ts/src/components/modals/Modal.tsx +94 -0
- package/templates/react-ts/src/components/skeletons/common/CardSkeleton.tsx +23 -0
- package/templates/react-ts/src/components/skeletons/common/DashboardSkeleton.tsx +19 -0
- package/templates/react-ts/src/components/skeletons/common/ListSkeleton.tsx +24 -0
- package/templates/react-ts/src/components/skeletons/common/PageSkeleton.tsx +26 -0
- package/templates/react-ts/src/components/skeletons/common/ProfileSkeleton.tsx +23 -0
- package/templates/react-ts/src/components/skeletons/common/Skeleton.tsx +18 -0
- package/templates/react-ts/src/components/skeletons/common/TableSkeleton.tsx +33 -0
- package/templates/react-ts/src/components/ui/Header.tsx +230 -0
- package/templates/react-ts/src/components/ui/SidebarHeader.tsx +27 -0
- package/templates/react-ts/src/components/ui/sidebar.tsx +152 -0
- package/templates/react-ts/src/config/api.ts +22 -0
- package/templates/react-ts/src/config/appConfig.ts +44 -0
- package/templates/react-ts/src/config/navigation.ts +14 -0
- package/templates/react-ts/src/hooks/useLenis.ts +28 -0
- package/templates/react-ts/src/hooks/usePwaInstall.ts +45 -0
- package/templates/react-ts/src/hooks/useWindowSize.ts +25 -0
- package/templates/react-ts/src/index.css +158 -0
- package/templates/react-ts/src/main.tsx +24 -0
- package/templates/react-ts/src/pages/Home.tsx +154 -0
- package/templates/react-ts/src/pages/Login.tsx +196 -0
- package/templates/react-ts/src/pages/Profile.tsx +9 -0
- package/templates/react-ts/src/services/authService.ts +16 -0
- package/templates/react-ts/src/store/useAuthStore.ts +98 -0
- package/templates/react-ts/src/store/useUiStore.ts +54 -0
- package/templates/react-ts/src/utils/getInitials.ts +10 -0
- package/templates/react-ts/tsconfig.json +25 -0
- package/templates/react-ts/tsconfig.node.json +10 -0
- package/templates/react-ts/vite.config.ts +8 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { motion } from "motion/react";
|
|
3
|
+
|
|
4
|
+
const ToggleSwitch = ({ checked, onChange, label }) => {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
className="flex items-center gap-3 cursor-pointer select-none w-fit group"
|
|
8
|
+
onClick={() => onChange(!checked)}
|
|
9
|
+
>
|
|
10
|
+
<span className="text-sm font-bold">{label}</span>
|
|
11
|
+
<div
|
|
12
|
+
className={`w-12 h-6 flex items-center rounded-full p-1 transition-all duration-300 shadow-inner border ${
|
|
13
|
+
checked
|
|
14
|
+
? "bg-gradient-to-r from-emerald-400 to-cyan-500 border-transparent shadow-emerald-500/20"
|
|
15
|
+
: "bg-base-300 border-base-300/50"
|
|
16
|
+
}`}
|
|
17
|
+
>
|
|
18
|
+
<motion.div
|
|
19
|
+
className={`w-4 h-4 rounded-full shadow-sm ${
|
|
20
|
+
checked ? "bg-white" : "bg-base-content/40"
|
|
21
|
+
}`}
|
|
22
|
+
layout
|
|
23
|
+
initial={false}
|
|
24
|
+
animate={{
|
|
25
|
+
x: checked ? 24 : 0,
|
|
26
|
+
}}
|
|
27
|
+
transition={{
|
|
28
|
+
type: "spring",
|
|
29
|
+
stiffness: 500,
|
|
30
|
+
damping: 30,
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default ToggleSwitch;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { motion } from "framer-motion";
|
|
2
|
+
import { Link } from "react-router-dom";
|
|
3
|
+
import { FaArrowLeft, FaLock } from "react-icons/fa6";
|
|
4
|
+
|
|
5
|
+
const Unauthorized = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="min-h-screen flex items-center justify-center bg-base-100 px-6">
|
|
8
|
+
<div className="max-w-lg text-center">
|
|
9
|
+
<motion.div
|
|
10
|
+
initial={{ scale: 0 }}
|
|
11
|
+
animate={{ scale: 1 }}
|
|
12
|
+
transition={{
|
|
13
|
+
type: "spring",
|
|
14
|
+
stiffness: 180,
|
|
15
|
+
damping: 12,
|
|
16
|
+
}}
|
|
17
|
+
className="mx-auto mb-6 w-24 h-24 rounded-full bg-warning/15 flex items-center justify-center"
|
|
18
|
+
>
|
|
19
|
+
<FaLock className="text-5xl text-warning" />
|
|
20
|
+
</motion.div>
|
|
21
|
+
|
|
22
|
+
<motion.h1
|
|
23
|
+
initial={{ opacity: 0, y: -15 }}
|
|
24
|
+
animate={{ opacity: 1, y: 0 }}
|
|
25
|
+
className="text-7xl font-black text-warning"
|
|
26
|
+
>
|
|
27
|
+
401
|
|
28
|
+
</motion.h1>
|
|
29
|
+
|
|
30
|
+
<motion.h2
|
|
31
|
+
initial={{ opacity: 0 }}
|
|
32
|
+
animate={{ opacity: 1 }}
|
|
33
|
+
transition={{ delay: 0.15 }}
|
|
34
|
+
className="mt-4 text-3xl font-bold"
|
|
35
|
+
>
|
|
36
|
+
Unauthorized
|
|
37
|
+
</motion.h2>
|
|
38
|
+
|
|
39
|
+
<motion.p
|
|
40
|
+
initial={{ opacity: 0 }}
|
|
41
|
+
animate={{ opacity: 0.7 }}
|
|
42
|
+
transition={{ delay: 0.3 }}
|
|
43
|
+
className="mt-3 text-base-content/70"
|
|
44
|
+
>
|
|
45
|
+
You don't have permission to access this page. Please sign in with an
|
|
46
|
+
authorized account.
|
|
47
|
+
</motion.p>
|
|
48
|
+
|
|
49
|
+
<motion.div
|
|
50
|
+
initial={{ opacity: 0, y: 25 }}
|
|
51
|
+
animate={{ opacity: 1, y: 0 }}
|
|
52
|
+
transition={{ delay: 0.45 }}
|
|
53
|
+
className="mt-8 flex flex-wrap justify-center gap-3"
|
|
54
|
+
>
|
|
55
|
+
<Link to="/login" className="btn btn-warning">
|
|
56
|
+
Sign In
|
|
57
|
+
</Link>
|
|
58
|
+
|
|
59
|
+
<Link to="/" className="btn btn-outline">
|
|
60
|
+
Home
|
|
61
|
+
</Link>
|
|
62
|
+
|
|
63
|
+
<button
|
|
64
|
+
onClick={() => window.history.back()}
|
|
65
|
+
className="btn btn-ghost gap-2"
|
|
66
|
+
>
|
|
67
|
+
<FaArrowLeft />
|
|
68
|
+
Go Back
|
|
69
|
+
</button>
|
|
70
|
+
</motion.div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default Unauthorized;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Navigate } from "react-router-dom";
|
|
2
|
+
import { useAuthStore } from "../../store/useAuthStore";
|
|
3
|
+
import Loading from "../common/Loading";
|
|
4
|
+
|
|
5
|
+
const ProtectedRoute = ({ children, role }) => {
|
|
6
|
+
const { user, isCheckingAuth } = useAuthStore();
|
|
7
|
+
|
|
8
|
+
if (isCheckingAuth) return <Loading />;
|
|
9
|
+
|
|
10
|
+
if (!user) return <Navigate to="/login" />;
|
|
11
|
+
|
|
12
|
+
if (role && user.role !== role) return <Navigate to="/" />;
|
|
13
|
+
|
|
14
|
+
return children;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default ProtectedRoute;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { Outlet, useLocation } from "react-router-dom";
|
|
3
|
+
import SidebarHeader from "../ui/SidebarHeader";
|
|
4
|
+
import Sidebar from "../ui/sidebar";
|
|
5
|
+
import { useUiStore } from "../../store/useUiStore";
|
|
6
|
+
import appConfig from "../../config/appConfig";
|
|
7
|
+
|
|
8
|
+
const SidebarLayout = () => {
|
|
9
|
+
const { headerTitle, headerActions, setHeaderTitle, setHeaderActions } =
|
|
10
|
+
useUiStore();
|
|
11
|
+
const { pathname } = useLocation();
|
|
12
|
+
|
|
13
|
+
// Reset header title and actions whenever the route shifts
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setHeaderTitle(appConfig.app.name);
|
|
16
|
+
setHeaderActions(null);
|
|
17
|
+
}, [pathname, setHeaderTitle, setHeaderActions]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="flex h-screen overflow-hidden">
|
|
21
|
+
<Sidebar />
|
|
22
|
+
|
|
23
|
+
<div className="flex flex-1 flex-col overflow-hidden">
|
|
24
|
+
<SidebarHeader title={headerTitle} actions={headerActions} />
|
|
25
|
+
|
|
26
|
+
<main
|
|
27
|
+
className="flex-1 h-full overflow-y-auto px-2 py-6 md:p-6 max-w-7xl"
|
|
28
|
+
data-lenis-prevent
|
|
29
|
+
>
|
|
30
|
+
<Outlet />
|
|
31
|
+
</main>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default SidebarLayout;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import {
|
|
4
|
+
FaTriangleExclamation,
|
|
5
|
+
FaCircleInfo,
|
|
6
|
+
FaCircleCheck,
|
|
7
|
+
FaCircleXmark,
|
|
8
|
+
} from "react-icons/fa6";
|
|
9
|
+
|
|
10
|
+
const variants = {
|
|
11
|
+
warning: {
|
|
12
|
+
icon: FaTriangleExclamation,
|
|
13
|
+
iconBg: "bg-warning/15",
|
|
14
|
+
iconColor: "text-warning",
|
|
15
|
+
button: "btn-warning",
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
icon: FaCircleXmark,
|
|
19
|
+
iconBg: "bg-error/15",
|
|
20
|
+
iconColor: "text-error",
|
|
21
|
+
button: "btn-error",
|
|
22
|
+
},
|
|
23
|
+
success: {
|
|
24
|
+
icon: FaCircleCheck,
|
|
25
|
+
iconBg: "bg-success/15",
|
|
26
|
+
iconColor: "text-success",
|
|
27
|
+
button: "btn-success",
|
|
28
|
+
},
|
|
29
|
+
info: {
|
|
30
|
+
icon: FaCircleInfo,
|
|
31
|
+
iconBg: "bg-info/15",
|
|
32
|
+
iconColor: "text-info",
|
|
33
|
+
button: "btn-info",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ConfirmModal = ({
|
|
38
|
+
open,
|
|
39
|
+
variant = "warning",
|
|
40
|
+
title = "Confirm Action",
|
|
41
|
+
message = "Are you sure you want to continue?",
|
|
42
|
+
confirmText = "Confirm",
|
|
43
|
+
cancelText = "Cancel",
|
|
44
|
+
loading = false,
|
|
45
|
+
closeOnBackdrop = true,
|
|
46
|
+
closeOnEsc = true,
|
|
47
|
+
onConfirm,
|
|
48
|
+
onCancel,
|
|
49
|
+
}) => {
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!open || !closeOnEsc) return;
|
|
52
|
+
|
|
53
|
+
const handleKeyDown = (e) => {
|
|
54
|
+
if (e.key === "Escape") {
|
|
55
|
+
onCancel?.();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
60
|
+
|
|
61
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
62
|
+
}, [open, closeOnEsc, onCancel]);
|
|
63
|
+
|
|
64
|
+
if (!open) return null;
|
|
65
|
+
|
|
66
|
+
const style = variants[variant] || variants.warning;
|
|
67
|
+
const Icon = style.icon;
|
|
68
|
+
|
|
69
|
+
return createPortal(
|
|
70
|
+
<div className="fixed inset-0 z-[9999] flex items-center justify-center">
|
|
71
|
+
{/* Backdrop */}
|
|
72
|
+
|
|
73
|
+
<div
|
|
74
|
+
className="absolute inset-0 bg-black/60 backdrop-blur-sm"
|
|
75
|
+
onClick={closeOnBackdrop ? onCancel : undefined}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
{/* Modal */}
|
|
79
|
+
|
|
80
|
+
<div className="relative w-full max-w-md mx-4 rounded-2xl bg-base-100 shadow-2xl animate-in fade-in zoom-in duration-200">
|
|
81
|
+
<div className="p-6">
|
|
82
|
+
|
|
83
|
+
<div className="flex gap-4">
|
|
84
|
+
|
|
85
|
+
<div
|
|
86
|
+
className={`w-14 h-14 rounded-full flex items-center justify-center shrink-0 ${style.iconBg}`}
|
|
87
|
+
>
|
|
88
|
+
<Icon className={`text-2xl ${style.iconColor}`} />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div className="flex-1">
|
|
92
|
+
|
|
93
|
+
<h2 className="text-xl font-bold">
|
|
94
|
+
{title}
|
|
95
|
+
</h2>
|
|
96
|
+
|
|
97
|
+
<p className="mt-2 text-sm text-base-content/70 leading-relaxed">
|
|
98
|
+
{message}
|
|
99
|
+
</p>
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div className="mt-8 flex justify-end gap-3">
|
|
106
|
+
|
|
107
|
+
<button
|
|
108
|
+
className="btn btn-ghost"
|
|
109
|
+
disabled={loading}
|
|
110
|
+
onClick={onCancel}
|
|
111
|
+
>
|
|
112
|
+
{cancelText}
|
|
113
|
+
</button>
|
|
114
|
+
|
|
115
|
+
<button
|
|
116
|
+
className={`btn ${style.button}`}
|
|
117
|
+
disabled={loading}
|
|
118
|
+
onClick={onConfirm}
|
|
119
|
+
>
|
|
120
|
+
{loading && (
|
|
121
|
+
<span className="loading loading-spinner loading-xs" />
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
{confirmText}
|
|
125
|
+
</button>
|
|
126
|
+
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>,
|
|
131
|
+
document.body,
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default ConfirmModal;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { IoClose } from "react-icons/io5";
|
|
4
|
+
|
|
5
|
+
const sizes = {
|
|
6
|
+
sm: "max-w-sm",
|
|
7
|
+
md: "max-w-md",
|
|
8
|
+
lg: "max-w-lg",
|
|
9
|
+
xl: "max-w-2xl",
|
|
10
|
+
"2xl": "max-w-4xl",
|
|
11
|
+
full: "max-w-7xl",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Modal = ({
|
|
15
|
+
open,
|
|
16
|
+
onClose,
|
|
17
|
+
title,
|
|
18
|
+
children,
|
|
19
|
+
size = "md",
|
|
20
|
+
closeOnBackdrop = true,
|
|
21
|
+
closeOnEsc = true,
|
|
22
|
+
showCloseButton = true,
|
|
23
|
+
footer,
|
|
24
|
+
}) => {
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!open || !closeOnEsc) return;
|
|
27
|
+
|
|
28
|
+
const handleKeyDown = (e) => {
|
|
29
|
+
if (e.key === "Escape") {
|
|
30
|
+
onClose?.();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
35
|
+
|
|
36
|
+
return () =>
|
|
37
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
38
|
+
}, [open, closeOnEsc, onClose]);
|
|
39
|
+
|
|
40
|
+
if (!open) return null;
|
|
41
|
+
|
|
42
|
+
return createPortal(
|
|
43
|
+
<div className="fixed inset-0 z-[9999] flex items-center justify-center p-4">
|
|
44
|
+
{/* Backdrop */}
|
|
45
|
+
<div
|
|
46
|
+
className="absolute inset-0 bg-black/50 backdrop-blur-sm"
|
|
47
|
+
onClick={closeOnBackdrop ? onClose : undefined}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
{/* Modal */}
|
|
51
|
+
<div
|
|
52
|
+
className={`
|
|
53
|
+
relative
|
|
54
|
+
w-full
|
|
55
|
+
${sizes[size]}
|
|
56
|
+
rounded-2xl
|
|
57
|
+
bg-base-100
|
|
58
|
+
shadow-2xl
|
|
59
|
+
border border-base-300
|
|
60
|
+
animate-in zoom-in-95 fade-in duration-200
|
|
61
|
+
`}
|
|
62
|
+
>
|
|
63
|
+
{/* Header */}
|
|
64
|
+
<div className="flex items-center justify-between border-b border-base-300 px-6 py-4">
|
|
65
|
+
<h2 className="text-lg font-bold">{title}</h2>
|
|
66
|
+
|
|
67
|
+
{showCloseButton && (
|
|
68
|
+
<button
|
|
69
|
+
className="btn btn-circle btn-sm btn-ghost"
|
|
70
|
+
onClick={onClose}
|
|
71
|
+
>
|
|
72
|
+
<IoClose size={20} />
|
|
73
|
+
</button>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{/* Body */}
|
|
78
|
+
<div className="max-h-[70vh] overflow-y-auto p-6">
|
|
79
|
+
{children}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
{/* Footer */}
|
|
83
|
+
{footer && (
|
|
84
|
+
<div className="border-t border-base-300 px-6 py-4">
|
|
85
|
+
{footer}
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
</div>,
|
|
90
|
+
document.body,
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default Modal;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Skeleton from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
const CardSkeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="card bg-base-100 shadow border border-base-300">
|
|
6
|
+
<div className="card-body space-y-4">
|
|
7
|
+
|
|
8
|
+
<Skeleton className="h-40 w-full rounded-xl" />
|
|
9
|
+
|
|
10
|
+
<Skeleton className="h-6 w-2/3" />
|
|
11
|
+
|
|
12
|
+
<Skeleton className="h-4 w-full" />
|
|
13
|
+
|
|
14
|
+
<Skeleton className="h-4 w-5/6" />
|
|
15
|
+
|
|
16
|
+
<Skeleton className="h-10 w-28" />
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default CardSkeleton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CardSkeleton from "./CardSkeleton";
|
|
2
|
+
|
|
3
|
+
const DashboardSkeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="space-y-8">
|
|
6
|
+
|
|
7
|
+
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6">
|
|
8
|
+
{[...Array(4)].map((_, i) => (
|
|
9
|
+
<CardSkeleton key={i} />
|
|
10
|
+
))}
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<CardSkeleton />
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default DashboardSkeleton;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Skeleton from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
const ListSkeleton = ({ items = 6 }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="space-y-4">
|
|
6
|
+
{Array.from({ length: items }).map((_, i) => (
|
|
7
|
+
<div
|
|
8
|
+
key={i}
|
|
9
|
+
className="flex items-center gap-4"
|
|
10
|
+
>
|
|
11
|
+
<Skeleton className="w-12 h-12 rounded-full" />
|
|
12
|
+
|
|
13
|
+
<div className="flex-1 space-y-2">
|
|
14
|
+
<Skeleton className="h-5 w-1/3" />
|
|
15
|
+
|
|
16
|
+
<Skeleton className="h-4 w-2/3" />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
))}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default ListSkeleton;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Skeleton from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
const PageSkeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="space-y-8">
|
|
6
|
+
|
|
7
|
+
<Skeleton className="h-10 w-56" />
|
|
8
|
+
|
|
9
|
+
<Skeleton className="h-64 w-full rounded-2xl" />
|
|
10
|
+
|
|
11
|
+
<div className="grid md:grid-cols-3 gap-6">
|
|
12
|
+
|
|
13
|
+
{[1, 2, 3].map((i) => (
|
|
14
|
+
<Skeleton
|
|
15
|
+
key={i}
|
|
16
|
+
className="h-40 rounded-xl"
|
|
17
|
+
/>
|
|
18
|
+
))}
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default PageSkeleton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Skeleton from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
const ProfileSkeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex gap-6 items-center">
|
|
6
|
+
|
|
7
|
+
<Skeleton className="w-24 h-24 rounded-full" />
|
|
8
|
+
|
|
9
|
+
<div className="flex-1 space-y-3">
|
|
10
|
+
|
|
11
|
+
<Skeleton className="h-6 w-48" />
|
|
12
|
+
|
|
13
|
+
<Skeleton className="h-4 w-64" />
|
|
14
|
+
|
|
15
|
+
<Skeleton className="h-10 w-32" />
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ProfileSkeleton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const Skeleton = ({
|
|
2
|
+
className = "",
|
|
3
|
+
rounded = "rounded-lg",
|
|
4
|
+
animate = true,
|
|
5
|
+
}) => {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
className={`
|
|
9
|
+
bg-base-300
|
|
10
|
+
${rounded}
|
|
11
|
+
${animate ? "animate-pulse" : ""}
|
|
12
|
+
${className}
|
|
13
|
+
`}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Skeleton;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Skeleton from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
const TableSkeleton = ({ rows = 6, columns = 5 }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="overflow-x-auto border border-base-300 rounded-xl">
|
|
6
|
+
<table className="table">
|
|
7
|
+
<thead>
|
|
8
|
+
<tr>
|
|
9
|
+
{Array.from({ length: columns }).map((_, i) => (
|
|
10
|
+
<th key={i}>
|
|
11
|
+
<Skeleton className="h-4 w-20" />
|
|
12
|
+
</th>
|
|
13
|
+
))}
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
|
|
17
|
+
<tbody>
|
|
18
|
+
{Array.from({ length: rows }).map((_, row) => (
|
|
19
|
+
<tr key={row}>
|
|
20
|
+
{Array.from({ length: columns }).map((_, col) => (
|
|
21
|
+
<td key={col}>
|
|
22
|
+
<Skeleton className="h-4 w-full" />
|
|
23
|
+
</td>
|
|
24
|
+
))}
|
|
25
|
+
</tr>
|
|
26
|
+
))}
|
|
27
|
+
</tbody>
|
|
28
|
+
</table>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default TableSkeleton;
|