@imksh/create 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/commands/create.js +2 -0
- package/src/index.js +1 -1
- package/src/utils/askTemplate.js +2 -1
- package/templates/layers/electron/base/electron/main.js +262 -0
- package/templates/layers/electron/base/electron/preload.js +37 -0
- package/templates/layers/electron/base/electron-builder.json5 +68 -0
- package/templates/layers/electron/javascript/_gitignore +38 -0
- package/templates/layers/electron/javascript/package.json +49 -0
- package/templates/layers/electron/javascript/src/components/layout/SidebarLayout.jsx +43 -0
- package/templates/layers/electron/javascript/src/components/ui/TitleBar.jsx +130 -0
- package/templates/layers/electron/javascript/src/config/appConfig.js +51 -0
- package/templates/layers/electron/javascript/src/hooks/useElectron.js +68 -0
- package/templates/layers/electron/javascript/src/main.jsx +17 -0
- package/templates/layers/electron/javascript/src/store/useUiStore.js +59 -0
- package/templates/layers/electron/javascript/vite.config.js +29 -0
- package/templates/layers/electron/typescript/_gitignore +38 -0
- package/templates/layers/electron/typescript/electron/main.ts +213 -0
- package/templates/layers/electron/typescript/electron/preload.ts +52 -0
- package/templates/layers/electron/typescript/package.json +52 -0
- package/templates/layers/electron/typescript/src/components/layout/SidebarLayout.tsx +42 -0
- package/templates/layers/electron/typescript/src/components/ui/TitleBar.tsx +120 -0
- package/templates/layers/electron/typescript/src/config/appConfig.ts +52 -0
- package/templates/layers/electron/typescript/src/hooks/useElectron.ts +68 -0
- package/templates/layers/electron/typescript/src/main.tsx +17 -0
- package/templates/layers/electron/typescript/src/store/useUiStore.ts +97 -0
- package/templates/layers/electron/typescript/src/vite-env.d.ts +13 -0
- package/templates/layers/electron/typescript/tsconfig.json +25 -0
- package/templates/layers/electron/typescript/tsconfig.node.json +11 -0
- package/templates/layers/electron/typescript/vite.config.ts +29 -0
- package/templates/layers/next/javascript/package.json +8 -2
- package/templates/layers/next/javascript/src/components/common/Breadcrumbs.jsx +44 -6
- package/templates/layers/next/javascript/src/components/common/Loading.jsx +1 -0
- package/templates/layers/next/javascript/src/components/common/LottieIcon.jsx +1 -0
- package/templates/layers/next/javascript/src/components/common/Pagination.jsx +170 -0
- package/templates/layers/next/javascript/src/components/common/SidebarModal.jsx +180 -0
- package/templates/layers/next/javascript/src/components/common/StatsCard.jsx +168 -0
- package/templates/layers/next/javascript/src/components/common/Table.jsx +191 -41
- package/templates/layers/next/javascript/src/components/common/Tabs.jsx +187 -0
- package/templates/layers/next/javascript/src/components/common/ToggleSwitch.jsx +4 -3
- package/templates/layers/next/javascript/src/components/layout/ProtectedRoute.jsx +2 -1
- package/templates/layers/next/javascript/src/components/layout/PublicLayout.jsx +3 -6
- package/templates/layers/next/javascript/src/components/layout/SidebarLayout.jsx +4 -17
- package/templates/layers/next/javascript/src/components/modals/ConfirmModal.jsx +4 -12
- package/templates/layers/next/javascript/src/components/modals/Modal.jsx +50 -19
- package/templates/layers/next/javascript/src/components/ui/Input.jsx +50 -0
- package/templates/layers/next/{typescript/src/components/ui/sidebar.tsx → javascript/src/components/ui/Sidebar.jsx} +65 -53
- package/templates/layers/next/javascript/src/components/ui/SidebarHeader.jsx +11 -6
- package/templates/layers/next/javascript/src/config/appConfig.js +4 -4
- package/templates/layers/next/javascript/src/hooks/useWindowSize.js +2 -3
- package/templates/layers/next/javascript/src/store/useUiStore.js +9 -4
- package/templates/layers/next/typescript/.eslintrc.json +12 -0
- package/templates/layers/next/typescript/package.json +14 -3
- package/templates/layers/next/typescript/src/components/common/Breadcrumbs.tsx +57 -8
- package/templates/layers/next/typescript/src/components/common/Loading.tsx +2 -1
- package/templates/layers/next/typescript/src/components/common/LottieIcon.tsx +2 -2
- package/templates/layers/next/typescript/src/components/common/Pagination.tsx +186 -0
- package/templates/layers/next/typescript/src/components/common/SidebarModal.tsx +200 -0
- package/templates/layers/next/typescript/src/components/common/StatsCard.tsx +232 -0
- package/templates/layers/next/typescript/src/components/common/Table.tsx +205 -39
- package/templates/layers/next/typescript/src/components/common/Tabs.tsx +190 -0
- package/templates/layers/next/typescript/src/components/common/ToggleSwitch.tsx +12 -8
- package/templates/layers/next/typescript/src/components/layout/PublicLayout.tsx +8 -6
- package/templates/layers/next/typescript/src/components/layout/SidebarLayout.tsx +8 -17
- package/templates/layers/next/typescript/src/components/modals/ConfirmModal.tsx +3 -1
- package/templates/layers/next/typescript/src/components/modals/Modal.tsx +67 -21
- package/templates/layers/next/typescript/src/components/ui/Button.tsx +1 -0
- package/templates/layers/next/typescript/src/components/ui/Header.tsx +2 -2
- package/templates/layers/next/typescript/src/components/ui/Input.tsx +40 -60
- package/templates/layers/next/{javascript/src/components/ui/sidebar.jsx → typescript/src/components/ui/Sidebar.tsx} +77 -44
- package/templates/layers/next/typescript/src/components/ui/SidebarHeader.tsx +16 -10
- package/templates/layers/next/typescript/src/config/appConfig.ts +4 -4
- package/templates/layers/next/typescript/src/hooks/usePwaInstall.ts +10 -4
- package/templates/layers/next/typescript/src/hooks/useWindowSize.ts +2 -3
- package/templates/layers/next/typescript/src/services/authService.ts +1 -1
- package/templates/layers/next/typescript/src/store/useAuthStore.ts +24 -9
- package/templates/layers/next/typescript/src/store/useUiStore.ts +14 -4
- package/templates/layers/node/javascript/.env.example +3 -1
- package/templates/layers/node/javascript/package.json +12 -3
- package/templates/layers/node/javascript/src/app.js +2 -1
- package/templates/layers/node/javascript/src/controllers/auth.controller.js +106 -168
- package/templates/layers/node/javascript/src/controllers/push.controller.js +51 -58
- package/templates/layers/node/javascript/src/controllers/upload.controller.js +12 -19
- package/templates/layers/node/javascript/src/middleware/auth.middleware.js +5 -11
- package/templates/layers/node/javascript/src/middleware/errorHandler.js +6 -4
- package/templates/layers/node/javascript/src/routes/auth.route.js +2 -0
- package/templates/layers/node/javascript/src/services/auth.service.js +159 -164
- package/templates/layers/node/javascript/src/utils/ApiError.js +20 -0
- package/templates/layers/node/javascript/src/utils/SuccessResponse.js +15 -0
- package/templates/layers/node/javascript/src/utils/apiResponse.js +4 -0
- package/templates/layers/node/javascript/src/utils/asyncHandler.js +5 -0
- package/templates/layers/node/typescript/.env.example +3 -1
- package/templates/layers/node/typescript/.eslintrc.cjs +28 -0
- package/templates/layers/node/typescript/package-lock.json +2 -2
- package/templates/layers/node/typescript/package.json +17 -3
- package/templates/layers/node/typescript/src/app.ts +3 -2
- package/templates/layers/node/typescript/src/config/db.ts +3 -2
- package/templates/layers/node/typescript/src/config/socket.ts +5 -4
- package/templates/layers/node/typescript/src/controllers/auth.controller.ts +104 -132
- package/templates/layers/node/typescript/src/controllers/push.controller.ts +52 -59
- package/templates/layers/node/typescript/src/controllers/upload.controller.ts +12 -19
- package/templates/layers/node/typescript/src/middleware/auth.middleware.ts +13 -7
- package/templates/layers/node/typescript/src/middleware/errorHandler.ts +18 -5
- package/templates/layers/node/typescript/src/middleware/rateLimiter.ts +2 -2
- package/templates/layers/node/typescript/src/routes/auth.route.ts +2 -0
- package/templates/layers/node/typescript/src/services/auth.service.ts +86 -43
- package/templates/layers/node/typescript/src/types/express.d.ts +5 -3
- package/templates/layers/node/typescript/src/utils/ApiError.ts +25 -0
- package/templates/layers/node/typescript/src/utils/SuccessResponse.ts +17 -0
- package/templates/layers/node/typescript/src/utils/apiResponse.ts +4 -0
- package/templates/layers/node/typescript/src/utils/asyncHandler.ts +13 -0
- package/templates/layers/node/typescript/src/utils/cloudinaryUpload.ts +18 -7
- package/templates/layers/node/typescript/src/utils/expoNotification.ts +1 -1
- package/templates/layers/node/typescript/src/utils/genOtpToken.ts +7 -1
- package/templates/layers/node/typescript/src/utils/jwt.ts +8 -2
- package/templates/layers/node/typescript/src/utils/logger.ts +2 -1
- package/templates/layers/node/typescript/src/utils/pushHelper.ts +13 -9
- package/templates/layers/node-prisma/javascript/.env.example +3 -1
- package/templates/layers/node-prisma/javascript/package.json +11 -2
- package/templates/layers/node-prisma/javascript/src/app.js +2 -1
- package/templates/layers/node-prisma/javascript/src/controllers/auth.controller.js +90 -135
- package/templates/layers/node-prisma/javascript/src/controllers/push.controller.js +64 -76
- package/templates/layers/node-prisma/javascript/src/controllers/upload.controller.js +12 -19
- package/templates/layers/node-prisma/javascript/src/middleware/auth.middleware.js +5 -4
- package/templates/layers/node-prisma/javascript/src/middleware/errorHandler.js +6 -4
- package/templates/layers/node-prisma/javascript/src/routes/auth.route.js +2 -0
- package/templates/layers/node-prisma/javascript/src/services/auth.service.js +145 -122
- package/templates/layers/node-prisma/javascript/src/utils/ApiError.js +20 -0
- package/templates/layers/node-prisma/javascript/src/utils/SuccessResponse.js +15 -0
- package/templates/layers/node-prisma/javascript/src/utils/apiResponse.js +4 -0
- package/templates/layers/node-prisma/javascript/src/utils/asyncHandler.js +5 -0
- package/templates/layers/node-prisma/typescript/.env.example +3 -1
- package/templates/layers/node-prisma/typescript/.eslintrc.cjs +28 -0
- package/templates/layers/node-prisma/typescript/package.json +19 -5
- package/templates/layers/node-prisma/typescript/src/app.ts +3 -2
- package/templates/layers/node-prisma/typescript/src/config/prisma.ts +3 -2
- package/templates/layers/node-prisma/typescript/src/config/socket.ts +5 -4
- package/templates/layers/node-prisma/typescript/src/controllers/auth.controller.ts +89 -105
- package/templates/layers/node-prisma/typescript/src/controllers/push.controller.ts +67 -83
- package/templates/layers/node-prisma/typescript/src/controllers/upload.controller.ts +12 -19
- package/templates/layers/node-prisma/typescript/src/middleware/auth.middleware.ts +9 -13
- package/templates/layers/node-prisma/typescript/src/middleware/errorHandler.ts +18 -5
- package/templates/layers/node-prisma/typescript/src/middleware/rateLimiter.ts +2 -2
- package/templates/layers/node-prisma/typescript/src/routes/auth.route.ts +2 -0
- package/templates/layers/node-prisma/typescript/src/services/auth.service.ts +83 -31
- package/templates/layers/node-prisma/typescript/src/types/express.d.ts +5 -3
- package/templates/layers/node-prisma/typescript/src/utils/ApiError.ts +25 -0
- package/templates/layers/node-prisma/typescript/src/utils/SuccessResponse.ts +17 -0
- package/templates/layers/node-prisma/typescript/src/utils/apiResponse.ts +4 -0
- package/templates/layers/node-prisma/typescript/src/utils/asyncHandler.ts +13 -0
- package/templates/layers/node-prisma/typescript/src/utils/cloudinaryUpload.ts +18 -7
- package/templates/layers/node-prisma/typescript/src/utils/genOtpToken.ts +7 -1
- package/templates/layers/node-prisma/typescript/src/utils/jwt.ts +8 -2
- package/templates/layers/node-prisma/typescript/src/utils/logger.ts +2 -1
- package/templates/layers/node-prisma/typescript/src/utils/pushHelper.ts +10 -6
- package/templates/layers/prisma/javascript/package.json +8 -0
- package/templates/layers/prisma/typescript/package.json +14 -1
- package/templates/layers/prisma/typescript/prisma/schema.prisma +35 -10
- package/templates/layers/prisma/typescript/src/config/db.ts +3 -2
- package/templates/layers/react/javascript/package.json +6 -0
- package/templates/layers/react/javascript/src/components/common/Breadcrumbs.jsx +62 -58
- package/templates/layers/react/javascript/src/components/common/Pagination.jsx +164 -76
- package/templates/layers/react/javascript/src/components/common/SidebarModal.jsx +179 -0
- package/templates/layers/react/javascript/src/components/common/StatsCard.jsx +167 -0
- package/templates/layers/react/javascript/src/components/common/Table.jsx +248 -132
- package/templates/layers/react/javascript/src/components/common/Tabs.jsx +164 -112
- package/templates/layers/react/javascript/src/components/common/ToggleSwitch.jsx +3 -3
- package/templates/layers/react/javascript/src/components/layout/SidebarLayout.jsx +4 -12
- package/templates/layers/react/javascript/src/components/modals/Modal.jsx +53 -18
- package/templates/layers/react/javascript/src/components/ui/Input.jsx +49 -0
- package/templates/layers/react/javascript/src/components/ui/Sidebar.jsx +215 -0
- package/templates/layers/react/javascript/src/components/ui/SidebarHeader.jsx +25 -30
- package/templates/layers/react/javascript/src/config/appConfig.js +3 -3
- package/templates/layers/react/javascript/src/hooks/useWindowSize.js +2 -2
- package/templates/layers/react/typescript/.eslintrc.cjs +20 -0
- package/templates/layers/react/typescript/package.json +11 -2
- package/templates/layers/react/typescript/src/components/common/Breadcrumbs.tsx +32 -6
- package/templates/layers/react/typescript/src/components/common/Pagination.tsx +151 -57
- package/templates/layers/react/typescript/src/components/common/SidebarModal.tsx +199 -0
- package/templates/layers/react/typescript/src/components/common/StatsCard.tsx +231 -0
- package/templates/layers/react/typescript/src/components/common/Table.tsx +201 -38
- package/templates/layers/react/typescript/src/components/common/Tabs.tsx +56 -12
- package/templates/layers/react/typescript/src/components/common/ToggleSwitch.tsx +15 -3
- package/templates/layers/react/typescript/src/components/layout/SidebarLayout.tsx +3 -6
- package/templates/layers/react/typescript/src/components/modals/Modal.tsx +151 -0
- package/templates/layers/react/typescript/src/components/ui/Input.tsx +58 -0
- package/templates/layers/react/typescript/src/components/ui/Sidebar.tsx +116 -53
- package/templates/layers/react/typescript/src/components/ui/SidebarHeader.tsx +5 -4
- package/templates/layers/react/typescript/src/config/appConfig.ts +3 -3
- package/templates/layers/react/typescript/src/hooks/useWindowSize.ts +2 -3
- package/templates/layers/react/typescript/src/main.tsx +11 -11
- package/templates/layers/react/typescript/src/services/authService.ts +1 -1
- package/templates/layers/react/typescript/src/store/useAuthStore.ts +24 -9
- package/templates/layers/react-native/base/app.json +9 -22
- package/templates/layers/react-native/base/eslint.config.js +5 -1
- package/templates/layers/react-native/base/package.json +11 -1
- package/templates/layers/react-native/base/src/app/(auth)/edit-profile.tsx +7 -7
- package/templates/layers/react-native/base/src/app/(auth)/login.tsx +31 -7
- package/templates/layers/react-native/base/src/app/(tabs)/_layout.tsx +3 -3
- package/templates/layers/react-native/base/src/app/(tabs)/index.tsx +6 -5
- package/templates/layers/react-native/base/src/app/_layout.tsx +3 -3
- package/templates/layers/react-native/base/src/app/doc-viewer.tsx +3 -3
- package/templates/layers/react-native/base/src/components/common/ConfirmationToast.tsx +58 -40
- package/templates/layers/react-native/base/src/components/common/GoogleAuthButton.tsx +144 -0
- package/templates/layers/react-native/base/src/components/common/LocationLoader.tsx +64 -9
- package/templates/layers/react-native/base/src/components/common/Typography.tsx +54 -19
- package/templates/layers/react-native/base/src/components/ui/ClassicTabBar.tsx +15 -12
- package/templates/layers/react-native/base/src/components/ui/CustomTabBar.tsx +84 -90
- package/templates/layers/react-native/base/src/components/ui/Drawer.tsx +344 -0
- package/templates/layers/react-native/base/src/components/ui/Sidebar.tsx +4 -4
- package/templates/layers/react-native/base/src/components/ui/buttons/Button.tsx +29 -6
- package/templates/layers/react-native/base/src/components/ui/data-display/Accordion.tsx +2 -2
- package/templates/layers/react-native/base/src/components/ui/data-display/Badge.tsx +1 -2
- package/templates/layers/react-native/base/src/components/ui/data-display/Image.tsx +3 -3
- package/templates/layers/react-native/base/src/components/ui/data-display/SwipeableRow.tsx +28 -7
- package/templates/layers/react-native/base/src/components/ui/feedback/GestureWrapper.tsx +11 -4
- package/templates/layers/react-native/base/src/components/ui/inputs/DatePicker.tsx +3 -3
- package/templates/layers/react-native/base/src/components/ui/inputs/ImagePickerModal.tsx +45 -19
- package/templates/layers/react-native/base/src/components/ui/inputs/Input.tsx +28 -9
- package/templates/layers/react-native/base/src/components/ui/inputs/SearchablePicker.tsx +199 -0
- package/templates/layers/react-native/base/src/components/ui/inputs/Switch.tsx +7 -7
- package/templates/layers/react-native/base/src/components/ui/inputs/WebLocationPicker.tsx +146 -72
- package/templates/layers/react-native/base/src/config/api.ts +5 -5
- package/templates/layers/react-native/base/src/config/appConfig.ts +1 -1
- package/templates/layers/react-native/base/src/services/auth.service.ts +3 -1
- package/templates/layers/react-native/base/src/services/permission.service.ts +0 -2
- package/templates/layers/react-native/base/src/services/socket.service.ts +0 -7
- package/templates/layers/react-native/base/src/store/useAuthStore.ts +61 -16
- package/templates/layers/react-native/base/src/store/useNotificationStore.ts +36 -42
- package/templates/layers/react-native/base/src/types/images.d.ts +7 -5
- package/templates/layers/react-native/base/src/utils/fileDownload.ts +206 -0
- package/templates/layers/react-native/base/src/utils/storage.ts +1 -1
- package/templates/presets/electron/preset.json +9 -0
- package/templates/presets/electron-ts/preset.json +9 -0
- package/templates/presets/production-fullstack/overrides/client/package.json +9 -0
- package/templates/presets/production-fullstack/overrides/mobile/app.json +2 -15
- package/templates/presets/production-fullstack/overrides/mobile/package.json +11 -1
- package/templates/presets/production-fullstack/overrides/mobile/src/app/_layout.tsx +3 -3
- package/templates/presets/production-fullstack/overrides/mobile/src/components/ui/Drawer.tsx +344 -0
- package/templates/presets/production-fullstack/overrides/mobile/src/components/ui/inputs/DatePicker.tsx +3 -3
- package/templates/presets/production-fullstack/overrides/mobile/src/components/ui/inputs/ImagePickerModal.tsx +3 -3
- package/templates/presets/production-fullstack/overrides/server/package.json +11 -2
- package/templates/layers/react/javascript/src/components/ui/sidebar.jsx +0 -169
- package/templates/layers/react-native/base/src/components/ui/BottomModal.tsx +0 -176
- package/templates/presets/production-fullstack/overrides/mobile/src/components/ui/BottomModal.tsx +0 -159
- /package/templates/layers/react-native/base/assets/images/logo/{logoWithBg.png → icon.png} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TouchableWithoutFeedback,
|
|
5
|
+
Dimensions,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
KeyboardAvoidingView,
|
|
8
|
+
Platform,
|
|
9
|
+
BackHandler,
|
|
10
|
+
ViewStyle,
|
|
11
|
+
} from "react-native";
|
|
12
|
+
import Animated, {
|
|
13
|
+
useSharedValue,
|
|
14
|
+
useAnimatedStyle,
|
|
15
|
+
withTiming,
|
|
16
|
+
Easing,
|
|
17
|
+
runOnJS,
|
|
18
|
+
} from "react-native-reanimated";
|
|
19
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
20
|
+
import { Portal } from "react-native-paper";
|
|
21
|
+
import { useColorScheme } from "nativewind";
|
|
22
|
+
import { Colors } from "../../constants/Colors";
|
|
23
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
24
|
+
|
|
25
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("window");
|
|
26
|
+
|
|
27
|
+
export type DrawerPosition = "top" | "bottom" | "left" | "right";
|
|
28
|
+
|
|
29
|
+
export interface DrawerProps {
|
|
30
|
+
isOpen: boolean;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
position?: DrawerPosition;
|
|
34
|
+
sizePercent?: number; // e.g. 0.5 for 50% of the screen height (top/bottom) or width (left/right)
|
|
35
|
+
heightPercent?: number; // backwards compatibility alias for top/bottom
|
|
36
|
+
widthPercent?: number; // backwards compatibility alias for left/right
|
|
37
|
+
showHandle?: boolean;
|
|
38
|
+
zIndex?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function Drawer({
|
|
42
|
+
isOpen,
|
|
43
|
+
onClose,
|
|
44
|
+
children,
|
|
45
|
+
position = "bottom",
|
|
46
|
+
sizePercent,
|
|
47
|
+
heightPercent,
|
|
48
|
+
widthPercent,
|
|
49
|
+
showHandle = true,
|
|
50
|
+
zIndex = 50,
|
|
51
|
+
}: DrawerProps) {
|
|
52
|
+
const { colorScheme } = useColorScheme();
|
|
53
|
+
const colors = Colors[colorScheme ?? "light"];
|
|
54
|
+
const insets = useSafeAreaInsets();
|
|
55
|
+
|
|
56
|
+
const isVertical = position === "top" || position === "bottom";
|
|
57
|
+
const defaultPercent = isVertical ? 0.5 : 0.75;
|
|
58
|
+
const resolvedPercent =
|
|
59
|
+
sizePercent ??
|
|
60
|
+
(isVertical ? heightPercent : widthPercent) ??
|
|
61
|
+
defaultPercent;
|
|
62
|
+
|
|
63
|
+
const DRAWER_SIZE = isVertical
|
|
64
|
+
? SCREEN_HEIGHT * resolvedPercent
|
|
65
|
+
: SCREEN_WIDTH * resolvedPercent;
|
|
66
|
+
|
|
67
|
+
const getClosedOffset = () => {
|
|
68
|
+
switch (position) {
|
|
69
|
+
case "top":
|
|
70
|
+
case "left":
|
|
71
|
+
return -DRAWER_SIZE;
|
|
72
|
+
case "bottom":
|
|
73
|
+
case "right":
|
|
74
|
+
return DRAWER_SIZE;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const translate = useSharedValue(getClosedOffset());
|
|
79
|
+
const backdropOpacity = useSharedValue(0);
|
|
80
|
+
const [isRendered, setIsRendered] = useState(false);
|
|
81
|
+
|
|
82
|
+
if (isOpen && !isRendered) {
|
|
83
|
+
setIsRendered(true);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const closedOffset = getClosedOffset();
|
|
88
|
+
if (isOpen) {
|
|
89
|
+
translate.value = withTiming(0, {
|
|
90
|
+
duration: 300,
|
|
91
|
+
easing: Easing.out(Easing.ease),
|
|
92
|
+
});
|
|
93
|
+
backdropOpacity.value = withTiming(0.4, { duration: 300 });
|
|
94
|
+
} else {
|
|
95
|
+
translate.value = withTiming(closedOffset, {
|
|
96
|
+
duration: 300,
|
|
97
|
+
easing: Easing.in(Easing.ease),
|
|
98
|
+
});
|
|
99
|
+
backdropOpacity.value = withTiming(0, { duration: 300 }, (finished) => {
|
|
100
|
+
if (finished) {
|
|
101
|
+
runOnJS(setIsRendered)(false);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, [isOpen, DRAWER_SIZE, position]);
|
|
106
|
+
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (!isOpen) return;
|
|
109
|
+
|
|
110
|
+
const backAction = () => {
|
|
111
|
+
onClose();
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const backHandler = BackHandler.addEventListener(
|
|
116
|
+
"hardwareBackPress",
|
|
117
|
+
backAction
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
return () => backHandler.remove();
|
|
121
|
+
}, [isOpen, onClose]);
|
|
122
|
+
|
|
123
|
+
const panGesture = Gesture.Pan()
|
|
124
|
+
.onUpdate((event) => {
|
|
125
|
+
if (position === "bottom") {
|
|
126
|
+
if (event.translationY > 0) {
|
|
127
|
+
translate.value = event.translationY;
|
|
128
|
+
}
|
|
129
|
+
} else if (position === "top") {
|
|
130
|
+
if (event.translationY < 0) {
|
|
131
|
+
translate.value = event.translationY;
|
|
132
|
+
}
|
|
133
|
+
} else if (position === "left") {
|
|
134
|
+
if (event.translationX < 0) {
|
|
135
|
+
translate.value = event.translationX;
|
|
136
|
+
}
|
|
137
|
+
} else if (position === "right") {
|
|
138
|
+
if (event.translationX > 0) {
|
|
139
|
+
translate.value = event.translationX;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
.onEnd((event) => {
|
|
144
|
+
let shouldClose = false;
|
|
145
|
+
if (position === "bottom") {
|
|
146
|
+
shouldClose =
|
|
147
|
+
event.translationY > DRAWER_SIZE * 0.3 || event.velocityY > 500;
|
|
148
|
+
} else if (position === "top") {
|
|
149
|
+
shouldClose =
|
|
150
|
+
event.translationY < -DRAWER_SIZE * 0.3 || event.velocityY < -500;
|
|
151
|
+
} else if (position === "left") {
|
|
152
|
+
shouldClose =
|
|
153
|
+
event.translationX < -DRAWER_SIZE * 0.3 || event.velocityX < -500;
|
|
154
|
+
} else if (position === "right") {
|
|
155
|
+
shouldClose =
|
|
156
|
+
event.translationX > DRAWER_SIZE * 0.3 || event.velocityX > 500;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (shouldClose) {
|
|
160
|
+
runOnJS(onClose)();
|
|
161
|
+
} else {
|
|
162
|
+
translate.value = withTiming(0, {
|
|
163
|
+
duration: 300,
|
|
164
|
+
easing: Easing.out(Easing.ease),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const drawerAnimatedStyle = useAnimatedStyle(() => {
|
|
170
|
+
if (position === "left" || position === "right") {
|
|
171
|
+
return {
|
|
172
|
+
transform: [{ translateX: translate.value }],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
transform: [{ translateY: translate.value }],
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const backdropAnimatedStyle = useAnimatedStyle(() => ({
|
|
181
|
+
opacity: backdropOpacity.value,
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
const getContainerStyle = (): ViewStyle => {
|
|
185
|
+
const baseShadow: ViewStyle = {
|
|
186
|
+
backgroundColor: colors.base100,
|
|
187
|
+
elevation: 24,
|
|
188
|
+
shadowColor: "#000",
|
|
189
|
+
shadowOpacity: 0.15,
|
|
190
|
+
shadowRadius: 15,
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
switch (position) {
|
|
194
|
+
case "top":
|
|
195
|
+
return {
|
|
196
|
+
...baseShadow,
|
|
197
|
+
position: "absolute",
|
|
198
|
+
top: 0,
|
|
199
|
+
left: 0,
|
|
200
|
+
right: 0,
|
|
201
|
+
height: DRAWER_SIZE,
|
|
202
|
+
borderBottomLeftRadius: 30,
|
|
203
|
+
borderBottomRightRadius: 30,
|
|
204
|
+
shadowOffset: { width: 0, height: 5 },
|
|
205
|
+
paddingTop: insets.top > 0 ? insets.top : 20,
|
|
206
|
+
};
|
|
207
|
+
case "bottom":
|
|
208
|
+
return {
|
|
209
|
+
...baseShadow,
|
|
210
|
+
position: "absolute",
|
|
211
|
+
bottom: 0,
|
|
212
|
+
left: 0,
|
|
213
|
+
right: 0,
|
|
214
|
+
height: DRAWER_SIZE,
|
|
215
|
+
borderTopLeftRadius: 30,
|
|
216
|
+
borderTopRightRadius: 30,
|
|
217
|
+
shadowOffset: { width: 0, height: -5 },
|
|
218
|
+
paddingBottom: insets.bottom > 0 ? insets.bottom : 20,
|
|
219
|
+
};
|
|
220
|
+
case "left":
|
|
221
|
+
return {
|
|
222
|
+
...baseShadow,
|
|
223
|
+
position: "absolute",
|
|
224
|
+
top: 0,
|
|
225
|
+
bottom: 0,
|
|
226
|
+
left: 0,
|
|
227
|
+
width: DRAWER_SIZE,
|
|
228
|
+
borderTopRightRadius: 30,
|
|
229
|
+
borderBottomRightRadius: 30,
|
|
230
|
+
shadowOffset: { width: 5, height: 0 },
|
|
231
|
+
paddingTop: insets.top > 0 ? insets.top : 20,
|
|
232
|
+
paddingBottom: insets.bottom > 0 ? insets.bottom : 20,
|
|
233
|
+
paddingLeft: insets.left > 0 ? insets.left : 0,
|
|
234
|
+
};
|
|
235
|
+
case "right":
|
|
236
|
+
return {
|
|
237
|
+
...baseShadow,
|
|
238
|
+
position: "absolute",
|
|
239
|
+
top: 0,
|
|
240
|
+
bottom: 0,
|
|
241
|
+
right: 0,
|
|
242
|
+
width: DRAWER_SIZE,
|
|
243
|
+
borderTopLeftRadius: 30,
|
|
244
|
+
borderBottomLeftRadius: 30,
|
|
245
|
+
shadowOffset: { width: -5, height: 0 },
|
|
246
|
+
paddingTop: insets.top > 0 ? insets.top : 20,
|
|
247
|
+
paddingBottom: insets.bottom > 0 ? insets.bottom : 20,
|
|
248
|
+
paddingRight: insets.right > 0 ? insets.right : 0,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
if (!isRendered && !isOpen) return null;
|
|
254
|
+
|
|
255
|
+
return (
|
|
256
|
+
<Portal>
|
|
257
|
+
<KeyboardAvoidingView
|
|
258
|
+
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
|
259
|
+
style={StyleSheet.absoluteFill}
|
|
260
|
+
pointerEvents="box-none"
|
|
261
|
+
>
|
|
262
|
+
<View style={[StyleSheet.absoluteFill, { zIndex }]}>
|
|
263
|
+
{/* Backdrop Overlay */}
|
|
264
|
+
<TouchableWithoutFeedback onPress={onClose}>
|
|
265
|
+
<Animated.View
|
|
266
|
+
style={[
|
|
267
|
+
StyleSheet.absoluteFill,
|
|
268
|
+
{ backgroundColor: "#000" },
|
|
269
|
+
backdropAnimatedStyle,
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
</TouchableWithoutFeedback>
|
|
273
|
+
|
|
274
|
+
{/* Sliding Drawer Panel */}
|
|
275
|
+
<Animated.View style={[getContainerStyle(), drawerAnimatedStyle]}>
|
|
276
|
+
{position === "bottom" && (
|
|
277
|
+
<View className="flex-1">
|
|
278
|
+
{showHandle && (
|
|
279
|
+
<GestureDetector gesture={panGesture}>
|
|
280
|
+
<View
|
|
281
|
+
className="items-center pt-4 pb-6 bg-base-100 rounded-t-[30px]"
|
|
282
|
+
style={{ zIndex: 10 }}
|
|
283
|
+
>
|
|
284
|
+
<View className="w-16 h-1.5 rounded-full bg-base-300" />
|
|
285
|
+
</View>
|
|
286
|
+
</GestureDetector>
|
|
287
|
+
)}
|
|
288
|
+
<View className="flex-1 px-6">{children}</View>
|
|
289
|
+
</View>
|
|
290
|
+
)}
|
|
291
|
+
|
|
292
|
+
{position === "top" && (
|
|
293
|
+
<View className="flex-1">
|
|
294
|
+
<View className="flex-1 px-6">{children}</View>
|
|
295
|
+
{showHandle && (
|
|
296
|
+
<GestureDetector gesture={panGesture}>
|
|
297
|
+
<View
|
|
298
|
+
className="items-center pt-4 pb-6 bg-base-100 rounded-b-[30px]"
|
|
299
|
+
style={{ zIndex: 10 }}
|
|
300
|
+
>
|
|
301
|
+
<View className="w-16 h-1.5 rounded-full bg-base-300" />
|
|
302
|
+
</View>
|
|
303
|
+
</GestureDetector>
|
|
304
|
+
)}
|
|
305
|
+
</View>
|
|
306
|
+
)}
|
|
307
|
+
|
|
308
|
+
{position === "left" && (
|
|
309
|
+
<View className="flex-1 flex-row">
|
|
310
|
+
<View className="flex-1 px-6">{children}</View>
|
|
311
|
+
{showHandle && (
|
|
312
|
+
<GestureDetector gesture={panGesture}>
|
|
313
|
+
<View
|
|
314
|
+
className="justify-center items-center px-3 bg-base-100 rounded-r-[30px]"
|
|
315
|
+
style={{ zIndex: 10 }}
|
|
316
|
+
>
|
|
317
|
+
<View className="w-1.5 h-16 rounded-full bg-base-300" />
|
|
318
|
+
</View>
|
|
319
|
+
</GestureDetector>
|
|
320
|
+
)}
|
|
321
|
+
</View>
|
|
322
|
+
)}
|
|
323
|
+
|
|
324
|
+
{position === "right" && (
|
|
325
|
+
<View className="flex-1 flex-row">
|
|
326
|
+
{showHandle && (
|
|
327
|
+
<GestureDetector gesture={panGesture}>
|
|
328
|
+
<View
|
|
329
|
+
className="justify-center items-center px-3 bg-base-100 rounded-l-[30px]"
|
|
330
|
+
style={{ zIndex: 10 }}
|
|
331
|
+
>
|
|
332
|
+
<View className="w-1.5 h-16 rounded-full bg-base-300" />
|
|
333
|
+
</View>
|
|
334
|
+
</GestureDetector>
|
|
335
|
+
)}
|
|
336
|
+
<View className="flex-1 px-6">{children}</View>
|
|
337
|
+
</View>
|
|
338
|
+
)}
|
|
339
|
+
</Animated.View>
|
|
340
|
+
</View>
|
|
341
|
+
</KeyboardAvoidingView>
|
|
342
|
+
</Portal>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
@@ -4,7 +4,7 @@ import { Txt } from "../../common/Typography";
|
|
|
4
4
|
import { Ionicons } from "@expo/vector-icons";
|
|
5
5
|
import { useColorScheme } from "nativewind";
|
|
6
6
|
import { Colors } from "../../../constants/Colors";
|
|
7
|
-
import
|
|
7
|
+
import Drawer from "../Drawer";
|
|
8
8
|
import Button from "../buttons/Button";
|
|
9
9
|
import dayjs from "dayjs";
|
|
10
10
|
|
|
@@ -104,7 +104,7 @@ export default function DatePicker({
|
|
|
104
104
|
<Ionicons name="calendar-outline" size={18} color={colors.primary} />
|
|
105
105
|
</TouchableOpacity>
|
|
106
106
|
|
|
107
|
-
<
|
|
107
|
+
<Drawer isOpen={isOpen} onClose={() => setIsOpen(false)} position="bottom" sizePercent={0.65}>
|
|
108
108
|
<View className="p-4 flex-1">
|
|
109
109
|
<Txt variant="lg" className="font-bold text-center mb-4">
|
|
110
110
|
{label}
|
|
@@ -180,7 +180,7 @@ export default function DatePicker({
|
|
|
180
180
|
<Button label="Close" variant="outline" onPress={() => setIsOpen(false)} className="w-full" />
|
|
181
181
|
</View>
|
|
182
182
|
</View>
|
|
183
|
-
</
|
|
183
|
+
</Drawer>
|
|
184
184
|
</View>
|
|
185
185
|
);
|
|
186
186
|
}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import * as ImagePicker from "expo-image-picker";
|
|
4
4
|
import { Txt } from "@/components/common/Typography";
|
|
5
|
-
import
|
|
5
|
+
import Drawer from "@/components/ui/Drawer";
|
|
6
6
|
import Button from "@/components/ui/buttons/Button";
|
|
7
7
|
|
|
8
8
|
export type ImagePickerSource = "camera" | "gallery" | "both";
|
|
@@ -93,7 +93,7 @@ export default function ImagePickerModal({
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
return (
|
|
96
|
-
<
|
|
96
|
+
<Drawer isOpen={isOpen} onClose={onClose} position="bottom">
|
|
97
97
|
<View className="p-6">
|
|
98
98
|
<Txt variant="lg" className="font-bold mb-1 text-center">
|
|
99
99
|
{title}
|
|
@@ -124,6 +124,6 @@ export default function ImagePickerModal({
|
|
|
124
124
|
)}
|
|
125
125
|
</View>
|
|
126
126
|
</View>
|
|
127
|
-
</
|
|
127
|
+
</Drawer>
|
|
128
128
|
);
|
|
129
129
|
}
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
"start": "tsx src/index.ts",
|
|
8
8
|
"dev": "tsx watch src/index.ts",
|
|
9
9
|
"build": "tsc",
|
|
10
|
+
"lint": "eslint src/**/*.ts",
|
|
11
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
12
|
+
"format": "prettier --write \"src/**/*.{ts,json}\"",
|
|
13
|
+
"format:check": "prettier --check \"src/**/*.{ts,json}\"",
|
|
14
|
+
"circular-check": "dpdm --circular --no-warning --no-tree --exit-code circular:1 \"src/**/*.ts\"",
|
|
15
|
+
"ts-prune": "ts-prune",
|
|
16
|
+
"ts-purns": "ts-prune",
|
|
10
17
|
"db:push": "prisma db push",
|
|
11
18
|
"db:generate": "prisma generate",
|
|
12
|
-
"generate:vapid": "node ./src/utils/generateVapidKeys.js"
|
|
13
|
-
"lint": "eslint src/**/*.ts"
|
|
19
|
+
"generate:vapid": "node ./src/utils/generateVapidKeys.js"
|
|
14
20
|
},
|
|
15
21
|
"dependencies": {
|
|
16
22
|
"@prisma/adapter-pg": "^7.9.1",
|
|
@@ -49,8 +55,11 @@
|
|
|
49
55
|
"@types/web-push": "^3.6.3",
|
|
50
56
|
"@typescript-eslint/eslint-plugin": "^8.66.0",
|
|
51
57
|
"@typescript-eslint/parser": "^8.66.0",
|
|
58
|
+
"dpdm": "^3.14.0",
|
|
52
59
|
"eslint": "^10.8.0",
|
|
60
|
+
"prettier": "^3.4.2",
|
|
53
61
|
"prisma": "^7.9.1",
|
|
62
|
+
"ts-prune": "^0.10.3",
|
|
54
63
|
"tsx": "^4.23.1",
|
|
55
64
|
"typescript": "^5.2.2",
|
|
56
65
|
"typescript-eslint": "^8.66.0"
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { NavLink } from "react-router-dom";
|
|
3
|
-
import { IoClose } from "react-icons/io5";
|
|
4
|
-
import { useUiStore } from "../../store/useUiStore";
|
|
5
|
-
import { navigation } from "../../config/navigation";
|
|
6
|
-
import { ChevronLeft, ChevronRight, Moon, Sun } from "lucide-react";
|
|
7
|
-
import appConfig from "../../config/appConfig";
|
|
8
|
-
import { motion, AnimatePresence } from "framer-motion";
|
|
9
|
-
import useWindowSize from "../../hooks/useWindowSize";
|
|
10
|
-
const Sidebar = () => {
|
|
11
|
-
const { open, close, collapsed, toggleCollapsed } = useUiStore();
|
|
12
|
-
const { theme, toggleTheme } = useUiStore();
|
|
13
|
-
const { width } = useWindowSize();
|
|
14
|
-
const isMobile = width < 1024;
|
|
15
|
-
const showSidebar = !isMobile || open;
|
|
16
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
19
|
-
children:
|
|
20
|
-
isMobile &&
|
|
21
|
-
open &&
|
|
22
|
-
/* @__PURE__ */ jsx(motion.div, {
|
|
23
|
-
initial: { opacity: 0 },
|
|
24
|
-
animate: { opacity: 1 },
|
|
25
|
-
exit: { opacity: 0 },
|
|
26
|
-
transition: { duration: 0.2 },
|
|
27
|
-
className: "fixed inset-0 bg-base-100/40 z-40 lg:hidden",
|
|
28
|
-
onClick: close,
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
32
|
-
children:
|
|
33
|
-
showSidebar &&
|
|
34
|
-
/* @__PURE__ */ jsxs(motion.aside, {
|
|
35
|
-
initial: isMobile ? { x: "-100%" } : false,
|
|
36
|
-
animate: { x: 0 },
|
|
37
|
-
exit: isMobile ? { x: "-100%" } : void 0,
|
|
38
|
-
transition: { type: "tween", duration: 0.25, ease: "easeInOut" },
|
|
39
|
-
className: `
|
|
40
|
-
fixed lg:static top-0 left-0 z-50
|
|
41
|
-
h-screen bg-base-200 border-r border-base-300
|
|
42
|
-
flex flex-col overflow-hidden
|
|
43
|
-
transition-[width] duration-300
|
|
44
|
-
${collapsed ? "w-20" : "w-[75%] md:w-[16%] md:max-w-60"}
|
|
45
|
-
`,
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsxs("div", {
|
|
48
|
-
className:
|
|
49
|
-
"h-16 border-b border-base-300 flex items-center justify-between px-5",
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsxs("div", {
|
|
52
|
-
className: "flex items-center gap-3",
|
|
53
|
-
children: [
|
|
54
|
-
appConfig.app.logo
|
|
55
|
-
? /* @__PURE__ */ jsx("img", {
|
|
56
|
-
src: appConfig.app.logo,
|
|
57
|
-
alt: "",
|
|
58
|
-
className: "w-8 h-8 rounded-lg",
|
|
59
|
-
})
|
|
60
|
-
: /* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: "flex items-center",
|
|
62
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
63
|
-
className:
|
|
64
|
-
"bg-primary w-8 h-8 rounded-lg flex items-center justify-center text-primary-content font-bold",
|
|
65
|
-
children: appConfig.app.name.charAt(0),
|
|
66
|
-
}),
|
|
67
|
-
}),
|
|
68
|
-
/* @__PURE__ */ jsx("h1", {
|
|
69
|
-
className: `text-xl font-black text-primary whitespace-nowrap overflow-hidden ${collapsed ? "hidden" : ""}`,
|
|
70
|
-
children: appConfig.app.name,
|
|
71
|
-
}),
|
|
72
|
-
],
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ jsx("button", {
|
|
75
|
-
className: `btn btn-sm btn-circle btn-ghost md:hidden ${collapsed ? "hidden" : ""}`,
|
|
76
|
-
onClick: close,
|
|
77
|
-
children: /* @__PURE__ */ jsx(IoClose, { size: 20 }),
|
|
78
|
-
}),
|
|
79
|
-
],
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ jsx("nav", {
|
|
82
|
-
className: "flex-1 overflow-y-auto p-2.5 space-y-1",
|
|
83
|
-
"data-lenis-prevent": true,
|
|
84
|
-
children: navigation.map((item) => {
|
|
85
|
-
const Icon = item.icon;
|
|
86
|
-
return /* @__PURE__ */ jsxs(
|
|
87
|
-
NavLink,
|
|
88
|
-
{
|
|
89
|
-
to: item.path,
|
|
90
|
-
onClick: isMobile ? close : void 0,
|
|
91
|
-
className: ({
|
|
92
|
-
isActive,
|
|
93
|
-
}) => `flex items-center gap-3 rounded-box px-4 py-3 duration-0 h-12
|
|
94
|
-
${isActive ? "bg-primary text-primary-content" : "hover:bg-base-300"} ${collapsed ? "justify-center px-0" : ""}`,
|
|
95
|
-
title: collapsed ? item.title : "",
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
98
|
-
size: 18,
|
|
99
|
-
className: `shrink-0 ${collapsed && "mr-auto"}`,
|
|
100
|
-
}),
|
|
101
|
-
!collapsed &&
|
|
102
|
-
/* @__PURE__ */ jsx("span", {
|
|
103
|
-
className:
|
|
104
|
-
"font-medium transition-all duration-0 whitespace-nowrap",
|
|
105
|
-
children: item.title,
|
|
106
|
-
}),
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
item.path,
|
|
110
|
-
);
|
|
111
|
-
}),
|
|
112
|
-
}),
|
|
113
|
-
/* @__PURE__ */ jsxs("button", {
|
|
114
|
-
onClick: toggleTheme,
|
|
115
|
-
className: `w-full flex items-center gap-3 px-3 py-2.5 md:px-4 text-sm font-semibold transition-all duration-150 text-base-content/60 hover:text-base-content hover:bg-base-300/60 justify-between rounded-none ${collapsed ? "justify-center" : ""}`,
|
|
116
|
-
title: "Toggle Theme",
|
|
117
|
-
children: [
|
|
118
|
-
!collapsed &&
|
|
119
|
-
/* @__PURE__ */ jsx("span", {
|
|
120
|
-
children: theme === "dark" ? "Dark" : "Light",
|
|
121
|
-
}),
|
|
122
|
-
/* @__PURE__ */ jsx("span", {
|
|
123
|
-
className: "btn btn-xs btn-ghost btn-circle ",
|
|
124
|
-
children:
|
|
125
|
-
theme === "dark"
|
|
126
|
-
? /* @__PURE__ */ jsx(Sun, {
|
|
127
|
-
size: 16,
|
|
128
|
-
className: "shrink-0 ",
|
|
129
|
-
})
|
|
130
|
-
: /* @__PURE__ */ jsx(Moon, {
|
|
131
|
-
size: 16,
|
|
132
|
-
className: "shrink-0",
|
|
133
|
-
}),
|
|
134
|
-
}),
|
|
135
|
-
],
|
|
136
|
-
}),
|
|
137
|
-
/* @__PURE__ */ jsx("div", {
|
|
138
|
-
className:
|
|
139
|
-
"p-3 border-t border-base-300/50 shrink-0 flex flex-col gap-2",
|
|
140
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
141
|
-
onClick: toggleCollapsed,
|
|
142
|
-
className: `w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-semibold transition-all duration-150 text-base-content/60 hover:text-base-content hover:bg-base-300/60 ${collapsed ? "justify-center" : ""}`,
|
|
143
|
-
title: collapsed ? "Expand Sidebar" : "Collapse Sidebar",
|
|
144
|
-
children: [
|
|
145
|
-
collapsed
|
|
146
|
-
? /* @__PURE__ */ jsx(ChevronRight, {
|
|
147
|
-
size: 18,
|
|
148
|
-
className: "shrink-0 mr-auto",
|
|
149
|
-
})
|
|
150
|
-
: /* @__PURE__ */ jsx(ChevronLeft, {
|
|
151
|
-
size: 18,
|
|
152
|
-
className: "shrink-0",
|
|
153
|
-
}),
|
|
154
|
-
!collapsed &&
|
|
155
|
-
/* @__PURE__ */ jsx("span", {
|
|
156
|
-
className: "truncate",
|
|
157
|
-
children: "Collapse",
|
|
158
|
-
}),
|
|
159
|
-
],
|
|
160
|
-
}),
|
|
161
|
-
}),
|
|
162
|
-
],
|
|
163
|
-
}),
|
|
164
|
-
}),
|
|
165
|
-
],
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
var sidebar_default = Sidebar;
|
|
169
|
-
export { sidebar_default as default };
|