@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
package/templates/production-fullstack/mobile/src/components/ui/buttons/FloatingActionButton.tsx
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, StyleProp, ViewStyle, StyleSheet, ActivityIndicator } from "react-native";
|
|
3
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
4
|
+
import { useColorScheme } from "nativewind";
|
|
5
|
+
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
|
|
7
|
+
export interface FABProps {
|
|
8
|
+
icon: keyof typeof Ionicons.glyphMap;
|
|
9
|
+
onPress: () => void;
|
|
10
|
+
position?: "bottom-right" | "bottom-left" | "bottom-center";
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function FloatingActionButton({
|
|
16
|
+
icon,
|
|
17
|
+
onPress,
|
|
18
|
+
position = "bottom-right",
|
|
19
|
+
isLoading = false,
|
|
20
|
+
style,
|
|
21
|
+
}: FABProps) {
|
|
22
|
+
const { colorScheme } = useColorScheme();
|
|
23
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
24
|
+
|
|
25
|
+
const getPositionStyles = (): ViewStyle => {
|
|
26
|
+
switch (position) {
|
|
27
|
+
case "bottom-left":
|
|
28
|
+
return { bottom: 20, left: 20 };
|
|
29
|
+
case "bottom-center":
|
|
30
|
+
return { bottom: 20, alignSelf: "center" };
|
|
31
|
+
case "bottom-right":
|
|
32
|
+
default:
|
|
33
|
+
return { bottom: 20, right: 20 };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
activeOpacity={0.8}
|
|
40
|
+
onPress={onPress}
|
|
41
|
+
disabled={isLoading}
|
|
42
|
+
style={[
|
|
43
|
+
styles.fab,
|
|
44
|
+
{ backgroundColor: theme.primary, shadowColor: theme.primary },
|
|
45
|
+
getPositionStyles(),
|
|
46
|
+
style,
|
|
47
|
+
]}
|
|
48
|
+
>
|
|
49
|
+
{isLoading ? (
|
|
50
|
+
<ActivityIndicator color={theme.primaryContent} size="small" />
|
|
51
|
+
) : (
|
|
52
|
+
<Ionicons name={icon} size={28} color={theme.primaryContent} />
|
|
53
|
+
)}
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
fab: {
|
|
60
|
+
position: "absolute",
|
|
61
|
+
width: 60,
|
|
62
|
+
height: 60,
|
|
63
|
+
borderRadius: 30,
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "center",
|
|
66
|
+
elevation: 8,
|
|
67
|
+
shadowOffset: { width: 0, height: 4 },
|
|
68
|
+
shadowOpacity: 0.3,
|
|
69
|
+
shadowRadius: 5,
|
|
70
|
+
zIndex: 999,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, ActivityIndicator, TouchableOpacityProps } from "react-native";
|
|
3
|
+
import { useColorScheme } from "nativewind";
|
|
4
|
+
import { Colors } from "../../../constants/Colors";
|
|
5
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
6
|
+
import { ButtonVariant, ButtonSize } from "./Button";
|
|
7
|
+
|
|
8
|
+
export interface IconButtonProps extends TouchableOpacityProps {
|
|
9
|
+
icon: keyof typeof Ionicons.glyphMap;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
size?: ButtonSize;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
color?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function IconButton({
|
|
17
|
+
icon,
|
|
18
|
+
variant = "ghost",
|
|
19
|
+
size = "md",
|
|
20
|
+
isLoading = false,
|
|
21
|
+
color,
|
|
22
|
+
style,
|
|
23
|
+
disabled,
|
|
24
|
+
...props
|
|
25
|
+
}: IconButtonProps) {
|
|
26
|
+
const { colorScheme } = useColorScheme();
|
|
27
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
28
|
+
|
|
29
|
+
const getVariantStyles = (): { bg: string; iconColor: string; border?: string } => {
|
|
30
|
+
switch (variant) {
|
|
31
|
+
case "primary": return { bg: theme.primary, iconColor: theme.primaryContent };
|
|
32
|
+
case "secondary": return { bg: theme.secondary, iconColor: theme.secondaryContent };
|
|
33
|
+
case "accent": return { bg: theme.accent, iconColor: theme.accentContent };
|
|
34
|
+
case "info": return { bg: theme.info, iconColor: "#fff" };
|
|
35
|
+
case "success": return { bg: theme.success, iconColor: "#fff" };
|
|
36
|
+
case "warning": return { bg: theme.warning, iconColor: "#fff" };
|
|
37
|
+
case "error": return { bg: theme.error, iconColor: "#fff" };
|
|
38
|
+
case "ghost": return { bg: "transparent", iconColor: theme.baseContent };
|
|
39
|
+
case "outline": return { bg: "transparent", iconColor: theme.baseContent, border: theme.base300 };
|
|
40
|
+
default: return { bg: theme.primary, iconColor: theme.primaryContent };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getSizeStyles = (): { size: number; iconSize: number } => {
|
|
45
|
+
switch (size) {
|
|
46
|
+
case "sm": return { size: 36, iconSize: 18 };
|
|
47
|
+
case "md": return { size: 48, iconSize: 24 };
|
|
48
|
+
case "lg": return { size: 56, iconSize: 28 };
|
|
49
|
+
default: return { size: 48, iconSize: 24 };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const vStyles = getVariantStyles();
|
|
54
|
+
const sStyles = getSizeStyles();
|
|
55
|
+
const isDisabled = disabled || isLoading;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<TouchableOpacity
|
|
59
|
+
activeOpacity={0.7}
|
|
60
|
+
disabled={isDisabled}
|
|
61
|
+
style={[
|
|
62
|
+
{
|
|
63
|
+
backgroundColor: vStyles.bg,
|
|
64
|
+
width: sStyles.size,
|
|
65
|
+
height: sStyles.size,
|
|
66
|
+
borderRadius: sStyles.size / 2,
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
70
|
+
borderWidth: variant === "outline" ? 1 : 0,
|
|
71
|
+
borderColor: vStyles.border,
|
|
72
|
+
},
|
|
73
|
+
style,
|
|
74
|
+
]}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{isLoading ? (
|
|
78
|
+
<ActivityIndicator color={color || vStyles.iconColor} size="small" />
|
|
79
|
+
) : (
|
|
80
|
+
<Ionicons name={icon} size={sStyles.iconSize} color={color || vStyles.iconColor} />
|
|
81
|
+
)}
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { View, TouchableOpacity } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
useAnimatedStyle,
|
|
5
|
+
useSharedValue,
|
|
6
|
+
withTiming,
|
|
7
|
+
measure,
|
|
8
|
+
useAnimatedRef,
|
|
9
|
+
runOnUI,
|
|
10
|
+
} from "react-native-reanimated";
|
|
11
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
12
|
+
import { useColorScheme } from "nativewind";
|
|
13
|
+
import { Colors } from "../../../constants/Colors";
|
|
14
|
+
import { Txt } from "../../common/Typography";
|
|
15
|
+
|
|
16
|
+
export interface AccordionProps {
|
|
17
|
+
title: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default function Accordion({ title, children }: AccordionProps) {
|
|
22
|
+
const { colorScheme } = useColorScheme();
|
|
23
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
24
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
25
|
+
const heightValue = useSharedValue(0);
|
|
26
|
+
const progress = useSharedValue(0);
|
|
27
|
+
const aref = useAnimatedRef<View>();
|
|
28
|
+
|
|
29
|
+
const toggleAccordion = () => {
|
|
30
|
+
if (isOpen) {
|
|
31
|
+
heightValue.value = withTiming(0, { duration: 300 });
|
|
32
|
+
progress.value = withTiming(0, { duration: 300 });
|
|
33
|
+
setIsOpen(false);
|
|
34
|
+
} else {
|
|
35
|
+
runOnUI(() => {
|
|
36
|
+
"worklet";
|
|
37
|
+
const measurement = measure(aref);
|
|
38
|
+
if (measurement) {
|
|
39
|
+
heightValue.value = withTiming(measurement.height, { duration: 300 });
|
|
40
|
+
progress.value = withTiming(1, { duration: 300 });
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
setIsOpen(true);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const bodyStyle = useAnimatedStyle(() => ({
|
|
48
|
+
height: heightValue.value,
|
|
49
|
+
opacity: progress.value,
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
const iconStyle = useAnimatedStyle(() => ({
|
|
54
|
+
transform: [{ rotate: `${progress.value * 180}deg` }],
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View style={{ backgroundColor: theme.base200, borderRadius: 12, marginBottom: 8, overflow: "hidden" }}>
|
|
59
|
+
<TouchableOpacity
|
|
60
|
+
activeOpacity={0.7}
|
|
61
|
+
onPress={toggleAccordion}
|
|
62
|
+
style={{ padding: 16, flexDirection: "row", justifyContent: "space-between", alignItems: "center" }}
|
|
63
|
+
>
|
|
64
|
+
<Txt color={theme.baseContent} weight="semibold" variant="md">{title}</Txt>
|
|
65
|
+
<Animated.View style={iconStyle}>
|
|
66
|
+
<Ionicons name="chevron-down" size={24} color={theme.baseContent} />
|
|
67
|
+
</Animated.View>
|
|
68
|
+
</TouchableOpacity>
|
|
69
|
+
|
|
70
|
+
<Animated.View style={bodyStyle}>
|
|
71
|
+
<View
|
|
72
|
+
style={{ position: "absolute", width: "100%", paddingHorizontal: 16, paddingBottom: 16 }}
|
|
73
|
+
>
|
|
74
|
+
{/* This inner view is measured */}
|
|
75
|
+
<View ref={aref as any}>
|
|
76
|
+
{children}
|
|
77
|
+
</View>
|
|
78
|
+
</View>
|
|
79
|
+
</Animated.View>
|
|
80
|
+
</View>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, ViewProps } from "react-native";
|
|
3
|
+
import { Image } from "expo-image";
|
|
4
|
+
import { useColorScheme } from "nativewind";
|
|
5
|
+
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
import { Txt } from "../../common/Typography";
|
|
7
|
+
|
|
8
|
+
export interface AvatarProps extends ViewProps {
|
|
9
|
+
url?: string;
|
|
10
|
+
initials?: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function Avatar({ url, initials, size = 48, style, ...props }: AvatarProps) {
|
|
15
|
+
const { colorScheme } = useColorScheme();
|
|
16
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
style={[
|
|
21
|
+
{
|
|
22
|
+
width: size,
|
|
23
|
+
height: size,
|
|
24
|
+
borderRadius: size / 2,
|
|
25
|
+
backgroundColor: theme.base300,
|
|
26
|
+
overflow: "hidden",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
},
|
|
30
|
+
style,
|
|
31
|
+
]}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{url ? (
|
|
35
|
+
<Image
|
|
36
|
+
source={{ uri: url }}
|
|
37
|
+
style={{ width: "100%", height: "100%" }}
|
|
38
|
+
contentFit="cover"
|
|
39
|
+
/>
|
|
40
|
+
) : (
|
|
41
|
+
<Txt color={theme.baseContent} weight="semibold" style={{ fontSize: size * 0.4 }}>
|
|
42
|
+
{initials?.substring(0, 2).toUpperCase()}
|
|
43
|
+
</Txt>
|
|
44
|
+
)}
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, ViewProps } from "react-native";
|
|
3
|
+
import { useColorScheme } from "nativewind";
|
|
4
|
+
import { Colors } from "../../../constants/Colors";
|
|
5
|
+
import { Txt } from "../../common/Typography";
|
|
6
|
+
|
|
7
|
+
export interface BadgeProps extends ViewProps {
|
|
8
|
+
label: string;
|
|
9
|
+
variant?:
|
|
10
|
+
| "primary"
|
|
11
|
+
| "secondary"
|
|
12
|
+
| "accent"
|
|
13
|
+
| "info"
|
|
14
|
+
| "success"
|
|
15
|
+
| "warning"
|
|
16
|
+
| "error"
|
|
17
|
+
| "neutral";
|
|
18
|
+
size?: "xs" | "sm" | "base" | "md" | "lg";
|
|
19
|
+
soft?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function Badge({
|
|
23
|
+
label,
|
|
24
|
+
variant = "primary",
|
|
25
|
+
size = "base",
|
|
26
|
+
soft = false,
|
|
27
|
+
style,
|
|
28
|
+
...props
|
|
29
|
+
}: BadgeProps) {
|
|
30
|
+
const { colorScheme } = useColorScheme();
|
|
31
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
32
|
+
|
|
33
|
+
const getVariantStyles = (): { bg: string; text: string } => {
|
|
34
|
+
switch (variant) {
|
|
35
|
+
case "secondary":
|
|
36
|
+
return { bg: theme.secondary, text: theme.secondaryContent };
|
|
37
|
+
case "accent":
|
|
38
|
+
return { bg: theme.accent, text: theme.accentContent };
|
|
39
|
+
case "info":
|
|
40
|
+
return { bg: theme.info, text: "#fff" };
|
|
41
|
+
case "success":
|
|
42
|
+
return { bg: theme.success, text: "#fff" };
|
|
43
|
+
case "warning":
|
|
44
|
+
return { bg: theme.warning, text: "#fff" };
|
|
45
|
+
case "error":
|
|
46
|
+
return { bg: theme.error, text: "#fff" };
|
|
47
|
+
case "neutral":
|
|
48
|
+
return { bg: theme.neutral, text: theme.neutralContent };
|
|
49
|
+
case "primary":
|
|
50
|
+
default:
|
|
51
|
+
return { bg: theme.primary, text: theme.primaryContent };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getSizeStyles = () => {
|
|
56
|
+
switch (size) {
|
|
57
|
+
case "xs":
|
|
58
|
+
return { height: 16, px: 4, fontSize: 6 };
|
|
59
|
+
case "sm":
|
|
60
|
+
return { height: 18, px: 6, fontSize: 8 };
|
|
61
|
+
case "base":
|
|
62
|
+
return { height: 22, px: 8, fontSize: 10 };
|
|
63
|
+
case "lg":
|
|
64
|
+
return { height: 28, px: 12, fontSize: 14 };
|
|
65
|
+
case "md":
|
|
66
|
+
default:
|
|
67
|
+
return { height: 24, px: 8, fontSize: 12 };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const vStyles = getVariantStyles();
|
|
72
|
+
if (soft) {
|
|
73
|
+
vStyles.text = vStyles.bg;
|
|
74
|
+
vStyles.bg = vStyles.bg + "26"; // ~15% opacity
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const sStyles = getSizeStyles();
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<View
|
|
81
|
+
style={[
|
|
82
|
+
{
|
|
83
|
+
backgroundColor: vStyles.bg as any,
|
|
84
|
+
height: sStyles.height,
|
|
85
|
+
paddingHorizontal: sStyles.px,
|
|
86
|
+
borderRadius: 9999,
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
alignSelf: "flex-start",
|
|
90
|
+
},
|
|
91
|
+
style,
|
|
92
|
+
]}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<Txt
|
|
96
|
+
color={vStyles.text}
|
|
97
|
+
weight="semibold"
|
|
98
|
+
style={{ fontSize: sStyles.fontSize }}
|
|
99
|
+
>
|
|
100
|
+
{label}
|
|
101
|
+
</Txt>
|
|
102
|
+
</View>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, ViewProps } from "react-native";
|
|
3
|
+
import { useColorScheme } from "nativewind";
|
|
4
|
+
import { Colors } from "../../../constants/Colors";
|
|
5
|
+
|
|
6
|
+
export interface CardProps extends ViewProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
padding?: number;
|
|
9
|
+
elevation?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Card({ children, style, padding = 16, elevation = 2, ...props }: CardProps) {
|
|
13
|
+
const { colorScheme } = useColorScheme();
|
|
14
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View
|
|
18
|
+
style={[
|
|
19
|
+
{
|
|
20
|
+
backgroundColor: theme.base200,
|
|
21
|
+
borderRadius: 16,
|
|
22
|
+
padding,
|
|
23
|
+
shadowColor: "#000",
|
|
24
|
+
shadowOffset: { width: 0, height: elevation },
|
|
25
|
+
shadowOpacity: elevation * 0.05,
|
|
26
|
+
shadowRadius: elevation * 2,
|
|
27
|
+
elevation,
|
|
28
|
+
},
|
|
29
|
+
style,
|
|
30
|
+
]}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Image as ExpoImage, ImageProps as ExpoImageProps } from "expo-image";
|
|
3
|
+
import { View, ActivityIndicator, DimensionValue } from "react-native";
|
|
4
|
+
import { useColorScheme } from "nativewind";
|
|
5
|
+
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
|
|
7
|
+
export interface ImageProps extends Omit<ExpoImageProps, "source"> {
|
|
8
|
+
fallbackIcon?: React.ReactNode;
|
|
9
|
+
src?: string | number | any;
|
|
10
|
+
source?: any;
|
|
11
|
+
width?: DimensionValue;
|
|
12
|
+
height?: DimensionValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Image({ style, src, source, width, height, ...props }: ImageProps) {
|
|
16
|
+
const { colorScheme } = useColorScheme();
|
|
17
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
18
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
19
|
+
const [hasError, setHasError] = React.useState(false);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<View style={[{ overflow: "hidden", backgroundColor: "transparent", width: width, height: height }, style]}>
|
|
23
|
+
<ExpoImage
|
|
24
|
+
source={src ? (typeof src === "string" ? { uri: src } : src) : source}
|
|
25
|
+
style={{ width: "100%", height: "100%" }}
|
|
26
|
+
onLoadStart={() => setIsLoading(true)}
|
|
27
|
+
onLoadEnd={() => setIsLoading(false)}
|
|
28
|
+
onError={() => setHasError(true)}
|
|
29
|
+
transition={300}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
{(isLoading || hasError) && (
|
|
33
|
+
<View style={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0, alignItems: "center", justifyContent: "center" }}>
|
|
34
|
+
{isLoading ? (
|
|
35
|
+
<ActivityIndicator color={theme.primary} />
|
|
36
|
+
) : (
|
|
37
|
+
props.fallbackIcon
|
|
38
|
+
)}
|
|
39
|
+
</View>
|
|
40
|
+
)}
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StatusBar } from "react-native";
|
|
3
|
+
import ImageViewing from "react-native-image-viewing";
|
|
4
|
+
import { ImageSource } from "react-native-image-viewing/dist/@types";
|
|
5
|
+
|
|
6
|
+
export interface ImageViewerProps {
|
|
7
|
+
images: ImageSource[];
|
|
8
|
+
imageIndex: number;
|
|
9
|
+
visible: boolean;
|
|
10
|
+
onRequestClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function ImageViewer({
|
|
14
|
+
images,
|
|
15
|
+
imageIndex,
|
|
16
|
+
visible,
|
|
17
|
+
onRequestClose,
|
|
18
|
+
}: ImageViewerProps) {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<StatusBar hidden={visible} />
|
|
22
|
+
<ImageViewing
|
|
23
|
+
images={images}
|
|
24
|
+
imageIndex={imageIndex}
|
|
25
|
+
visible={visible}
|
|
26
|
+
onRequestClose={onRequestClose}
|
|
27
|
+
swipeToCloseEnabled
|
|
28
|
+
doubleTapToZoomEnabled
|
|
29
|
+
presentationStyle="overFullScreen"
|
|
30
|
+
/>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import Swipeable from "react-native-gesture-handler/Swipeable";
|
|
4
|
+
import { useColorScheme } from "nativewind";
|
|
5
|
+
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
|
|
7
|
+
export type SwipeAction = {
|
|
8
|
+
icon: React.ReactNode;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
onPress: () => void;
|
|
11
|
+
width?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface SwipeableRowProps {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
leftActions?: SwipeAction[];
|
|
17
|
+
rightActions?: SwipeAction[];
|
|
18
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
19
|
+
onSwipeOpen?: () => void;
|
|
20
|
+
onSwipeClose?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const SwipeableRow: React.FC<SwipeableRowProps> = ({
|
|
24
|
+
children,
|
|
25
|
+
leftActions = [],
|
|
26
|
+
rightActions = [],
|
|
27
|
+
containerStyle,
|
|
28
|
+
onSwipeOpen,
|
|
29
|
+
onSwipeClose,
|
|
30
|
+
}) => {
|
|
31
|
+
const { colorScheme } = useColorScheme();
|
|
32
|
+
const isDark = colorScheme === "dark";
|
|
33
|
+
const colors = Colors[isDark ? "dark" : "light"];
|
|
34
|
+
|
|
35
|
+
const renderActions = (actions: SwipeAction[], progress: any, dragX: any, isRight: boolean) => {
|
|
36
|
+
if (actions.length === 0) return null;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<View style={[styles.actionsContainer, isRight ? styles.rightActions : styles.leftActions]}>
|
|
40
|
+
{actions.map((action, index) => {
|
|
41
|
+
const actionWidth = action.width || 75;
|
|
42
|
+
return (
|
|
43
|
+
<TouchableOpacity
|
|
44
|
+
key={index}
|
|
45
|
+
style={[
|
|
46
|
+
styles.actionButton,
|
|
47
|
+
{ backgroundColor: action.backgroundColor, width: actionWidth },
|
|
48
|
+
]}
|
|
49
|
+
onPress={action.onPress}
|
|
50
|
+
activeOpacity={0.8}
|
|
51
|
+
>
|
|
52
|
+
{action.icon}
|
|
53
|
+
</TouchableOpacity>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Swipeable
|
|
62
|
+
friction={2}
|
|
63
|
+
leftThreshold={40}
|
|
64
|
+
rightThreshold={40}
|
|
65
|
+
renderLeftActions={(progress, dragX) => renderActions(leftActions, progress, dragX, false)}
|
|
66
|
+
renderRightActions={(progress, dragX) => renderActions(rightActions, progress, dragX, true)}
|
|
67
|
+
onSwipeableOpen={onSwipeOpen}
|
|
68
|
+
onSwipeableClose={onSwipeClose}
|
|
69
|
+
containerStyle={containerStyle}
|
|
70
|
+
>
|
|
71
|
+
<View style={{ backgroundColor: colors.base100 }}>
|
|
72
|
+
{children}
|
|
73
|
+
</View>
|
|
74
|
+
</Swipeable>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
actionsContainer: {
|
|
80
|
+
flexDirection: "row",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
},
|
|
83
|
+
leftActions: {
|
|
84
|
+
justifyContent: "flex-start",
|
|
85
|
+
},
|
|
86
|
+
rightActions: {
|
|
87
|
+
justifyContent: "flex-end",
|
|
88
|
+
},
|
|
89
|
+
actionButton: {
|
|
90
|
+
height: "100%",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
},
|
|
94
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { useColorScheme } from "nativewind";
|
|
4
|
+
import { Colors } from "../../../constants/Colors";
|
|
5
|
+
import { Txt } from "../../common/Typography";
|
|
6
|
+
|
|
7
|
+
export interface CircularProgressProps {
|
|
8
|
+
progress: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function CircularProgress({ progress, size = 60, strokeWidth = 6 }: CircularProgressProps) {
|
|
14
|
+
const { colorScheme } = useColorScheme();
|
|
15
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View
|
|
19
|
+
style={{
|
|
20
|
+
width: size,
|
|
21
|
+
height: size,
|
|
22
|
+
borderRadius: size / 2,
|
|
23
|
+
borderWidth: strokeWidth,
|
|
24
|
+
borderColor: theme.primary,
|
|
25
|
+
borderTopColor: theme.base300,
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
transform: [{ rotate: "45deg" }],
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<View style={{ transform: [{ rotate: "-45deg" }] }}>
|
|
32
|
+
<Txt color={theme.baseContent} weight="bold" style={{ fontSize: size * 0.25 }}>
|
|
33
|
+
{Math.round(progress)}%
|
|
34
|
+
</Txt>
|
|
35
|
+
</View>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|