@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,230 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Link, useNavigate, useLocation } from "react-router-dom";
|
|
3
|
+
import { FiMenu, FiBookOpen } from "react-icons/fi";
|
|
4
|
+
import { Moon, Sun, X, Globe } from "lucide-react";
|
|
5
|
+
import { useUiStore } from "../../store/useUiStore";
|
|
6
|
+
import appConfig from "../../config/appConfig";
|
|
7
|
+
import { useAuthStore } from "../../store/useAuthStore";
|
|
8
|
+
import { getInitials } from "../../utils/getInitials";
|
|
9
|
+
import { motion, AnimatePresence } from "framer-motion";
|
|
10
|
+
import { navigation } from "../../config/navigation";
|
|
11
|
+
|
|
12
|
+
const Header = () => {
|
|
13
|
+
const {
|
|
14
|
+
theme,
|
|
15
|
+
toggleTheme,
|
|
16
|
+
isMobileMenuOpened: isMobileMenuOpen,
|
|
17
|
+
setMobileMenuOpened: setIsMobilemenuOpen
|
|
18
|
+
} = useUiStore();
|
|
19
|
+
const { user } = useAuthStore();
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const location = useLocation().pathname;
|
|
22
|
+
const headerRef = useRef(null);
|
|
23
|
+
|
|
24
|
+
// Close mobile menu on scroll
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const handleScroll = () => {
|
|
27
|
+
setIsMobilemenuOpen(false);
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
30
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
31
|
+
}, [setIsMobilemenuOpen]);
|
|
32
|
+
|
|
33
|
+
// Close mobile menu on click outside
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const handleClickOutside = (event) => {
|
|
36
|
+
if (headerRef.current && !headerRef.current.contains(event.target)) {
|
|
37
|
+
setIsMobilemenuOpen(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
41
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
42
|
+
}, [setIsMobilemenuOpen]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<header ref={headerRef} className="sticky top-0 z-40 p-4">
|
|
46
|
+
<div className="max-w-7xl mx-auto relative">
|
|
47
|
+
{/* Main Navbar Bar */}
|
|
48
|
+
<div className="bg-primary text-primary-content rounded-full shadow-lg px-5 py-2.5 flex items-center justify-between relative">
|
|
49
|
+
{/* Left */}
|
|
50
|
+
<div className="flex items-center gap-3">
|
|
51
|
+
<Link to="/" className="flex items-center gap-2">
|
|
52
|
+
{appConfig.app.logo ? (
|
|
53
|
+
<img src={appConfig.logo} alt="logo" className="h-10 w-10" />
|
|
54
|
+
) : (
|
|
55
|
+
<div className="flex items-center">
|
|
56
|
+
<div className="w-8 h-8 rounded-full bg-base-100/25 flex items-center justify-center text-primary-content shadow-inner">
|
|
57
|
+
<FiBookOpen size={16} />
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
|
|
62
|
+
<span className="font-bold text-lg hidden sm:block">
|
|
63
|
+
{appConfig.app.name}
|
|
64
|
+
</span>
|
|
65
|
+
</Link>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{/* Center: Dynamic Navigation */}
|
|
69
|
+
<nav className="hidden lg:flex items-center gap-6 text-sm font-medium absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2">
|
|
70
|
+
{navigation.map((item) => (
|
|
71
|
+
<Link
|
|
72
|
+
key={item.path}
|
|
73
|
+
to={item.path}
|
|
74
|
+
className={`hover:text-primary transition-colors ${
|
|
75
|
+
location === item.path ? "text-white font-bold" : "text-white/80"
|
|
76
|
+
}`}
|
|
77
|
+
>
|
|
78
|
+
{item.title}
|
|
79
|
+
</Link>
|
|
80
|
+
))}
|
|
81
|
+
</nav>
|
|
82
|
+
|
|
83
|
+
{/* Right */}
|
|
84
|
+
<div className="flex items-center gap-2">
|
|
85
|
+
{/* Desktop Theme Switcher */}
|
|
86
|
+
<button
|
|
87
|
+
onClick={toggleTheme}
|
|
88
|
+
className="hidden md:flex btn btn-outline btn-soft border-none btn-circle btn-xs"
|
|
89
|
+
title="Toggle Theme"
|
|
90
|
+
>
|
|
91
|
+
{theme === "dark" ? (
|
|
92
|
+
<Sun size={16} className="text-primary-content" />
|
|
93
|
+
) : (
|
|
94
|
+
<Moon size={16} className="text-primary-content" />
|
|
95
|
+
)}
|
|
96
|
+
</button>
|
|
97
|
+
|
|
98
|
+
{/* Desktop Auth */}
|
|
99
|
+
{user ? (
|
|
100
|
+
<button
|
|
101
|
+
onClick={() => navigate("/profile")}
|
|
102
|
+
className="hidden md:flex btn btn-sm btn-circle overflow-hidden shadow-none hover:ring-1 hover:ring-offset-2 hover:ring-base-300 cursor-pointer btn-primary"
|
|
103
|
+
>
|
|
104
|
+
<img
|
|
105
|
+
src={`https://placehold.co/600x400?text=${getInitials(user?.name) || "KS"}`}
|
|
106
|
+
alt="avatar"
|
|
107
|
+
className="w-full h-full object-cover object-center"
|
|
108
|
+
/>
|
|
109
|
+
</button>
|
|
110
|
+
) : (
|
|
111
|
+
<button
|
|
112
|
+
onClick={() => navigate("/login")}
|
|
113
|
+
className="hidden md:flex btn btn-primary btn-sm rounded-full px-4"
|
|
114
|
+
>
|
|
115
|
+
Login
|
|
116
|
+
</button>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* Mobile Dropdown Menu Button */}
|
|
120
|
+
<button
|
|
121
|
+
onClick={() => setIsMobilemenuOpen(!isMobileMenuOpen)}
|
|
122
|
+
className="lg:hidden btn btn-outline btn-soft border-none btn-circle btn-xs text-primary-content transition-transform duration-200"
|
|
123
|
+
title="Toggle Menu"
|
|
124
|
+
>
|
|
125
|
+
{isMobileMenuOpen ? <X size={18} /> : <FiMenu size={18} />}
|
|
126
|
+
</button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
{/* Mobile Dropdown Menu style from user's request */}
|
|
131
|
+
<AnimatePresence>
|
|
132
|
+
{isMobileMenuOpen && (
|
|
133
|
+
<motion.div
|
|
134
|
+
initial={{ opacity: 0, y: -40 }}
|
|
135
|
+
animate={{ opacity: 1, y: 0 }}
|
|
136
|
+
exit={{ opacity: 0, y: -40 }}
|
|
137
|
+
transition={{ duration: 0.3 }}
|
|
138
|
+
className="lg:hidden mt-3 bg-primary backdrop-blur-lg rounded-2xl shadow-xl border border-white/20 overflow-hidden text-primary-content absolute w-full"
|
|
139
|
+
>
|
|
140
|
+
<div className="p-4 space-y-2">
|
|
141
|
+
{/* Dynamic Navigation Links */}
|
|
142
|
+
{navigation.map((item) => (
|
|
143
|
+
<Link
|
|
144
|
+
key={item.path}
|
|
145
|
+
to={item.path}
|
|
146
|
+
onClick={() => setIsMobilemenuOpen(false)}
|
|
147
|
+
className={`block px-4 py-3 rounded-xl hover:bg-white/10 transition-colors font-semibold ${
|
|
148
|
+
location === item.path ? "bg-white/15 text-white" : "text-white/80"
|
|
149
|
+
}`}
|
|
150
|
+
>
|
|
151
|
+
{item.title}
|
|
152
|
+
</Link>
|
|
153
|
+
))}
|
|
154
|
+
|
|
155
|
+
{/* Theme Toggle */}
|
|
156
|
+
<button
|
|
157
|
+
onClick={toggleTheme}
|
|
158
|
+
className="w-full px-4 py-3 rounded-xl hover:bg-white/10 transition-colors flex items-center gap-3 font-semibold text-white/90"
|
|
159
|
+
>
|
|
160
|
+
<span className="p-2 rounded-lg bg-white/10">
|
|
161
|
+
{theme === "dark" ? <Sun size={16} /> : <Moon size={16} />}
|
|
162
|
+
</span>
|
|
163
|
+
<span>{theme === "dark" ? "Light Mode" : "Dark Mode"}</span>
|
|
164
|
+
</button>
|
|
165
|
+
|
|
166
|
+
{/* Language (Mock Selector matching user design layout) */}
|
|
167
|
+
<button className="w-full px-4 py-3 rounded-xl hover:bg-white/10 transition-colors flex items-center gap-3 font-semibold text-white/90">
|
|
168
|
+
<span className="p-2 rounded-lg bg-white/10">
|
|
169
|
+
<Globe size={16} />
|
|
170
|
+
</span>
|
|
171
|
+
<span>English</span>
|
|
172
|
+
</button>
|
|
173
|
+
|
|
174
|
+
{/* Auth Buttons */}
|
|
175
|
+
{!user ? (
|
|
176
|
+
<div className="pt-4 mt-4 border-t border-white/10 space-y-2">
|
|
177
|
+
<button
|
|
178
|
+
onClick={() => {
|
|
179
|
+
navigate("/login");
|
|
180
|
+
setIsMobilemenuOpen(false);
|
|
181
|
+
}}
|
|
182
|
+
className="w-full px-4 py-3 bg-white/10 border border-white/20 text-white font-semibold rounded-xl hover:bg-white/20 transition-all"
|
|
183
|
+
>
|
|
184
|
+
Login
|
|
185
|
+
</button>
|
|
186
|
+
|
|
187
|
+
<button
|
|
188
|
+
onClick={() => {
|
|
189
|
+
navigate("/login");
|
|
190
|
+
setIsMobilemenuOpen(false);
|
|
191
|
+
}}
|
|
192
|
+
className="w-full px-4 py-3 bg-white text-primary font-semibold rounded-xl hover:bg-white/90 transition-all"
|
|
193
|
+
>
|
|
194
|
+
Register
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
197
|
+
) : (
|
|
198
|
+
<div className="pt-4 mt-4 border-t border-white/10 space-y-2">
|
|
199
|
+
<div className="flex items-center gap-3 bg-white/10 p-3 rounded-xl border border-white/15">
|
|
200
|
+
<img
|
|
201
|
+
src={`https://placehold.co/100x100?text=${getInitials(user.name)}`}
|
|
202
|
+
className="w-10 h-10 rounded-full border border-white/20 shrink-0"
|
|
203
|
+
alt="avatar"
|
|
204
|
+
/>
|
|
205
|
+
<div className="text-left">
|
|
206
|
+
<div className="font-bold text-sm text-white">{user.name}</div>
|
|
207
|
+
<div className="text-xs text-white/70 truncate max-w-[180px]">{user.email}</div>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
<button
|
|
211
|
+
onClick={() => {
|
|
212
|
+
setIsMobilemenuOpen(false);
|
|
213
|
+
navigate("/profile");
|
|
214
|
+
}}
|
|
215
|
+
className="w-full px-4 py-3 bg-white text-primary font-semibold rounded-xl hover:bg-white/90 transition-all"
|
|
216
|
+
>
|
|
217
|
+
Profile
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
</motion.div>
|
|
223
|
+
)}
|
|
224
|
+
</AnimatePresence>
|
|
225
|
+
</div>
|
|
226
|
+
</header>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export default Header;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FiMenu } from "react-icons/fi";
|
|
2
|
+
import { useUiStore } from "../../store/useUiStore";
|
|
3
|
+
|
|
4
|
+
const SidebarHeader = ({ title = "Dashboard", actions = null }) => {
|
|
5
|
+
const { toggleSidebar } = useUiStore();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<header className="sticky top-0 z-30 h-16 bg-base-200 backdrop-blur border-b border-base-300 flex items-center justify-between px-4 lg:px-6">
|
|
9
|
+
<div className="flex items-center gap-3">
|
|
10
|
+
<button
|
|
11
|
+
onClick={toggleSidebar}
|
|
12
|
+
className="btn btn-square border-none bg-base-200 shadow-none text-base-content lg:hidden"
|
|
13
|
+
>
|
|
14
|
+
<FiMenu size={22} />
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<h1 className="text-xl font-bold">{title}</h1>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div className="flex items-center gap-2">
|
|
21
|
+
{actions}
|
|
22
|
+
</div>
|
|
23
|
+
</header>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default SidebarHeader;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { NavLink } from "react-router-dom";
|
|
2
|
+
import { IoClose } from "react-icons/io5";
|
|
3
|
+
import { useUiStore } from "../../store/useUiStore";
|
|
4
|
+
import { navigation } from "../../config/navigation";
|
|
5
|
+
import { ChevronLeft, ChevronRight, Moon, Sun } from "lucide-react";
|
|
6
|
+
import appConfig from "../../config/appConfig";
|
|
7
|
+
import { motion, AnimatePresence } from "framer-motion";
|
|
8
|
+
import useWindowSize from "../../hooks/useWindowSize";
|
|
9
|
+
|
|
10
|
+
const Sidebar = () => {
|
|
11
|
+
const { open, close, collapsed, toggleCollapsed } = useUiStore();
|
|
12
|
+
const { theme, toggleTheme } = useUiStore();
|
|
13
|
+
const { width } = useWindowSize();
|
|
14
|
+
const isMobile = width < 1024; // lg breakpoint
|
|
15
|
+
|
|
16
|
+
const showSidebar = !isMobile || open;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
{/* Overlay with AnimatePresence */}
|
|
21
|
+
<AnimatePresence>
|
|
22
|
+
{isMobile && open && (
|
|
23
|
+
<motion.div
|
|
24
|
+
initial={{ opacity: 0 }}
|
|
25
|
+
animate={{ opacity: 1 }}
|
|
26
|
+
exit={{ opacity: 0 }}
|
|
27
|
+
transition={{ duration: 0.2 }}
|
|
28
|
+
className="fixed inset-0 bg-base-100/40 z-40 lg:hidden"
|
|
29
|
+
onClick={close}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
</AnimatePresence>
|
|
33
|
+
|
|
34
|
+
{/* Sidebar with AnimatePresence */}
|
|
35
|
+
<AnimatePresence>
|
|
36
|
+
{showSidebar && (
|
|
37
|
+
<motion.aside
|
|
38
|
+
initial={isMobile ? { x: "-100%" } : false}
|
|
39
|
+
animate={{ x: 0 }}
|
|
40
|
+
exit={isMobile ? { x: "-100%" } : undefined}
|
|
41
|
+
transition={{ type: "tween", duration: 0.25, ease: "easeInOut" }}
|
|
42
|
+
className={`
|
|
43
|
+
fixed lg:static top-0 left-0 z-50
|
|
44
|
+
h-screen bg-base-200 border-r border-base-300
|
|
45
|
+
flex flex-col overflow-hidden
|
|
46
|
+
transition-[width] duration-300
|
|
47
|
+
${collapsed ? "w-20" : "w-[75%] md:w-[16%] md:max-w-60"}
|
|
48
|
+
`}
|
|
49
|
+
>
|
|
50
|
+
{/* Header */}
|
|
51
|
+
<div className="h-16 border-b border-base-300 flex items-center justify-between px-5">
|
|
52
|
+
<div className="flex items-center gap-3">
|
|
53
|
+
{appConfig.app.img ? (
|
|
54
|
+
<img
|
|
55
|
+
src={appConfig.app.img}
|
|
56
|
+
alt=""
|
|
57
|
+
className="w-8 h-8 rounded-lg"
|
|
58
|
+
/>
|
|
59
|
+
) : (
|
|
60
|
+
<div className="flex items-center">
|
|
61
|
+
<div className="bg-primary w-8 h-8 rounded-lg flex items-center justify-center text-primary-content font-bold">
|
|
62
|
+
{appConfig.app.name.charAt(0)}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
)}
|
|
66
|
+
<h1
|
|
67
|
+
className={`text-xl font-black text-primary whitespace-nowrap overflow-hidden ${collapsed ? "hidden" : ""}`}
|
|
68
|
+
>
|
|
69
|
+
{appConfig.app.name}
|
|
70
|
+
</h1>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<button
|
|
74
|
+
className={`btn btn-sm btn-circle btn-ghost md:hidden ${collapsed ? "hidden" : ""}`}
|
|
75
|
+
onClick={close}
|
|
76
|
+
>
|
|
77
|
+
<IoClose size={20} />
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
{/* Navigation */}
|
|
82
|
+
<nav className="flex-1 overflow-y-auto p-2.5 space-y-1" data-lenis-prevent>
|
|
83
|
+
{navigation.map((item) => {
|
|
84
|
+
const Icon = item.icon;
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<NavLink
|
|
88
|
+
key={item.path}
|
|
89
|
+
to={item.path}
|
|
90
|
+
onClick={isMobile ? close : undefined}
|
|
91
|
+
className={({ isActive }) =>
|
|
92
|
+
`flex items-center gap-3 rounded-box px-4 py-3 transition-all h-12
|
|
93
|
+
${
|
|
94
|
+
isActive
|
|
95
|
+
? "bg-primary text-primary-content"
|
|
96
|
+
: "hover:bg-base-300"
|
|
97
|
+
} ${collapsed ? "justify-center px-0" : ""}`
|
|
98
|
+
}
|
|
99
|
+
title={collapsed ? item.title : ""}
|
|
100
|
+
>
|
|
101
|
+
<Icon
|
|
102
|
+
size={18}
|
|
103
|
+
className={`shrink-0 ${collapsed && "mr-auto"}`}
|
|
104
|
+
/>
|
|
105
|
+
|
|
106
|
+
{!collapsed && (
|
|
107
|
+
<span className="font-medium transition-all duration-300">
|
|
108
|
+
{item.title}
|
|
109
|
+
</span>
|
|
110
|
+
)}
|
|
111
|
+
</NavLink>
|
|
112
|
+
);
|
|
113
|
+
})}
|
|
114
|
+
</nav>
|
|
115
|
+
|
|
116
|
+
{/* Footer with Collapse Button */}
|
|
117
|
+
<button
|
|
118
|
+
onClick={toggleTheme}
|
|
119
|
+
className={`w-full flex items-center gap-3 px-3 py-2.5 md:px-4 text-sm font-semibold transition-all duration-150 text-base-content/60 hover:text-base-content hover:bg-base-300/60 justify-between rounded-none ${collapsed ? "justify-center" : ""}`}
|
|
120
|
+
title="Toggle Theme"
|
|
121
|
+
>
|
|
122
|
+
{!collapsed && <span>{theme === "dark" ? "Dark" : "Light"}</span>}
|
|
123
|
+
<span className="btn btn-xs btn-ghost btn-circle ">
|
|
124
|
+
{theme === "dark" ? (
|
|
125
|
+
<Sun size={16} className="shrink-0 " />
|
|
126
|
+
) : (
|
|
127
|
+
<Moon size={16} className="shrink-0" />
|
|
128
|
+
)}
|
|
129
|
+
</span>
|
|
130
|
+
</button>
|
|
131
|
+
<div className="p-3 border-t border-base-300/50 shrink-0 flex flex-col gap-2">
|
|
132
|
+
<button
|
|
133
|
+
onClick={toggleCollapsed}
|
|
134
|
+
className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-semibold transition-all duration-150 text-base-content/60 hover:text-base-content hover:bg-base-300/60 ${collapsed ? "justify-center" : ""}`}
|
|
135
|
+
title={collapsed ? "Expand Sidebar" : "Collapse Sidebar"}
|
|
136
|
+
>
|
|
137
|
+
{collapsed ? (
|
|
138
|
+
<ChevronRight size={18} className="shrink-0 mr-auto" />
|
|
139
|
+
) : (
|
|
140
|
+
<ChevronLeft size={18} className="shrink-0" />
|
|
141
|
+
)}
|
|
142
|
+
{!collapsed && <span className="truncate">Collapse</span>}
|
|
143
|
+
</button>
|
|
144
|
+
</div>
|
|
145
|
+
</motion.aside>
|
|
146
|
+
)}
|
|
147
|
+
</AnimatePresence>
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export default Sidebar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export const api = axios.create({
|
|
4
|
+
baseURL: import.meta.env.VITE_API_URL || "http://localhost:5001/api",
|
|
5
|
+
withCredentials: true, // send httpOnly cookies on every request
|
|
6
|
+
headers: {
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
api.interceptors.request.use(
|
|
12
|
+
(config) => {
|
|
13
|
+
const token = localStorage.getItem("token");
|
|
14
|
+
if (token) {
|
|
15
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
16
|
+
}
|
|
17
|
+
return config;
|
|
18
|
+
},
|
|
19
|
+
(error) => {
|
|
20
|
+
return Promise.reject(error);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const appConfig = {
|
|
2
|
+
app: {
|
|
3
|
+
name: "React App",
|
|
4
|
+
logo: "./logo.png",
|
|
5
|
+
shortName: "React",
|
|
6
|
+
description: "A React application built with @imksh/create",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
author: "Karan Sharma",
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
api: {
|
|
12
|
+
baseURL: import.meta.env.VITE_API_URL,
|
|
13
|
+
timeout: 30000,
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
routes: {
|
|
17
|
+
home: "/",
|
|
18
|
+
login: "/login",
|
|
19
|
+
profile: "/profile",
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
pagination: {
|
|
23
|
+
pageSize: 10,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
github: {
|
|
27
|
+
repository: "",
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
social: {
|
|
31
|
+
website: "",
|
|
32
|
+
linkedin: "",
|
|
33
|
+
github: "",
|
|
34
|
+
twitter: "",
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
features: {
|
|
38
|
+
darkMode: true,
|
|
39
|
+
notifications: true,
|
|
40
|
+
sidebar: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default appConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import Lenis from "lenis";
|
|
3
|
+
|
|
4
|
+
const useLenis = () => {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const lenis = new Lenis({
|
|
7
|
+
duration: 1.1, // reduce
|
|
8
|
+
easing: (t) => 1 - Math.pow(1 - t, 3),
|
|
9
|
+
smooth: true,
|
|
10
|
+
smoothTouch: false,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
let rafId;
|
|
14
|
+
const raf = (time) => {
|
|
15
|
+
lenis.raf(time);
|
|
16
|
+
rafId = requestAnimationFrame(raf);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
rafId = requestAnimationFrame(raf);
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
cancelAnimationFrame(rafId);
|
|
23
|
+
lenis.destroy();
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default useLenis;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
const usePwaInstall = () => {
|
|
4
|
+
const [canInstall, setCanInstall] = useState(false);
|
|
5
|
+
const [isInstalled, setIsInstalled] = useState(false);
|
|
6
|
+
const [deferredPrompt, setDeferredPrompt] = useState(null);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const handleBeforeInstallPrompt = (e) => {
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
setDeferredPrompt(e);
|
|
12
|
+
setCanInstall(true);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const handleAppInstalled = () => {
|
|
16
|
+
setIsInstalled(true);
|
|
17
|
+
setCanInstall(false);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.addEventListener("beforeinstallprompt", handleBeforeInstallPrompt);
|
|
21
|
+
window.addEventListener("appinstalled", handleAppInstalled);
|
|
22
|
+
|
|
23
|
+
if (window.matchMedia("(display-mode: standalone)").matches) {
|
|
24
|
+
setIsInstalled(true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener("beforeinstallprompt", handleBeforeInstallPrompt);
|
|
29
|
+
window.removeEventListener("appinstalled", handleAppInstalled);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
const promptInstall = async () => {
|
|
34
|
+
if (!deferredPrompt) return null;
|
|
35
|
+
deferredPrompt.prompt();
|
|
36
|
+
const choiceResult = await deferredPrompt.userChoice;
|
|
37
|
+
setDeferredPrompt(null);
|
|
38
|
+
setCanInstall(false);
|
|
39
|
+
return choiceResult;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return { canInstall, isInstalled, promptInstall };
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default usePwaInstall;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
const useWindowSize = () => {
|
|
4
|
+
const [size, setSize] = useState({
|
|
5
|
+
width: window.innerWidth,
|
|
6
|
+
height: window.innerHeight,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const handleResize = () => {
|
|
12
|
+
setSize({
|
|
13
|
+
width: window.innerWidth,
|
|
14
|
+
height: window.innerHeight,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
window.addEventListener("resize", handleResize);
|
|
19
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return size;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default useWindowSize;
|