@imksh/create 1.0.24 → 1.0.26
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/package.json +1 -1
- package/src/commands/create.js +2 -1
- package/src/index.js +1 -1
- package/src/utils/askTemplate.js +1 -0
- package/templates/mern-react-native/client/src/vite-env.d.ts +1 -0
- package/templates/mern-react-native/mobile/_gitignore +43 -0
- package/templates/mern-react-native/mobile/babel.config.js +1 -0
- package/templates/mern-react-native/mobile/drizzle.config.ts +8 -0
- package/templates/mern-react-native/mobile/expo-env.d.ts +3 -0
- package/templates/mern-react-native/mobile/package.json +8 -1
- package/templates/mern-react-native/mobile/src/app/(auth)/_layout.tsx +12 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/change-password.tsx +112 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/edit-profile.tsx +156 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/forgot-password.tsx +191 -0
- package/templates/mern-react-native/mobile/src/app/{login.tsx → (auth)/login.tsx} +69 -21
- package/templates/mern-react-native/mobile/src/app/(tabs)/dashboard.tsx +2 -2
- package/templates/mern-react-native/mobile/src/app/(tabs)/index.tsx +18 -17
- package/templates/mern-react-native/mobile/src/app/(tabs)/profile.tsx +23 -60
- package/templates/mern-react-native/mobile/src/app/(tabs)/search.tsx +2 -2
- package/templates/mern-react-native/mobile/src/app/_layout.tsx +22 -4
- package/templates/mern-react-native/mobile/src/components/common/AnimatedHeader.tsx +328 -0
- package/templates/mern-react-native/mobile/src/components/common/LocationLoader.tsx +591 -0
- package/templates/mern-react-native/mobile/src/components/common/ScreenHeader.tsx +41 -17
- package/templates/mern-react-native/mobile/src/components/common/TabHeader.tsx +58 -0
- package/templates/mern-react-native/mobile/src/components/common/Typography.tsx +49 -30
- package/templates/mern-react-native/mobile/src/components/common/Welcome.tsx +2 -2
- package/templates/mern-react-native/mobile/src/components/ui/BottomModal.tsx +31 -20
- package/templates/mern-react-native/mobile/src/components/ui/ClassicTabBar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/CustomTabBar.tsx +108 -71
- package/templates/mern-react-native/mobile/src/components/ui/Sidebar.tsx +81 -56
- package/templates/mern-react-native/mobile/src/components/ui/buttons/Button.tsx +106 -37
- package/templates/mern-react-native/mobile/src/components/ui/buttons/IconButton.tsx +4 -2
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Accordion.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Avatar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Badge.tsx +45 -17
- package/templates/mern-react-native/mobile/src/components/ui/data-display/ImageViewer.tsx +19 -9
- package/templates/mern-react-native/mobile/src/components/ui/feedback/CircularProgress.tsx +5 -4
- package/templates/mern-react-native/mobile/src/components/ui/feedback/ProgressBar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/feedback/Skeleton.tsx +3 -0
- package/templates/mern-react-native/mobile/src/components/ui/feedback/Spinner.tsx +11 -3
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Checkbox.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/DatePicker.tsx +186 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Input.tsx +54 -14
- package/templates/mern-react-native/mobile/src/components/ui/inputs/LocationPicker.tsx +211 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/OTPInput.tsx +32 -9
- package/templates/mern-react-native/mobile/src/components/ui/inputs/PasswordInput.tsx +2 -1
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Radio.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/SearchBar.tsx +41 -4
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Slider.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Switch.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/TextArea.tsx +2 -1
- package/templates/mern-react-native/mobile/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
- package/templates/mern-react-native/mobile/src/components/ui/layout/Grid.tsx +52 -10
- package/templates/mern-react-native/mobile/src/components/ui/layout/Section.tsx +7 -8
- package/templates/mern-react-native/mobile/src/components/ui/navigation/Pagination.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/navigation/ProgressStepper.tsx +6 -5
- package/templates/mern-react-native/mobile/src/components/ui/navigation/Tabs.tsx +30 -4
- package/templates/mern-react-native/mobile/src/config/api.ts +12 -1
- package/templates/mern-react-native/mobile/src/config/sidebar.config.ts +12 -0
- package/templates/mern-react-native/mobile/src/config/tabNavigation.ts +1 -1
- package/templates/mern-react-native/mobile/src/db/index.ts +9 -0
- package/templates/mern-react-native/mobile/src/db/schema.ts +14 -0
- package/templates/mern-react-native/mobile/src/hooks/useDebounce.ts +17 -0
- package/templates/mern-react-native/mobile/src/services/notification.service.ts +22 -0
- package/templates/mern-react-native/mobile/src/services/socket.service.ts +36 -0
- package/templates/mern-react-native/mobile/src/store/useAuthStore.ts +122 -27
- package/templates/mern-react-native/mobile/src/store/useNotificationStore.ts +178 -0
- package/templates/mern-react-native/mobile/src/types/auth.type.ts +14 -0
- package/templates/mern-react-native/mobile/tsconfig.json +1 -0
- package/templates/mern-ts/client/src/vite-env.d.ts +1 -0
- package/templates/next/next.config.mjs +1 -0
- package/templates/next/package.json +10 -9
- package/templates/next/postcss.config.js +5 -0
- package/templates/next/src/app/layout.js +1 -0
- package/templates/next/src/app/page.js +1 -1
- package/templates/next/src/components/layout/ProtectedRoute.jsx +3 -3
- package/templates/next/src/index.css +1 -0
- package/templates/next/src/store/useUiStore.js +13 -7
- package/templates/next-ts/.env.example +0 -0
- package/templates/next-ts/AGENTS.md +37 -0
- package/templates/next-ts/CLAUDE.md +1 -0
- package/templates/next-ts/_gitignore +0 -24
- package/templates/next-ts/next-env.d.ts +3 -1
- package/templates/next-ts/next.config.mjs +1 -0
- package/templates/next-ts/package.json +13 -12
- package/templates/next-ts/postcss.config.js +5 -0
- package/templates/next-ts/public/logo.png +0 -0
- package/templates/next-ts/src/app/error.tsx +41 -0
- package/templates/next-ts/src/app/layout.tsx +2 -1
- package/templates/next-ts/src/app/not-found.tsx +5 -0
- package/templates/next-ts/src/app/page.tsx +1 -1
- package/templates/next-ts/src/components/layout/ProtectedRoute.tsx +3 -3
- package/templates/next-ts/src/components/ui/Button.tsx +63 -0
- package/templates/next-ts/src/components/ui/Input.tsx +79 -0
- package/templates/next-ts/src/index.css +1 -0
- package/templates/next-ts/src/store/useUiStore.ts +13 -7
- package/templates/next-ts/tsconfig.json +19 -5
- package/templates/production-fullstack/client/index.html +14 -0
- package/templates/production-fullstack/client/package.json +47 -0
- package/templates/production-fullstack/client/public/_redirects +1 -0
- package/templates/production-fullstack/client/public/favicon.ico +0 -0
- package/templates/production-fullstack/client/public/favicon.svg +1 -0
- package/templates/production-fullstack/client/public/logo.png +0 -0
- package/templates/production-fullstack/client/public/manifest.json +24 -0
- package/templates/production-fullstack/client/public/sw.js +56 -0
- package/templates/production-fullstack/client/src/App.tsx +68 -0
- package/templates/production-fullstack/client/src/assets/animations/loading.json +1 -0
- package/templates/production-fullstack/client/src/assets/data/navigation.ts +29 -0
- package/templates/production-fullstack/client/src/assets/images/logo.png +0 -0
- package/templates/production-fullstack/client/src/components/layout/ProtectedRoute.tsx +23 -0
- package/templates/production-fullstack/client/src/components/layout/PublicLayout.tsx +13 -0
- package/templates/production-fullstack/client/src/components/layout/SidebarLayout.tsx +37 -0
- package/templates/production-fullstack/client/src/components/shared/Breadcrumbs.tsx +27 -0
- package/templates/production-fullstack/client/src/components/shared/LottieIcon.tsx +36 -0
- package/templates/production-fullstack/client/src/components/shared/NotFound.tsx +78 -0
- package/templates/production-fullstack/client/src/components/shared/PwaInstallPrompt.tsx +72 -0
- package/templates/production-fullstack/client/src/components/shared/SEO.tsx +67 -0
- package/templates/production-fullstack/client/src/components/shared/Scroll.tsx +25 -0
- package/templates/production-fullstack/client/src/components/shared/Unauthorized.tsx +76 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/CardSkeleton.tsx +23 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/DashboardSkeleton.tsx +19 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/ListSkeleton.tsx +24 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/PageSkeleton.tsx +26 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/ProfileSkeleton.tsx +23 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/Skeleton.tsx +18 -0
- package/templates/production-fullstack/client/src/components/shared/skeletons/common/TableSkeleton.tsx +33 -0
- package/templates/production-fullstack/client/src/components/ui/ConfirmModal.tsx +152 -0
- package/templates/production-fullstack/client/src/components/ui/Header.tsx +230 -0
- package/templates/production-fullstack/client/src/components/ui/Loading.tsx +19 -0
- package/templates/production-fullstack/client/src/components/ui/Modal.tsx +106 -0
- package/templates/production-fullstack/client/src/components/ui/SidebarHeader.tsx +34 -0
- package/templates/production-fullstack/client/src/components/ui/Table.tsx +118 -0
- package/templates/production-fullstack/client/src/components/ui/ToggleSwitch.tsx +38 -0
- package/templates/production-fullstack/client/src/components/ui/sidebar.tsx +152 -0
- package/templates/production-fullstack/client/src/config/index.ts +44 -0
- package/templates/production-fullstack/client/src/constants/navigation.ts +14 -0
- package/templates/production-fullstack/client/src/features/auth/api/authService.ts +19 -0
- package/templates/production-fullstack/client/src/features/auth/pages/Login.tsx +233 -0
- package/templates/production-fullstack/client/src/features/auth/store/useAuthStore.ts +143 -0
- package/templates/production-fullstack/client/src/features/core/pages/Home.tsx +150 -0
- package/templates/production-fullstack/client/src/features/core/pages/Profile.tsx +9 -0
- package/templates/production-fullstack/client/src/hooks/useLenis.ts +28 -0
- package/templates/production-fullstack/client/src/hooks/usePwaInstall.ts +45 -0
- package/templates/production-fullstack/client/src/hooks/useWindowSize.ts +25 -0
- package/templates/production-fullstack/client/src/index.css +158 -0
- package/templates/production-fullstack/client/src/lib/axios.ts +22 -0
- package/templates/production-fullstack/client/src/lib/dayjs.ts +12 -0
- package/templates/production-fullstack/client/src/lib/query-client.ts +11 -0
- package/templates/production-fullstack/client/src/lib/socket.ts +6 -0
- package/templates/production-fullstack/client/src/main.tsx +28 -0
- package/templates/production-fullstack/client/src/store/useUiStore.ts +74 -0
- package/templates/production-fullstack/client/src/utils/formatDate.ts +19 -0
- package/templates/production-fullstack/client/src/utils/getInitials.ts +10 -0
- package/templates/production-fullstack/client/src/vite-env.d.ts +1 -0
- package/templates/production-fullstack/client/tsconfig.json +25 -0
- package/templates/production-fullstack/client/tsconfig.node.json +10 -0
- package/templates/production-fullstack/client/vite.config.ts +8 -0
- package/templates/production-fullstack/mobile/LICENSE +21 -0
- package/templates/production-fullstack/mobile/app.json +84 -0
- package/templates/production-fullstack/mobile/assets/animations/celebrate.json +1 -0
- package/templates/production-fullstack/mobile/assets/animations/infinity.json +1 -0
- package/templates/production-fullstack/mobile/assets/animations/loading.json +1 -0
- package/templates/production-fullstack/mobile/assets/fonts/Inter_Bold.ttf +0 -0
- package/templates/production-fullstack/mobile/assets/fonts/Inter_ExtraBold.ttf +0 -0
- package/templates/production-fullstack/mobile/assets/fonts/Inter_Medium.ttf +0 -0
- package/templates/production-fullstack/mobile/assets/fonts/Inter_Regular.ttf +0 -0
- package/templates/production-fullstack/mobile/assets/fonts/Inter_SemiBold.ttf +0 -0
- package/templates/production-fullstack/mobile/assets/images/logo/logo.png +0 -0
- package/templates/production-fullstack/mobile/assets/images/logo/logo.svg +1 -0
- package/templates/production-fullstack/mobile/assets/images/logo/logoWithBg.png +0 -0
- package/templates/production-fullstack/mobile/babel.config.js +13 -0
- package/templates/production-fullstack/mobile/drizzle.config.ts +8 -0
- package/templates/production-fullstack/mobile/eas.json +24 -0
- package/templates/production-fullstack/mobile/eslint.config.js +10 -0
- package/templates/production-fullstack/mobile/expo-env.d.ts +3 -0
- package/templates/production-fullstack/mobile/metro.config.js +6 -0
- package/templates/production-fullstack/mobile/nativewind-env.d.ts +3 -0
- package/templates/production-fullstack/mobile/package.json +89 -0
- package/templates/production-fullstack/mobile/src/app/(auth)/_layout.tsx +12 -0
- package/templates/production-fullstack/mobile/src/app/(auth)/change-password.tsx +112 -0
- package/templates/production-fullstack/mobile/src/app/(auth)/edit-profile.tsx +160 -0
- package/templates/production-fullstack/mobile/src/app/(auth)/forgot-password.tsx +191 -0
- package/templates/production-fullstack/mobile/src/app/(auth)/login.tsx +253 -0
- package/templates/production-fullstack/mobile/src/app/_layout.tsx +102 -0
- package/templates/production-fullstack/mobile/src/app/global.css +82 -0
- package/templates/production-fullstack/mobile/src/components/common/AnimatedHeader.tsx +328 -0
- package/templates/production-fullstack/mobile/src/components/common/ConfirmationToast.tsx +67 -0
- package/templates/production-fullstack/mobile/src/components/common/Loading.tsx +26 -0
- package/templates/production-fullstack/mobile/src/components/common/LocationLoader.tsx +591 -0
- package/templates/production-fullstack/mobile/src/components/common/ScreenHeader.tsx +68 -0
- package/templates/production-fullstack/mobile/src/components/common/TabHeader.tsx +58 -0
- package/templates/production-fullstack/mobile/src/components/common/Typography.tsx +113 -0
- package/templates/production-fullstack/mobile/src/components/common/Welcome.tsx +55 -0
- package/templates/production-fullstack/mobile/src/components/ui/BottomModal.tsx +159 -0
- package/templates/production-fullstack/mobile/src/components/ui/ClassicTabBar.tsx +129 -0
- package/templates/production-fullstack/mobile/src/components/ui/CustomTabBar.tsx +238 -0
- package/templates/production-fullstack/mobile/src/components/ui/Sidebar.tsx +258 -0
- package/templates/production-fullstack/mobile/src/components/ui/buttons/Button.tsx +180 -0
- package/templates/production-fullstack/mobile/src/components/ui/buttons/ButtonGroup.tsx +32 -0
- package/templates/production-fullstack/mobile/src/components/ui/buttons/FloatingActionButton.tsx +72 -0
- package/templates/production-fullstack/mobile/src/components/ui/buttons/IconButton.tsx +84 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/Accordion.tsx +82 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/Avatar.tsx +47 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/Badge.tsx +104 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/Card.tsx +36 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/Image.tsx +43 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/ImageViewer.tsx +33 -0
- package/templates/production-fullstack/mobile/src/components/ui/data-display/SwipeableRow.tsx +94 -0
- package/templates/production-fullstack/mobile/src/components/ui/feedback/CircularProgress.tsx +38 -0
- package/templates/production-fullstack/mobile/src/components/ui/feedback/GestureWrapper.tsx +114 -0
- package/templates/production-fullstack/mobile/src/components/ui/feedback/ProgressBar.tsx +51 -0
- package/templates/production-fullstack/mobile/src/components/ui/feedback/Skeleton.tsx +84 -0
- package/templates/production-fullstack/mobile/src/components/ui/feedback/Spinner.tsx +50 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/Checkbox.tsx +54 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/DatePicker.tsx +186 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/Input.tsx +158 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/LocationPicker.tsx +211 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/OTPInput.tsx +83 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/PasswordInput.tsx +16 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/Radio.tsx +54 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/SearchBar.tsx +53 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/Slider.tsx +49 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/Switch.tsx +75 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/TextArea.tsx +15 -0
- package/templates/production-fullstack/mobile/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Container.tsx +23 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Divider.tsx +20 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Grid.tsx +62 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/KeyboardAvoidingViewWrapper.tsx +16 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/ScrollContainer.tsx +21 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Section.tsx +51 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Spacer.tsx +6 -0
- package/templates/production-fullstack/mobile/src/components/ui/layout/Stack.tsx +34 -0
- package/templates/production-fullstack/mobile/src/components/ui/navigation/Pagination.tsx +61 -0
- package/templates/production-fullstack/mobile/src/components/ui/navigation/ProgressStepper.tsx +66 -0
- package/templates/production-fullstack/mobile/src/components/ui/navigation/Tabs.tsx +173 -0
- package/templates/production-fullstack/mobile/src/config/sidebar.config.ts +72 -0
- package/templates/production-fullstack/mobile/src/config/tabNavigation.ts +64 -0
- package/templates/production-fullstack/mobile/src/constants/Colors.ts +71 -0
- package/templates/production-fullstack/mobile/src/db/index.ts +9 -0
- package/templates/production-fullstack/mobile/src/db/schema.ts +14 -0
- package/templates/production-fullstack/mobile/src/features/auth/api/auth.service.ts +35 -0
- package/templates/production-fullstack/mobile/src/features/auth/store/useAuthStore.ts +273 -0
- package/templates/production-fullstack/mobile/src/features/auth/types/auth.type.ts +14 -0
- package/templates/production-fullstack/mobile/src/hooks/useDebounce.ts +17 -0
- package/templates/production-fullstack/mobile/src/lib/axios.ts +27 -0
- package/templates/production-fullstack/mobile/src/lib/query-client.ts +11 -0
- package/templates/production-fullstack/mobile/src/lib/socket.ts +36 -0
- package/templates/production-fullstack/mobile/src/lib/storage.ts +55 -0
- package/templates/production-fullstack/mobile/src/services/permission.service.ts +214 -0
- package/templates/production-fullstack/mobile/src/store/localStore.ts +7 -0
- package/templates/production-fullstack/mobile/src/store/useNotificationStore.ts +53 -0
- package/templates/production-fullstack/mobile/src/types/common.type.ts +6 -0
- package/templates/production-fullstack/mobile/src/types/images.d.ts +24 -0
- package/templates/production-fullstack/mobile/src/utils/toast.ts +26 -0
- package/templates/production-fullstack/mobile/tailwind.config.js +71 -0
- package/templates/production-fullstack/mobile/tsconfig.json +23 -0
- package/templates/production-fullstack/server/.env.example +63 -0
- package/templates/production-fullstack/server/README.md +75 -0
- package/templates/production-fullstack/server/eslint.config.js +13 -0
- package/templates/production-fullstack/server/package.json +58 -0
- package/templates/production-fullstack/server/prisma/schema/core/attachment.prisma +14 -0
- package/templates/production-fullstack/server/prisma/schema/core/notification.prisma +18 -0
- package/templates/production-fullstack/server/prisma/schema/core/permission.prisma +26 -0
- package/templates/production-fullstack/server/prisma/schema/core/role.prisma +25 -0
- package/templates/production-fullstack/server/prisma/schema/core/user.prisma +56 -0
- package/templates/production-fullstack/server/prisma/schema/enums/common.prisma +13 -0
- package/templates/production-fullstack/server/prisma/schema/enums/notification.prisma +6 -0
- package/templates/production-fullstack/server/prisma/schema/enums/user.prisma +11 -0
- package/templates/production-fullstack/server/prisma/schema/schema.prisma +7 -0
- package/templates/production-fullstack/server/prisma.config.ts +14 -0
- package/templates/production-fullstack/server/src/app.ts +36 -0
- package/templates/production-fullstack/server/src/common/middlewares/auth.middleware.ts +45 -0
- package/templates/production-fullstack/server/src/common/middlewares/errorHandler.ts +16 -0
- package/templates/production-fullstack/server/src/common/middlewares/multer.ts +20 -0
- package/templates/production-fullstack/server/src/common/middlewares/rateLimiter.ts +53 -0
- package/templates/production-fullstack/server/src/common/services/email.service.ts +28 -0
- package/templates/production-fullstack/server/src/common/services/push.service.ts +65 -0
- package/templates/production-fullstack/server/src/common/services/storage.service.ts +9 -0
- package/templates/production-fullstack/server/src/common/types/express.d.ts +10 -0
- package/templates/production-fullstack/server/src/common/utils/cloudinaryUpload.ts +44 -0
- package/templates/production-fullstack/server/src/common/utils/emailOtp.ts +30 -0
- package/templates/production-fullstack/server/src/common/utils/genOtpToken.ts +22 -0
- package/templates/production-fullstack/server/src/common/utils/generateVapidKeys.ts +12 -0
- package/templates/production-fullstack/server/src/common/utils/jwt.ts +27 -0
- package/templates/production-fullstack/server/src/common/utils/pushHelper.ts +22 -0
- package/templates/production-fullstack/server/src/config/env.ts +2 -0
- package/templates/production-fullstack/server/src/config/logger.ts +58 -0
- package/templates/production-fullstack/server/src/config/prisma.ts +26 -0
- package/templates/production-fullstack/server/src/features/attachments/upload.controller.ts +22 -0
- package/templates/production-fullstack/server/src/features/attachments/upload.routes.ts +11 -0
- package/templates/production-fullstack/server/src/features/auth/auth.controller.ts +124 -0
- package/templates/production-fullstack/server/src/features/auth/auth.routes.ts +22 -0
- package/templates/production-fullstack/server/src/features/auth/auth.service.ts +155 -0
- package/templates/production-fullstack/server/src/features/notifications/push.controller.ts +55 -0
- package/templates/production-fullstack/server/src/features/notifications/push.routes.ts +11 -0
- package/templates/production-fullstack/server/src/index.ts +17 -0
- package/templates/production-fullstack/server/src/routes/index.ts +12 -0
- package/templates/production-fullstack/server/src/sockets/auth.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/connection.ts +31 -0
- package/templates/production-fullstack/server/src/sockets/emitters/assignment.emitter.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/emitters/attendance.emitter.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/emitters/exam.emitter.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/emitters/notification.emitter.ts +17 -0
- package/templates/production-fullstack/server/src/sockets/events.ts +27 -0
- package/templates/production-fullstack/server/src/sockets/handlers/attendance.handler.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/handlers/chat.handler.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/handlers/index.ts +15 -0
- package/templates/production-fullstack/server/src/sockets/handlers/lms.handler.ts +0 -0
- package/templates/production-fullstack/server/src/sockets/handlers/notification.handler.ts +39 -0
- package/templates/production-fullstack/server/src/sockets/index.ts +39 -0
- package/templates/production-fullstack/server/src/sockets/middleware.ts +54 -0
- package/templates/production-fullstack/server/src/sockets/rooms.ts +11 -0
- package/templates/production-fullstack/server/src/sockets/types.ts +32 -0
- package/templates/production-fullstack/server/tsconfig.json +14 -0
- package/templates/react-native/babel.config.js +1 -0
- package/templates/react-native/drizzle.config.ts +8 -0
- package/templates/react-native/package.json +8 -1
- package/templates/react-native/src/app/(auth)/_layout.tsx +12 -0
- package/templates/react-native/src/app/(auth)/change-password.tsx +112 -0
- package/templates/react-native/src/app/(auth)/edit-profile.tsx +156 -0
- package/templates/react-native/src/app/(auth)/forgot-password.tsx +191 -0
- package/templates/react-native/src/app/{login.tsx → (auth)/login.tsx} +69 -21
- package/templates/react-native/src/app/(tabs)/dashboard.tsx +2 -2
- package/templates/react-native/src/app/(tabs)/index.tsx +18 -17
- package/templates/react-native/src/app/(tabs)/profile.tsx +23 -60
- package/templates/react-native/src/app/(tabs)/search.tsx +2 -2
- package/templates/react-native/src/app/_layout.tsx +22 -4
- package/templates/react-native/src/components/common/AnimatedHeader.tsx +328 -0
- package/templates/react-native/src/components/common/LocationLoader.tsx +591 -0
- package/templates/react-native/src/components/common/ScreenHeader.tsx +41 -17
- package/templates/react-native/src/components/common/TabHeader.tsx +58 -0
- package/templates/react-native/src/components/common/Typography.tsx +49 -30
- package/templates/react-native/src/components/common/Welcome.tsx +2 -2
- package/templates/react-native/src/components/ui/BottomModal.tsx +31 -20
- package/templates/react-native/src/components/ui/ClassicTabBar.tsx +4 -3
- package/templates/react-native/src/components/ui/CustomTabBar.tsx +108 -71
- package/templates/react-native/src/components/ui/Sidebar.tsx +81 -56
- package/templates/react-native/src/components/ui/buttons/Button.tsx +106 -37
- package/templates/react-native/src/components/ui/buttons/IconButton.tsx +4 -2
- package/templates/react-native/src/components/ui/data-display/Accordion.tsx +3 -2
- package/templates/react-native/src/components/ui/data-display/Avatar.tsx +4 -3
- package/templates/react-native/src/components/ui/data-display/Badge.tsx +45 -17
- package/templates/react-native/src/components/ui/data-display/ImageViewer.tsx +19 -9
- package/templates/react-native/src/components/ui/feedback/CircularProgress.tsx +5 -4
- package/templates/react-native/src/components/ui/feedback/ProgressBar.tsx +4 -3
- package/templates/react-native/src/components/ui/feedback/Skeleton.tsx +3 -0
- package/templates/react-native/src/components/ui/feedback/Spinner.tsx +11 -3
- package/templates/react-native/src/components/ui/inputs/Checkbox.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/DatePicker.tsx +186 -0
- package/templates/react-native/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
- package/templates/react-native/src/components/ui/inputs/Input.tsx +54 -14
- package/templates/react-native/src/components/ui/inputs/LocationPicker.tsx +211 -0
- package/templates/react-native/src/components/ui/inputs/OTPInput.tsx +32 -9
- package/templates/react-native/src/components/ui/inputs/PasswordInput.tsx +2 -1
- package/templates/react-native/src/components/ui/inputs/Radio.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/SearchBar.tsx +41 -4
- package/templates/react-native/src/components/ui/inputs/Slider.tsx +4 -3
- package/templates/react-native/src/components/ui/inputs/Switch.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/TextArea.tsx +2 -1
- package/templates/react-native/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
- package/templates/react-native/src/components/ui/layout/Grid.tsx +52 -10
- package/templates/react-native/src/components/ui/layout/Section.tsx +7 -8
- package/templates/react-native/src/components/ui/navigation/Pagination.tsx +4 -3
- package/templates/react-native/src/components/ui/navigation/ProgressStepper.tsx +6 -5
- package/templates/react-native/src/components/ui/navigation/Tabs.tsx +30 -4
- package/templates/react-native/src/config/api.ts +12 -1
- package/templates/react-native/src/config/sidebar.config.ts +12 -0
- package/templates/react-native/src/config/tabNavigation.ts +1 -1
- package/templates/react-native/src/db/index.ts +9 -0
- package/templates/react-native/src/db/schema.ts +14 -0
- package/templates/react-native/src/hooks/useDebounce.ts +17 -0
- package/templates/react-native/src/services/notification.service.ts +22 -0
- package/templates/react-native/src/services/socket.service.ts +36 -0
- package/templates/react-native/src/store/useAuthStore.ts +122 -27
- package/templates/react-native/src/store/useNotificationStore.ts +178 -0
- package/templates/react-native/src/types/auth.type.ts +14 -0
- package/templates/react-native/tsconfig.json +1 -0
- package/templates/react-ts/src/vite-env.d.ts +1 -0
- package/templates/mern-react-native/mobile/.env.example +0 -2
- package/templates/mern-react-native/mobile/.vscode/extensions.json +0 -1
- package/templates/mern-react-native/mobile/.vscode/settings.json +0 -7
- package/templates/mern-react-native/mobile/README.md +0 -159
- package/templates/mern-react-native/mobile/docs/README.md +0 -17
- package/templates/mern-react-native/mobile/docs/components/buttons.md +0 -40
- package/templates/mern-react-native/mobile/docs/components/data-display.md +0 -44
- package/templates/mern-react-native/mobile/docs/components/feedback.md +0 -36
- package/templates/mern-react-native/mobile/docs/components/gestures.md +0 -60
- package/templates/mern-react-native/mobile/docs/components/inputs.md +0 -41
- package/templates/mern-react-native/mobile/docs/components/layout.md +0 -34
- package/templates/mern-react-native/mobile/docs/components/navigation.md +0 -31
- package/templates/mern-react-native/mobile/docs/features.md +0 -85
- package/templates/mern-react-native/mobile/docs/getting-started.md +0 -47
- package/templates/mern-react-native/mobile/src/components/common/HomeHeader.tsx +0 -43
- package/templates/mern-react-native/mobile/src/components/settings/SettingToggle.tsx +0 -26
- package/templates/mern-react-native/mobile/src/components/settings/SettingsOptions.tsx +0 -47
- package/templates/react-native/.env.example +0 -2
- package/templates/react-native/.vscode/extensions.json +0 -1
- package/templates/react-native/.vscode/settings.json +0 -7
- package/templates/react-native/README.md +0 -159
- package/templates/react-native/docs/README.md +0 -17
- package/templates/react-native/docs/components/buttons.md +0 -40
- package/templates/react-native/docs/components/data-display.md +0 -44
- package/templates/react-native/docs/components/feedback.md +0 -36
- package/templates/react-native/docs/components/gestures.md +0 -60
- package/templates/react-native/docs/components/inputs.md +0 -41
- package/templates/react-native/docs/components/layout.md +0 -34
- package/templates/react-native/docs/components/navigation.md +0 -31
- package/templates/react-native/docs/features.md +0 -85
- package/templates/react-native/docs/getting-started.md +0 -47
- package/templates/react-native/src/components/common/HomeHeader.tsx +0 -43
- package/templates/react-native/src/components/settings/SettingToggle.tsx +0 -26
- package/templates/react-native/src/components/settings/SettingsOptions.tsx +0 -47
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { Gesture, GestureDetector, GestureType } from "react-native-gesture-handler";
|
|
4
|
+
import Animated, { runOnJS } from "react-native-reanimated";
|
|
5
|
+
|
|
6
|
+
interface GestureWrapperProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
9
|
+
|
|
10
|
+
// Tap Gestures
|
|
11
|
+
onTap?: () => void;
|
|
12
|
+
onDoubleTap?: () => void;
|
|
13
|
+
|
|
14
|
+
// Pan/Drag Gestures
|
|
15
|
+
onPanStart?: (e: any) => void;
|
|
16
|
+
onPanUpdate?: (e: any) => void;
|
|
17
|
+
onPanEnd?: (e: any) => void;
|
|
18
|
+
|
|
19
|
+
// Swipe Gestures
|
|
20
|
+
onSwipeLeft?: () => void;
|
|
21
|
+
onSwipeRight?: () => void;
|
|
22
|
+
onSwipeUp?: () => void;
|
|
23
|
+
onSwipeDown?: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const GestureWrapper: React.FC<GestureWrapperProps> = ({
|
|
27
|
+
children,
|
|
28
|
+
containerStyle,
|
|
29
|
+
onTap,
|
|
30
|
+
onDoubleTap,
|
|
31
|
+
onPanStart,
|
|
32
|
+
onPanUpdate,
|
|
33
|
+
onPanEnd,
|
|
34
|
+
onSwipeLeft,
|
|
35
|
+
onSwipeRight,
|
|
36
|
+
onSwipeUp,
|
|
37
|
+
onSwipeDown,
|
|
38
|
+
}) => {
|
|
39
|
+
const gestures: GestureType[] = [];
|
|
40
|
+
|
|
41
|
+
// 1. Single Tap
|
|
42
|
+
if (onTap) {
|
|
43
|
+
const tap = Gesture.Tap().onEnd(() => {
|
|
44
|
+
runOnJS(onTap)();
|
|
45
|
+
});
|
|
46
|
+
gestures.push(tap);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 2. Double Tap
|
|
50
|
+
if (onDoubleTap) {
|
|
51
|
+
const doubleTap = Gesture.Tap()
|
|
52
|
+
.numberOfTaps(2)
|
|
53
|
+
.onEnd(() => {
|
|
54
|
+
runOnJS(onDoubleTap)();
|
|
55
|
+
});
|
|
56
|
+
gestures.push(doubleTap);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 3. Generic Pan / Drag
|
|
60
|
+
if (onPanStart || onPanUpdate || onPanEnd) {
|
|
61
|
+
const pan = Gesture.Pan()
|
|
62
|
+
.onStart((e) => {
|
|
63
|
+
if (onPanStart) runOnJS(onPanStart)(e);
|
|
64
|
+
})
|
|
65
|
+
.onUpdate((e) => {
|
|
66
|
+
if (onPanUpdate) runOnJS(onPanUpdate)(e);
|
|
67
|
+
})
|
|
68
|
+
.onEnd((e) => {
|
|
69
|
+
if (onPanEnd) runOnJS(onPanEnd)(e);
|
|
70
|
+
});
|
|
71
|
+
gestures.push(pan);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 4. Directional Swipes (Fling)
|
|
75
|
+
const SWIPE_VELOCITY_THRESHOLD = 500;
|
|
76
|
+
|
|
77
|
+
if (onSwipeLeft || onSwipeRight || onSwipeUp || onSwipeDown) {
|
|
78
|
+
const swipe = Gesture.Pan()
|
|
79
|
+
.onEnd((e) => {
|
|
80
|
+
// Horizontal Swipes
|
|
81
|
+
if (Math.abs(e.velocityX) > Math.abs(e.velocityY)) {
|
|
82
|
+
if (e.velocityX > SWIPE_VELOCITY_THRESHOLD && onSwipeRight) {
|
|
83
|
+
runOnJS(onSwipeRight)();
|
|
84
|
+
} else if (e.velocityX < -SWIPE_VELOCITY_THRESHOLD && onSwipeLeft) {
|
|
85
|
+
runOnJS(onSwipeLeft)();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Vertical Swipes
|
|
89
|
+
else {
|
|
90
|
+
if (e.velocityY > SWIPE_VELOCITY_THRESHOLD && onSwipeDown) {
|
|
91
|
+
runOnJS(onSwipeDown)();
|
|
92
|
+
} else if (e.velocityY < -SWIPE_VELOCITY_THRESHOLD && onSwipeUp) {
|
|
93
|
+
runOnJS(onSwipeUp)();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
gestures.push(swipe);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// If no gestures are provided, just return the children wrapped in a view
|
|
101
|
+
if (gestures.length === 0) {
|
|
102
|
+
return <Animated.View style={containerStyle}>{children}</Animated.View>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Combine all active gestures (Exclusive makes sure they don't fight each other if configured properly,
|
|
106
|
+
// but for generic wrapping, Simultaneous is safer so Pan and Swipe can co-exist).
|
|
107
|
+
const composedGesture = Gesture.Simultaneous(...gestures);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<GestureDetector gesture={composedGesture}>
|
|
111
|
+
<Animated.View style={containerStyle}>{children}</Animated.View>
|
|
112
|
+
</GestureDetector>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
useSharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
withTiming,
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
import { useColorScheme } from "nativewind";
|
|
9
|
+
import { Colors } from "../../../constants/Colors";
|
|
10
|
+
import { Txt } from "../../common/Typography";
|
|
11
|
+
|
|
12
|
+
export interface ProgressBarProps {
|
|
13
|
+
progress: number; // 0 to 100
|
|
14
|
+
color?: string;
|
|
15
|
+
height?: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function ProgressBar({ progress, color, height = 8, label, style }: ProgressBarProps) {
|
|
21
|
+
const { colorScheme } = useColorScheme();
|
|
22
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
23
|
+
const widthVal = useSharedValue(0);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
widthVal.value = withTiming(progress, { duration: 500 });
|
|
27
|
+
}, [progress, widthVal]);
|
|
28
|
+
|
|
29
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
30
|
+
width: `${widthVal.value}%`,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={[{ width: "100%", marginBottom: label ? 16 : 0 }, style]}>
|
|
35
|
+
{label && (
|
|
36
|
+
<View style={{ flexDirection: "row", justifyContent: "space-between", marginBottom: 6 }}>
|
|
37
|
+
<Txt color={theme.baseContent} variant="sm" weight="semibold">{label}</Txt>
|
|
38
|
+
<Txt color={theme.secondary} variant="sm">{Math.round(progress)}%</Txt>
|
|
39
|
+
</View>
|
|
40
|
+
)}
|
|
41
|
+
<View style={{ width: "100%", height, backgroundColor: theme.base300, borderRadius: height / 2, overflow: "hidden" }}>
|
|
42
|
+
<Animated.View
|
|
43
|
+
style={[
|
|
44
|
+
{ height: "100%", backgroundColor: color || theme.primary, borderRadius: height / 2 },
|
|
45
|
+
animatedStyle,
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
useSharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
withRepeat,
|
|
7
|
+
withTiming,
|
|
8
|
+
withSequence,
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
|
+
import { useColorScheme } from "nativewind";
|
|
11
|
+
import { Colors } from "../../../constants/Colors";
|
|
12
|
+
|
|
13
|
+
export interface SkeletonProps {
|
|
14
|
+
width?: number | string;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
borderRadius?: number;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
variant?: "circular" | "rectangular" | "text";
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function Skeleton({
|
|
23
|
+
width,
|
|
24
|
+
height,
|
|
25
|
+
borderRadius,
|
|
26
|
+
style,
|
|
27
|
+
variant = "rectangular",
|
|
28
|
+
className=""
|
|
29
|
+
}: SkeletonProps) {
|
|
30
|
+
const { colorScheme } = useColorScheme();
|
|
31
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
32
|
+
const opacity = useSharedValue(0.3);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
opacity.value = withRepeat(
|
|
36
|
+
withSequence(
|
|
37
|
+
withTiming(0.7, { duration: 800 }),
|
|
38
|
+
withTiming(0.3, { duration: 800 })
|
|
39
|
+
),
|
|
40
|
+
-1,
|
|
41
|
+
true
|
|
42
|
+
);
|
|
43
|
+
}, [opacity]);
|
|
44
|
+
|
|
45
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
46
|
+
opacity: opacity.value,
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
const getVariantStyles = (): ViewStyle => {
|
|
50
|
+
switch (variant) {
|
|
51
|
+
case "circular":
|
|
52
|
+
return {
|
|
53
|
+
width: (width as import('react-native').DimensionValue) ?? 40,
|
|
54
|
+
height: (height as import('react-native').DimensionValue) ?? ((width as import('react-native').DimensionValue) ?? 40),
|
|
55
|
+
borderRadius: 9999,
|
|
56
|
+
};
|
|
57
|
+
case "text":
|
|
58
|
+
return {
|
|
59
|
+
width: (width as import('react-native').DimensionValue) ?? "100%",
|
|
60
|
+
height: (height as import('react-native').DimensionValue) ?? 20,
|
|
61
|
+
borderRadius: borderRadius ?? 4,
|
|
62
|
+
};
|
|
63
|
+
case "rectangular":
|
|
64
|
+
default:
|
|
65
|
+
return {
|
|
66
|
+
width: (width as import('react-native').DimensionValue) ?? "100%",
|
|
67
|
+
height: (height as import('react-native').DimensionValue) ?? 100,
|
|
68
|
+
borderRadius: borderRadius ?? 12,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Animated.View
|
|
75
|
+
style={[
|
|
76
|
+
{ backgroundColor: theme.base300 },
|
|
77
|
+
getVariantStyles(),
|
|
78
|
+
animatedStyle,
|
|
79
|
+
style,
|
|
80
|
+
]}
|
|
81
|
+
className={className}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
useSharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
withRepeat,
|
|
7
|
+
withTiming,
|
|
8
|
+
Easing,
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
|
+
import { useColorScheme } from "nativewind";
|
|
11
|
+
import { Colors } from "../../../constants/Colors";
|
|
12
|
+
import { EvilIcons } from "@expo/vector-icons";
|
|
13
|
+
|
|
14
|
+
export interface SpinnerProps {
|
|
15
|
+
size?: number | "xs" | "sm" | "md" | "lg" | "xl";
|
|
16
|
+
color?: string;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function Spinner({ size = 24, color, style }: SpinnerProps) {
|
|
21
|
+
const { colorScheme } = useColorScheme();
|
|
22
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
23
|
+
const rotation = useSharedValue(0);
|
|
24
|
+
|
|
25
|
+
const numericSize = typeof size === "number" ? size : {
|
|
26
|
+
xs: 16,
|
|
27
|
+
sm: 20,
|
|
28
|
+
md: 24,
|
|
29
|
+
lg: 32,
|
|
30
|
+
xl: 40,
|
|
31
|
+
}[size] || 24;
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
rotation.value = withRepeat(
|
|
35
|
+
withTiming(360, { duration: 2000, easing: Easing.linear }),
|
|
36
|
+
-1,
|
|
37
|
+
false
|
|
38
|
+
);
|
|
39
|
+
}, [rotation]);
|
|
40
|
+
|
|
41
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
42
|
+
transform: [{ rotate: `${rotation.value}deg` }],
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Animated.View style={[animatedStyle, style, { width: numericSize, height: numericSize, alignItems: "center", justifyContent: "center" }]}>
|
|
47
|
+
<EvilIcons name="spinner" size={numericSize} color={color || theme.primary} />
|
|
48
|
+
</Animated.View>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
4
|
+
import { useColorScheme } from "nativewind";
|
|
5
|
+
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
import { Txt } from "../../common/Typography";
|
|
7
|
+
|
|
8
|
+
export interface CheckboxProps {
|
|
9
|
+
checked: boolean;
|
|
10
|
+
onChange: (checked: boolean) => void;
|
|
11
|
+
label?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Checkbox({
|
|
16
|
+
checked,
|
|
17
|
+
onChange,
|
|
18
|
+
label,
|
|
19
|
+
disabled,
|
|
20
|
+
}: CheckboxProps) {
|
|
21
|
+
const { colorScheme } = useColorScheme();
|
|
22
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<TouchableOpacity
|
|
26
|
+
activeOpacity={0.7}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
onPress={() => onChange(!checked)}
|
|
29
|
+
style={{
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
opacity: disabled ? 0.5 : 1,
|
|
33
|
+
marginBottom: 8,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<View
|
|
37
|
+
style={{
|
|
38
|
+
width: 24,
|
|
39
|
+
height: 24,
|
|
40
|
+
borderRadius: 6,
|
|
41
|
+
borderWidth: checked ? 0 : 2,
|
|
42
|
+
borderColor: theme.base300,
|
|
43
|
+
backgroundColor: checked ? theme.primary : "transparent",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
marginRight: 10,
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{checked && <Ionicons name="checkmark" size={16} color={theme.primaryContent} />}
|
|
50
|
+
</View>
|
|
51
|
+
{label && <Txt color={theme.baseContent} variant="base">{label}</Txt>}
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { View, TouchableOpacity, ScrollView } from "react-native";
|
|
3
|
+
import { Txt } from "../../common/Typography";
|
|
4
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
5
|
+
import { useColorScheme } from "nativewind";
|
|
6
|
+
import { Colors } from "../../../constants/Colors";
|
|
7
|
+
import BottomModal from "../BottomModal";
|
|
8
|
+
import Button from "../buttons/Button";
|
|
9
|
+
import dayjs from "dayjs";
|
|
10
|
+
|
|
11
|
+
interface DatePickerProps {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string; // YYYY-MM-DD
|
|
14
|
+
onChange: (value: string) => void;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
minimumDate?: string; // YYYY-MM-DD
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function DatePicker({
|
|
20
|
+
label,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
placeholder = "Select Date",
|
|
24
|
+
minimumDate,
|
|
25
|
+
}: DatePickerProps) {
|
|
26
|
+
const { colorScheme } = useColorScheme();
|
|
27
|
+
const colors = Colors[colorScheme ?? "light"];
|
|
28
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
+
|
|
30
|
+
// Parse initial selected date or default to today
|
|
31
|
+
const selectedDate = value ? dayjs(value) : dayjs();
|
|
32
|
+
const [currentMonth, setCurrentMonth] = useState(selectedDate);
|
|
33
|
+
|
|
34
|
+
// Month navigation
|
|
35
|
+
const handlePrevMonth = () => {
|
|
36
|
+
setCurrentMonth((prev) => prev.subtract(1, "month"));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleNextMonth = () => {
|
|
40
|
+
setCurrentMonth((prev) => prev.add(1, "month"));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Generate days in current month grid
|
|
44
|
+
const daysInMonth = currentMonth.daysInMonth();
|
|
45
|
+
const startDayOfWeek = currentMonth.startOf("month").day(); // 0 (Sun) - 6 (Sat)
|
|
46
|
+
|
|
47
|
+
const daysArray: { dayNum: number; dateString: string; isCurrentMonth: boolean }[] = [];
|
|
48
|
+
|
|
49
|
+
// Padding days from previous month
|
|
50
|
+
const prevMonth = currentMonth.subtract(1, "month");
|
|
51
|
+
const prevMonthDays = prevMonth.daysInMonth();
|
|
52
|
+
for (let i = startDayOfWeek - 1; i >= 0; i--) {
|
|
53
|
+
const dayNum = prevMonthDays - i;
|
|
54
|
+
daysArray.push({
|
|
55
|
+
dayNum,
|
|
56
|
+
dateString: prevMonth.date(dayNum).format("YYYY-MM-DD"),
|
|
57
|
+
isCurrentMonth: false,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Days of current month
|
|
62
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
63
|
+
daysArray.push({
|
|
64
|
+
dayNum: i,
|
|
65
|
+
dateString: currentMonth.date(i).format("YYYY-MM-DD"),
|
|
66
|
+
isCurrentMonth: true,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Padding days for next month to complete the row
|
|
71
|
+
const remainingDays = 42 - daysArray.length; // 6 rows * 7 days = 42 total slots
|
|
72
|
+
const nextMonth = currentMonth.add(1, "month");
|
|
73
|
+
for (let i = 1; i <= remainingDays; i++) {
|
|
74
|
+
daysArray.push({
|
|
75
|
+
dayNum: i,
|
|
76
|
+
dateString: nextMonth.date(i).format("YYYY-MM-DD"),
|
|
77
|
+
isCurrentMonth: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const handleDateSelect = (dateStr: string) => {
|
|
82
|
+
if (minimumDate && dayjs(dateStr).isBefore(dayjs(minimumDate), "day")) {
|
|
83
|
+
return; // Date is disabled
|
|
84
|
+
}
|
|
85
|
+
onChange(dateStr);
|
|
86
|
+
setIsOpen(false);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const formattedDisplay = value ? dayjs(value).format("MMM DD, YYYY") : "";
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<View className="flex-1">
|
|
93
|
+
<Txt className="text-xs text-base-content/60 uppercase mb-2 font-medium">
|
|
94
|
+
{label}
|
|
95
|
+
</Txt>
|
|
96
|
+
<TouchableOpacity
|
|
97
|
+
onPress={() => setIsOpen(true)}
|
|
98
|
+
activeOpacity={0.8}
|
|
99
|
+
className="bg-base-100 rounded-2xl px-4 py-3 border border-base-300 flex-row justify-between items-center h-12"
|
|
100
|
+
>
|
|
101
|
+
<Txt className={formattedDisplay ? "text-base-content font-medium" : "text-base-content/40 font-medium"}>
|
|
102
|
+
{formattedDisplay || placeholder}
|
|
103
|
+
</Txt>
|
|
104
|
+
<Ionicons name="calendar-outline" size={18} color={colors.primary} />
|
|
105
|
+
</TouchableOpacity>
|
|
106
|
+
|
|
107
|
+
<BottomModal isOpen={isOpen} onClose={() => setIsOpen(false)} heightPercent={0.65}>
|
|
108
|
+
<View className="p-4 flex-1">
|
|
109
|
+
<Txt variant="lg" className="font-bold text-center mb-4">
|
|
110
|
+
{label}
|
|
111
|
+
</Txt>
|
|
112
|
+
|
|
113
|
+
{/* Month & Year Navigation Header */}
|
|
114
|
+
<View className="flex-row justify-between items-center px-2 mb-4">
|
|
115
|
+
<TouchableOpacity onPress={handlePrevMonth} className="p-2 bg-base-200 rounded-full">
|
|
116
|
+
<Ionicons name="chevron-back" size={20} color={colors.primary} />
|
|
117
|
+
</TouchableOpacity>
|
|
118
|
+
<Txt className="font-bold text-base-content text-base">
|
|
119
|
+
{currentMonth.format("MMMM YYYY")}
|
|
120
|
+
</Txt>
|
|
121
|
+
<TouchableOpacity onPress={handleNextMonth} className="p-2 bg-base-200 rounded-full">
|
|
122
|
+
<Ionicons name="chevron-forward" size={20} color={colors.primary} />
|
|
123
|
+
</TouchableOpacity>
|
|
124
|
+
</View>
|
|
125
|
+
|
|
126
|
+
{/* Day Names Header */}
|
|
127
|
+
<View className="flex-row justify-between mb-2">
|
|
128
|
+
{["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].map((day) => (
|
|
129
|
+
<View key={day} className="flex-1 items-center">
|
|
130
|
+
<Txt variant="xs" className="text-base-content/40 font-bold">
|
|
131
|
+
{day}
|
|
132
|
+
</Txt>
|
|
133
|
+
</View>
|
|
134
|
+
))}
|
|
135
|
+
</View>
|
|
136
|
+
|
|
137
|
+
{/* Days Grid */}
|
|
138
|
+
<ScrollView showsVerticalScrollIndicator={false}>
|
|
139
|
+
<View className="flex-row flex-wrap">
|
|
140
|
+
{daysArray.map((item, idx) => {
|
|
141
|
+
const isSelected = value === item.dateString;
|
|
142
|
+
const isToday = dayjs().format("YYYY-MM-DD") === item.dateString;
|
|
143
|
+
const isDisabled = !!(minimumDate && dayjs(item.dateString).isBefore(dayjs(minimumDate), "day"));
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<TouchableOpacity
|
|
147
|
+
key={idx}
|
|
148
|
+
onPress={() => handleDateSelect(item.dateString)}
|
|
149
|
+
disabled={isDisabled}
|
|
150
|
+
style={{ width: "14.28%", aspectRatio: 1 }}
|
|
151
|
+
className={`items-center justify-center rounded-2xl my-1 relative ${
|
|
152
|
+
isSelected
|
|
153
|
+
? "bg-primary"
|
|
154
|
+
: isToday
|
|
155
|
+
? "bg-primary/10 border border-primary/30"
|
|
156
|
+
: ""
|
|
157
|
+
} ${isDisabled ? "opacity-25" : ""}`}
|
|
158
|
+
>
|
|
159
|
+
<Txt
|
|
160
|
+
className={`font-semibold ${
|
|
161
|
+
isSelected
|
|
162
|
+
? "text-white"
|
|
163
|
+
: item.isCurrentMonth
|
|
164
|
+
? "text-base-content"
|
|
165
|
+
: "text-base-content/30"
|
|
166
|
+
}`}
|
|
167
|
+
>
|
|
168
|
+
{item.dayNum}
|
|
169
|
+
</Txt>
|
|
170
|
+
{isToday && !isSelected && (
|
|
171
|
+
<View className="absolute bottom-1 w-1 h-1 bg-primary rounded-full" />
|
|
172
|
+
)}
|
|
173
|
+
</TouchableOpacity>
|
|
174
|
+
);
|
|
175
|
+
})}
|
|
176
|
+
</View>
|
|
177
|
+
</ScrollView>
|
|
178
|
+
|
|
179
|
+
<View className="pt-4 border-t border-base-200">
|
|
180
|
+
<Button label="Close" variant="outline" onPress={() => setIsOpen(false)} className="w-full" />
|
|
181
|
+
</View>
|
|
182
|
+
</View>
|
|
183
|
+
</BottomModal>
|
|
184
|
+
</View>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import * as ImagePicker from "expo-image-picker";
|
|
4
|
+
import { Txt } from "@/components/common/Typography";
|
|
5
|
+
import BottomModal from "@/components/ui/BottomModal";
|
|
6
|
+
import Button from "@/components/ui/buttons/Button";
|
|
7
|
+
|
|
8
|
+
export type ImagePickerSource = "camera" | "gallery" | "both";
|
|
9
|
+
|
|
10
|
+
export interface ImagePickerResult {
|
|
11
|
+
uri: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ImagePickerModalProps {
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onImageSelected?: (image: ImagePickerResult) => void;
|
|
20
|
+
onImagesSelected?: (images: ImagePickerResult[]) => void;
|
|
21
|
+
source?: ImagePickerSource;
|
|
22
|
+
title?: string;
|
|
23
|
+
subtitle?: string;
|
|
24
|
+
allowsEditing?: boolean;
|
|
25
|
+
allowsMultipleSelection?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function ImagePickerModal({
|
|
29
|
+
isOpen,
|
|
30
|
+
onClose,
|
|
31
|
+
onImageSelected,
|
|
32
|
+
onImagesSelected,
|
|
33
|
+
source = "both",
|
|
34
|
+
title = "Select Image Source",
|
|
35
|
+
subtitle = "Choose where to pick your image from",
|
|
36
|
+
allowsEditing = false,
|
|
37
|
+
allowsMultipleSelection = false,
|
|
38
|
+
}: ImagePickerModalProps) {
|
|
39
|
+
|
|
40
|
+
const launchPicker = async (type: "gallery" | "camera") => {
|
|
41
|
+
onClose();
|
|
42
|
+
|
|
43
|
+
// Delay picker execution to allow the modal dismiss animation to finish smoothly
|
|
44
|
+
setTimeout(async () => {
|
|
45
|
+
try {
|
|
46
|
+
let result: ImagePicker.ImagePickerResult;
|
|
47
|
+
|
|
48
|
+
if (type === "gallery") {
|
|
49
|
+
const perm = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
|
50
|
+
if (!perm.granted) return;
|
|
51
|
+
|
|
52
|
+
result = await ImagePicker.launchImageLibraryAsync({
|
|
53
|
+
mediaTypes: ["images"],
|
|
54
|
+
quality: 0.8,
|
|
55
|
+
allowsEditing: !allowsMultipleSelection && allowsEditing, // multi-select cannot have editing on some OS
|
|
56
|
+
allowsMultipleSelection,
|
|
57
|
+
aspect: allowsEditing ? [16, 9] : undefined, // Assuming a common aspect ratio if cropped
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
const perm = await ImagePicker.requestCameraPermissionsAsync();
|
|
61
|
+
if (!perm.granted) return;
|
|
62
|
+
|
|
63
|
+
result = await ImagePicker.launchCameraAsync({
|
|
64
|
+
mediaTypes: ["images"],
|
|
65
|
+
quality: 0.8,
|
|
66
|
+
allowsEditing,
|
|
67
|
+
aspect: allowsEditing ? [16, 9] : undefined,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (result && !result.canceled && result.assets && result.assets.length > 0) {
|
|
72
|
+
const mappedAssets = result.assets.map(asset => {
|
|
73
|
+
const filename = asset.uri.split("/").pop() || "image.jpg";
|
|
74
|
+
const match = /\.(\w+)$/.exec(filename);
|
|
75
|
+
const mimeType = match ? `image/${match[1]}` : "image/jpeg";
|
|
76
|
+
return {
|
|
77
|
+
uri: asset.uri,
|
|
78
|
+
name: filename,
|
|
79
|
+
type: mimeType,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (allowsMultipleSelection && onImagesSelected) {
|
|
84
|
+
onImagesSelected(mappedAssets);
|
|
85
|
+
} else if (onImageSelected && mappedAssets.length > 0) {
|
|
86
|
+
onImageSelected(mappedAssets[0]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.error("ImagePicker error:", err);
|
|
91
|
+
}
|
|
92
|
+
}, 350);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<BottomModal isOpen={isOpen} onClose={onClose}>
|
|
97
|
+
<View className="p-6">
|
|
98
|
+
<Txt variant="lg" className="font-bold mb-1 text-center">
|
|
99
|
+
{title}
|
|
100
|
+
</Txt>
|
|
101
|
+
{subtitle ? (
|
|
102
|
+
<Txt className="text-base-content/60 text-center mb-6 text-sm">
|
|
103
|
+
{subtitle}
|
|
104
|
+
</Txt>
|
|
105
|
+
) : null}
|
|
106
|
+
|
|
107
|
+
<View className="gap-3">
|
|
108
|
+
{(source === "both" || source === "gallery") && (
|
|
109
|
+
<Button
|
|
110
|
+
label="Choose from Gallery"
|
|
111
|
+
leftIcon="images-outline"
|
|
112
|
+
variant="primary"
|
|
113
|
+
onPress={() => launchPicker("gallery")}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
{(source === "both" || source === "camera") && (
|
|
118
|
+
<Button
|
|
119
|
+
label="Take Photo with Camera"
|
|
120
|
+
leftIcon="camera-outline"
|
|
121
|
+
variant={source === "camera" ? "primary" : "outline"}
|
|
122
|
+
onPress={() => launchPicker("camera")}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
</View>
|
|
126
|
+
</View>
|
|
127
|
+
</BottomModal>
|
|
128
|
+
);
|
|
129
|
+
}
|