@imksh/create 1.0.24 → 1.0.25

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.
Files changed (160) hide show
  1. package/package.json +1 -1
  2. package/templates/mern-react-native/client/src/vite-env.d.ts +1 -0
  3. package/templates/mern-react-native/mobile/babel.config.js +1 -0
  4. package/templates/mern-react-native/mobile/drizzle.config.ts +8 -0
  5. package/templates/mern-react-native/mobile/expo-env.d.ts +3 -0
  6. package/templates/mern-react-native/mobile/package.json +6 -0
  7. package/templates/mern-react-native/mobile/src/app/(auth)/_layout.tsx +12 -0
  8. package/templates/mern-react-native/mobile/src/app/(auth)/change-password.tsx +112 -0
  9. package/templates/mern-react-native/mobile/src/app/(auth)/edit-profile.tsx +160 -0
  10. package/templates/mern-react-native/mobile/src/app/(auth)/forgot-password.tsx +191 -0
  11. package/templates/mern-react-native/mobile/src/app/{login.tsx → (auth)/login.tsx} +69 -21
  12. package/templates/mern-react-native/mobile/src/app/(tabs)/index.tsx +18 -17
  13. package/templates/mern-react-native/mobile/src/app/(tabs)/profile.tsx +23 -60
  14. package/templates/mern-react-native/mobile/src/app/_layout.tsx +22 -4
  15. package/templates/mern-react-native/mobile/src/components/common/AnimatedHeader.tsx +328 -0
  16. package/templates/mern-react-native/mobile/src/components/common/LocationLoader.tsx +591 -0
  17. package/templates/mern-react-native/mobile/src/components/common/ScreenHeader.tsx +41 -17
  18. package/templates/mern-react-native/mobile/src/components/common/TabHeader.tsx +58 -0
  19. package/templates/mern-react-native/mobile/src/components/common/Typography.tsx +49 -30
  20. package/templates/mern-react-native/mobile/src/components/common/Welcome.tsx +2 -2
  21. package/templates/mern-react-native/mobile/src/components/ui/BottomModal.tsx +31 -20
  22. package/templates/mern-react-native/mobile/src/components/ui/ClassicTabBar.tsx +4 -3
  23. package/templates/mern-react-native/mobile/src/components/ui/CustomTabBar.tsx +108 -71
  24. package/templates/mern-react-native/mobile/src/components/ui/Sidebar.tsx +81 -56
  25. package/templates/mern-react-native/mobile/src/components/ui/buttons/Button.tsx +106 -37
  26. package/templates/mern-react-native/mobile/src/components/ui/buttons/IconButton.tsx +4 -2
  27. package/templates/mern-react-native/mobile/src/components/ui/data-display/Accordion.tsx +3 -2
  28. package/templates/mern-react-native/mobile/src/components/ui/data-display/Avatar.tsx +4 -3
  29. package/templates/mern-react-native/mobile/src/components/ui/data-display/Badge.tsx +45 -17
  30. package/templates/mern-react-native/mobile/src/components/ui/data-display/ImageViewer.tsx +19 -9
  31. package/templates/mern-react-native/mobile/src/components/ui/feedback/CircularProgress.tsx +5 -4
  32. package/templates/mern-react-native/mobile/src/components/ui/feedback/ProgressBar.tsx +4 -3
  33. package/templates/mern-react-native/mobile/src/components/ui/feedback/Skeleton.tsx +3 -0
  34. package/templates/mern-react-native/mobile/src/components/ui/feedback/Spinner.tsx +11 -3
  35. package/templates/mern-react-native/mobile/src/components/ui/inputs/Checkbox.tsx +3 -2
  36. package/templates/mern-react-native/mobile/src/components/ui/inputs/DatePicker.tsx +186 -0
  37. package/templates/mern-react-native/mobile/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
  38. package/templates/mern-react-native/mobile/src/components/ui/inputs/Input.tsx +54 -14
  39. package/templates/mern-react-native/mobile/src/components/ui/inputs/LocationPicker.tsx +211 -0
  40. package/templates/mern-react-native/mobile/src/components/ui/inputs/OTPInput.tsx +32 -9
  41. package/templates/mern-react-native/mobile/src/components/ui/inputs/PasswordInput.tsx +2 -1
  42. package/templates/mern-react-native/mobile/src/components/ui/inputs/Radio.tsx +3 -2
  43. package/templates/mern-react-native/mobile/src/components/ui/inputs/SearchBar.tsx +41 -4
  44. package/templates/mern-react-native/mobile/src/components/ui/inputs/Slider.tsx +4 -3
  45. package/templates/mern-react-native/mobile/src/components/ui/inputs/Switch.tsx +3 -2
  46. package/templates/mern-react-native/mobile/src/components/ui/inputs/TextArea.tsx +2 -1
  47. package/templates/mern-react-native/mobile/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
  48. package/templates/mern-react-native/mobile/src/components/ui/layout/Grid.tsx +52 -10
  49. package/templates/mern-react-native/mobile/src/components/ui/layout/Section.tsx +7 -8
  50. package/templates/mern-react-native/mobile/src/components/ui/navigation/Pagination.tsx +4 -3
  51. package/templates/mern-react-native/mobile/src/components/ui/navigation/ProgressStepper.tsx +6 -5
  52. package/templates/mern-react-native/mobile/src/components/ui/navigation/Tabs.tsx +30 -4
  53. package/templates/mern-react-native/mobile/src/config/api.ts +12 -1
  54. package/templates/mern-react-native/mobile/src/config/sidebar.config.ts +72 -0
  55. package/templates/mern-react-native/mobile/src/config/tabNavigation.ts +37 -7
  56. package/templates/mern-react-native/mobile/src/db/index.ts +9 -0
  57. package/templates/mern-react-native/mobile/src/db/schema.ts +14 -0
  58. package/templates/mern-react-native/mobile/src/hooks/useDebounce.ts +17 -0
  59. package/templates/mern-react-native/mobile/src/services/socket.service.ts +36 -0
  60. package/templates/mern-react-native/mobile/src/store/useAuthStore.ts +122 -27
  61. package/templates/mern-react-native/mobile/src/store/useNotificationStore.ts +53 -0
  62. package/templates/mern-react-native/mobile/src/types/auth.type.ts +14 -0
  63. package/templates/mern-react-native/mobile/tsconfig.json +1 -0
  64. package/templates/mern-ts/client/src/vite-env.d.ts +1 -0
  65. package/templates/react-native/babel.config.js +1 -0
  66. package/templates/react-native/drizzle.config.ts +8 -0
  67. package/templates/react-native/expo-env.d.ts +3 -0
  68. package/templates/react-native/package.json +6 -0
  69. package/templates/react-native/src/app/(auth)/_layout.tsx +12 -0
  70. package/templates/react-native/src/app/(auth)/change-password.tsx +112 -0
  71. package/templates/react-native/src/app/(auth)/edit-profile.tsx +160 -0
  72. package/templates/react-native/src/app/(auth)/forgot-password.tsx +191 -0
  73. package/templates/react-native/src/app/{login.tsx → (auth)/login.tsx} +69 -21
  74. package/templates/react-native/src/app/(tabs)/index.tsx +18 -17
  75. package/templates/react-native/src/app/(tabs)/profile.tsx +23 -60
  76. package/templates/react-native/src/app/_layout.tsx +22 -4
  77. package/templates/react-native/src/components/common/AnimatedHeader.tsx +328 -0
  78. package/templates/react-native/src/components/common/LocationLoader.tsx +591 -0
  79. package/templates/react-native/src/components/common/ScreenHeader.tsx +41 -17
  80. package/templates/react-native/src/components/common/TabHeader.tsx +58 -0
  81. package/templates/react-native/src/components/common/Typography.tsx +49 -30
  82. package/templates/react-native/src/components/common/Welcome.tsx +2 -2
  83. package/templates/react-native/src/components/ui/BottomModal.tsx +31 -20
  84. package/templates/react-native/src/components/ui/ClassicTabBar.tsx +4 -3
  85. package/templates/react-native/src/components/ui/CustomTabBar.tsx +108 -71
  86. package/templates/react-native/src/components/ui/Sidebar.tsx +81 -56
  87. package/templates/react-native/src/components/ui/buttons/Button.tsx +106 -37
  88. package/templates/react-native/src/components/ui/buttons/IconButton.tsx +4 -2
  89. package/templates/react-native/src/components/ui/data-display/Accordion.tsx +3 -2
  90. package/templates/react-native/src/components/ui/data-display/Avatar.tsx +4 -3
  91. package/templates/react-native/src/components/ui/data-display/Badge.tsx +45 -17
  92. package/templates/react-native/src/components/ui/data-display/ImageViewer.tsx +19 -9
  93. package/templates/react-native/src/components/ui/feedback/CircularProgress.tsx +5 -4
  94. package/templates/react-native/src/components/ui/feedback/ProgressBar.tsx +4 -3
  95. package/templates/react-native/src/components/ui/feedback/Skeleton.tsx +3 -0
  96. package/templates/react-native/src/components/ui/feedback/Spinner.tsx +11 -3
  97. package/templates/react-native/src/components/ui/inputs/Checkbox.tsx +3 -2
  98. package/templates/react-native/src/components/ui/inputs/DatePicker.tsx +186 -0
  99. package/templates/react-native/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
  100. package/templates/react-native/src/components/ui/inputs/Input.tsx +54 -14
  101. package/templates/react-native/src/components/ui/inputs/LocationPicker.tsx +211 -0
  102. package/templates/react-native/src/components/ui/inputs/OTPInput.tsx +32 -9
  103. package/templates/react-native/src/components/ui/inputs/PasswordInput.tsx +2 -1
  104. package/templates/react-native/src/components/ui/inputs/Radio.tsx +3 -2
  105. package/templates/react-native/src/components/ui/inputs/SearchBar.tsx +41 -4
  106. package/templates/react-native/src/components/ui/inputs/Slider.tsx +4 -3
  107. package/templates/react-native/src/components/ui/inputs/Switch.tsx +3 -2
  108. package/templates/react-native/src/components/ui/inputs/TextArea.tsx +2 -1
  109. package/templates/react-native/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
  110. package/templates/react-native/src/components/ui/layout/Grid.tsx +52 -10
  111. package/templates/react-native/src/components/ui/layout/Section.tsx +7 -8
  112. package/templates/react-native/src/components/ui/navigation/Pagination.tsx +4 -3
  113. package/templates/react-native/src/components/ui/navigation/ProgressStepper.tsx +6 -5
  114. package/templates/react-native/src/components/ui/navigation/Tabs.tsx +30 -4
  115. package/templates/react-native/src/config/api.ts +12 -1
  116. package/templates/react-native/src/config/sidebar.config.ts +72 -0
  117. package/templates/react-native/src/config/tabNavigation.ts +37 -7
  118. package/templates/react-native/src/db/index.ts +9 -0
  119. package/templates/react-native/src/db/schema.ts +14 -0
  120. package/templates/react-native/src/hooks/useDebounce.ts +17 -0
  121. package/templates/react-native/src/services/socket.service.ts +36 -0
  122. package/templates/react-native/src/store/useAuthStore.ts +122 -27
  123. package/templates/react-native/src/store/useNotificationStore.ts +53 -0
  124. package/templates/react-native/src/types/auth.type.ts +14 -0
  125. package/templates/react-native/tsconfig.json +1 -0
  126. package/templates/react-ts/src/vite-env.d.ts +1 -0
  127. package/templates/mern-react-native/mobile/.env.example +0 -2
  128. package/templates/mern-react-native/mobile/.vscode/extensions.json +0 -1
  129. package/templates/mern-react-native/mobile/.vscode/settings.json +0 -7
  130. package/templates/mern-react-native/mobile/README.md +0 -159
  131. package/templates/mern-react-native/mobile/docs/README.md +0 -17
  132. package/templates/mern-react-native/mobile/docs/components/buttons.md +0 -40
  133. package/templates/mern-react-native/mobile/docs/components/data-display.md +0 -44
  134. package/templates/mern-react-native/mobile/docs/components/feedback.md +0 -36
  135. package/templates/mern-react-native/mobile/docs/components/gestures.md +0 -60
  136. package/templates/mern-react-native/mobile/docs/components/inputs.md +0 -41
  137. package/templates/mern-react-native/mobile/docs/components/layout.md +0 -34
  138. package/templates/mern-react-native/mobile/docs/components/navigation.md +0 -31
  139. package/templates/mern-react-native/mobile/docs/features.md +0 -85
  140. package/templates/mern-react-native/mobile/docs/getting-started.md +0 -47
  141. package/templates/mern-react-native/mobile/src/components/common/HomeHeader.tsx +0 -43
  142. package/templates/mern-react-native/mobile/src/components/settings/SettingToggle.tsx +0 -26
  143. package/templates/mern-react-native/mobile/src/components/settings/SettingsOptions.tsx +0 -47
  144. package/templates/react-native/.env.example +0 -2
  145. package/templates/react-native/.vscode/extensions.json +0 -1
  146. package/templates/react-native/.vscode/settings.json +0 -7
  147. package/templates/react-native/README.md +0 -159
  148. package/templates/react-native/docs/README.md +0 -17
  149. package/templates/react-native/docs/components/buttons.md +0 -40
  150. package/templates/react-native/docs/components/data-display.md +0 -44
  151. package/templates/react-native/docs/components/feedback.md +0 -36
  152. package/templates/react-native/docs/components/gestures.md +0 -60
  153. package/templates/react-native/docs/components/inputs.md +0 -41
  154. package/templates/react-native/docs/components/layout.md +0 -34
  155. package/templates/react-native/docs/components/navigation.md +0 -31
  156. package/templates/react-native/docs/features.md +0 -85
  157. package/templates/react-native/docs/getting-started.md +0 -47
  158. package/templates/react-native/src/components/common/HomeHeader.tsx +0 -43
  159. package/templates/react-native/src/components/settings/SettingToggle.tsx +0 -26
  160. package/templates/react-native/src/components/settings/SettingsOptions.tsx +0 -47
@@ -0,0 +1,321 @@
1
+ import React, { useState, useEffect, useRef, useMemo } from "react";
2
+ import { View, Modal, TouchableOpacity, ActivityIndicator } from "react-native";
3
+ import * as Location from "expo-location";
4
+ import { Ionicons } from "@expo/vector-icons";
5
+ import { useColorScheme } from "nativewind";
6
+ import { Colors } from "../../../constants/Colors";
7
+ import { Txt } from "../../common/Typography";
8
+ import Button from "../buttons/Button";
9
+ import Input from "./Input";
10
+ import { toast } from "@/utils/toast";
11
+ import { WebView, WebViewMessageEvent } from "react-native-webview";
12
+ import { LocationLoader } from "../../common/LocationLoader";
13
+
14
+ export interface LocationDetails {
15
+ addressLine1: string;
16
+ addressLine2?: string;
17
+ locality: string;
18
+ city: string;
19
+ state: string;
20
+ pinCode: string;
21
+ latitude: number;
22
+ longitude: number;
23
+ }
24
+
25
+ interface WebLocationPickerProps {
26
+ onLocationSelected: (details: LocationDetails) => void;
27
+ initialCoordinate?: { latitude: number; longitude: number };
28
+ renderTrigger?: (onPress: () => void) => React.ReactNode;
29
+ }
30
+
31
+ export default function WebLocationPicker({
32
+ onLocationSelected,
33
+ initialCoordinate,
34
+ renderTrigger,
35
+ }: WebLocationPickerProps) {
36
+ const { colorScheme } = useColorScheme();
37
+ const theme = Colors[colorScheme ?? "light"];
38
+
39
+ const [modalVisible, setModalVisible] = useState(false);
40
+ const [loading, setLoading] = useState(false);
41
+ const [searchQuery, setSearchQuery] = useState("");
42
+ const [searching, setSearching] = useState(false);
43
+
44
+ const [loadingLocation, setLoadingLocation] = useState(false);
45
+ const [animationDone, setAnimationDone] = useState(false);
46
+ const [positionFetched, setPositionFetched] = useState(false);
47
+
48
+ const [mapCenter, setMapCenter] = useState({
49
+ latitude: initialCoordinate?.latitude || 28.6139,
50
+ longitude: initialCoordinate?.longitude || 77.209,
51
+ });
52
+
53
+ const [currentCenter, setCurrentCenter] = useState(mapCenter);
54
+
55
+ const webViewRef = useRef<WebView>(null);
56
+
57
+ useEffect(() => {
58
+ if (initialCoordinate?.latitude && initialCoordinate?.longitude) {
59
+
60
+ setMapCenter(initialCoordinate);
61
+ setCurrentCenter(initialCoordinate);
62
+ }
63
+ }, [initialCoordinate]);
64
+
65
+ useEffect(() => {
66
+ if (animationDone && positionFetched) {
67
+ setLoadingLocation(false);
68
+ }
69
+ }, [animationDone, positionFetched]);
70
+
71
+ const requestLocationAndOpenMap = async () => {
72
+ setModalVisible(true);
73
+ setLoadingLocation(true);
74
+ setAnimationDone(false);
75
+ setPositionFetched(false);
76
+
77
+ // Asynchronously fetch current position
78
+ (async () => {
79
+ try {
80
+ let { status } = await Location.requestForegroundPermissionsAsync();
81
+ if (status !== "granted") {
82
+ setPositionFetched(true);
83
+ return;
84
+ }
85
+
86
+ if (!initialCoordinate?.latitude) {
87
+ let location = await Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.Balanced });
88
+ setMapCenter({
89
+ latitude: location.coords.latitude,
90
+ longitude: location.coords.longitude,
91
+ });
92
+ setCurrentCenter({
93
+ latitude: location.coords.latitude,
94
+ longitude: location.coords.longitude,
95
+ });
96
+ }
97
+ } catch (e) {
98
+ console.warn(e);
99
+ } finally {
100
+ setPositionFetched(true);
101
+ }
102
+ })();
103
+ };
104
+
105
+ const handleConfirmLocation = async () => {
106
+ setLoading(true);
107
+ try {
108
+ const [address] = await Location.reverseGeocodeAsync({
109
+ latitude: currentCenter.latitude,
110
+ longitude: currentCenter.longitude,
111
+ });
112
+
113
+ if (address) {
114
+ const details: LocationDetails = {
115
+ addressLine1: address.street || address.name || "",
116
+ locality: address.subregion || address.district || "",
117
+ city: address.city || address.subregion || "",
118
+ state: address.region || "",
119
+ pinCode: address.postalCode || "",
120
+ latitude: currentCenter.latitude,
121
+ longitude: currentCenter.longitude,
122
+ };
123
+ onLocationSelected(details);
124
+ setModalVisible(false);
125
+ }
126
+ } catch (error) {
127
+ console.warn("Geocoding failed", error);
128
+ }
129
+ setLoading(false);
130
+ };
131
+
132
+ const handleSearch = async () => {
133
+ if (!searchQuery.trim()) return;
134
+ setSearching(true);
135
+ try {
136
+ const results = await Location.geocodeAsync(searchQuery);
137
+ if (results && results.length > 0) {
138
+ const { latitude, longitude } = results[0];
139
+ setCurrentCenter({ latitude, longitude });
140
+ webViewRef.current?.injectJavaScript(`
141
+ map.setView([${latitude}, ${longitude}], 15);
142
+ true;
143
+ `);
144
+ } else {
145
+ toast.success("Location not found");
146
+ }
147
+ } catch (error) {
148
+ console.warn("Search failed", error);
149
+ toast.error("Failed to search location");
150
+ }
151
+ setSearching(false);
152
+ };
153
+
154
+ const handleMessage = (event: WebViewMessageEvent) => {
155
+ try {
156
+ const data = JSON.parse(event.nativeEvent.data);
157
+ if (data.type === "centerChanged") {
158
+ setCurrentCenter({
159
+ latitude: data.lat,
160
+ longitude: data.lng,
161
+ });
162
+ }
163
+ } catch {}
164
+ };
165
+
166
+ const htmlContent = useMemo(() => `
167
+ <!DOCTYPE html>
168
+ <html>
169
+ <head>
170
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
171
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
172
+ <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
173
+ <style>
174
+ body, html, #map { margin: 0; padding: 0; height: 100%; width: 100%; background: #f0f0f0; }
175
+ .center-marker {
176
+ position: absolute;
177
+ top: 50%;
178
+ left: 50%;
179
+ transform: translate(-50%, -100%);
180
+ z-index: 1000;
181
+ font-size: 36px;
182
+ pointer-events: none;
183
+ }
184
+ </style>
185
+ </head>
186
+ <body>
187
+ <div id="map"></div>
188
+ <div class="center-marker">📍</div>
189
+ <script>
190
+ var map = L.map('map', { zoomControl: false, attributionControl: false }).setView([${mapCenter.latitude}, ${mapCenter.longitude}], 15);
191
+ L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png', {
192
+ maxZoom: 19
193
+ }).addTo(map);
194
+
195
+ map.on('moveend', function() {
196
+ var center = map.getCenter();
197
+ window.ReactNativeWebView.postMessage(JSON.stringify({
198
+ type: 'centerChanged',
199
+ lat: center.lat,
200
+ lng: center.lng
201
+ }));
202
+ });
203
+ </script>
204
+ </body>
205
+ </html>
206
+ `, [mapCenter.latitude, mapCenter.longitude]);
207
+
208
+ return (
209
+ <>
210
+ {renderTrigger ? (
211
+ renderTrigger(requestLocationAndOpenMap)
212
+ ) : (
213
+ <TouchableOpacity
214
+ onPress={requestLocationAndOpenMap}
215
+ className="w-full h-14 bg-base-200 rounded-xl mb-4 flex-row items-center justify-between px-4 border border-base-300"
216
+ >
217
+ <View className="flex-row items-center">
218
+ <Ionicons
219
+ name="map-outline"
220
+ size={24}
221
+ color={theme.primary}
222
+ style={{ marginRight: 12 }}
223
+ />
224
+ <Txt color={theme.baseContent} weight="semibold">
225
+ {initialCoordinate?.latitude
226
+ ? "Update Location on Map"
227
+ : "Pick from Map"}
228
+ </Txt>
229
+ </View>
230
+ {loading && !modalVisible ? (
231
+ <ActivityIndicator color={theme.primary} />
232
+ ) : (
233
+ <Ionicons name="chevron-forward" size={20} color={theme.secondary} />
234
+ )}
235
+ </TouchableOpacity>
236
+ )}
237
+
238
+ <Modal
239
+ animationType="slide"
240
+ transparent={false}
241
+ visible={modalVisible}
242
+ onRequestClose={() => setModalVisible(false)}
243
+ >
244
+ {loadingLocation ? (
245
+ <View style={{ flex: 1 }}>
246
+ <LocationLoader
247
+ onReady={() => {
248
+ setAnimationDone(true);
249
+ }}
250
+ />
251
+ </View>
252
+ ) : (
253
+ <View className="flex-1 bg-base-100">
254
+ <View
255
+ className="h-16 flex-row items-center justify-between px-4 border-b border-base-300 pt-4 bg-base-100"
256
+ style={{ zIndex: 10 }}
257
+ >
258
+ <TouchableOpacity onPress={() => setModalVisible(false)}>
259
+ <Ionicons name="close" size={28} color={theme.baseContent} />
260
+ </TouchableOpacity>
261
+ <Txt weight="bold" style={{ fontSize: 18 }}>
262
+ Select Location
263
+ </Txt>
264
+ <View style={{ width: 28 }} />
265
+ </View>
266
+
267
+ <View className="px-4 py-3 bg-base-100 flex-row items-center border-b border-base-200 gap-4">
268
+ <View className="flex-1" style={{ marginBottom: -16 }}>
269
+ <Input
270
+ placeholder="Search city, area, etc."
271
+ value={searchQuery}
272
+ onChangeText={setSearchQuery}
273
+ onSubmitEditing={handleSearch}
274
+ returnKeyType="search"
275
+ containerStyle={{ marginBottom: 0 }}
276
+ leftIcon="search"
277
+ />
278
+ </View>
279
+ <Button
280
+ onPress={handleSearch}
281
+ isLoading={searching}
282
+ label="Go"
283
+ variant="primary"
284
+ soft
285
+ size="md"
286
+ className="my-auto"
287
+ />
288
+ </View>
289
+
290
+ <View className="flex-1 relative">
291
+ <WebView
292
+ ref={webViewRef}
293
+ source={{ html: htmlContent }}
294
+ onMessage={handleMessage}
295
+ style={{ flex: 1 }}
296
+ javaScriptEnabled={true}
297
+ scrollEnabled={false}
298
+ bounces={false}
299
+ startInLoadingState={true}
300
+ renderLoading={() => (
301
+ <View style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f0f0f0' }}>
302
+ <ActivityIndicator size="large" color={theme.primary} />
303
+ </View>
304
+ )}
305
+ />
306
+ </View>
307
+
308
+ <View className="p-4 bg-base-100 border-t border-base-300 pb-8">
309
+ <Button
310
+ label="Confirm Location"
311
+ onPress={handleConfirmLocation}
312
+ isLoading={loading}
313
+ variant="primary"
314
+ />
315
+ </View>
316
+ </View>
317
+ )}
318
+ </Modal>
319
+ </>
320
+ );
321
+ }
@@ -2,19 +2,61 @@ import React from "react";
2
2
  import { View, ViewProps } from "react-native";
3
3
 
4
4
  export interface GridProps extends ViewProps {
5
- columns?: number;
5
+ cols?: number;
6
6
  gap?: number;
7
- children: React.ReactNode[];
7
+ children: React.ReactNode;
8
8
  }
9
9
 
10
- export default function Grid({ columns = 2, gap = 12, children, style, ...props }: GridProps) {
10
+ export interface GridItemProps extends ViewProps {
11
+ colSpan?: number;
12
+ children: React.ReactNode;
13
+ }
14
+
15
+ export function GridItem({
16
+ children,
17
+ ...props
18
+ }: GridItemProps) {
19
+ return <View {...props}>{children}</View>;
20
+ }
21
+
22
+ export default function Grid({
23
+ cols = 2,
24
+ gap = 12,
25
+ children,
26
+ style,
27
+ ...props
28
+ }: GridProps) {
11
29
  return (
12
- <View style={[{ flexDirection: "row", flexWrap: "wrap", margin: -gap / 2 }, style]} {...props}>
13
- {React.Children.map(children, (child) => (
14
- <View style={{ width: `${100 / columns}%`, padding: gap / 2 }}>
15
- {child}
16
- </View>
17
- ))}
30
+ <View
31
+ style={[
32
+ {
33
+ flexDirection: "row",
34
+ flexWrap: "wrap",
35
+ margin: -gap / 2,
36
+ },
37
+ style,
38
+ ]}
39
+ {...props}
40
+ >
41
+ {React.Children.map(children, (child) => {
42
+ if (!React.isValidElement(child)) return null;
43
+
44
+ const colSpan = Math.min(
45
+ (child as React.ReactElement<GridItemProps>).props.colSpan ?? 1,
46
+ cols
47
+ );
48
+
49
+ return (
50
+ <View
51
+ style={{
52
+ width: `${(100 / cols) * colSpan}%`,
53
+ padding: gap / 2,
54
+ }}
55
+ >
56
+ {child}
57
+ </View>
58
+ );
59
+ })}
18
60
  </View>
19
61
  );
20
- }
62
+ }
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- import { View, Text, ViewProps } from "react-native";
2
+ import { View, ViewProps } from "react-native";
3
3
  import { useColorScheme } from "nativewind";
4
4
  import { Colors } from "../../../constants/Colors";
5
+ import { Txt } from "../../common/Typography";
5
6
 
6
7
  export interface SectionProps extends ViewProps {
7
8
  title?: string;
@@ -32,16 +33,14 @@ export default function Section({
32
33
  }}
33
34
  >
34
35
  {title && (
35
- <Text
36
- style={{
37
- fontSize: 18,
38
- fontWeight: "700",
39
- color: theme.baseContent,
40
- }}
36
+ <Txt
37
+ color={theme.baseContent}
38
+ weight="bold"
39
+ variant="lg"
41
40
  className={titleClass}
42
41
  >
43
42
  {title}
44
- </Text>
43
+ </Txt>
45
44
  )}
46
45
  {action}
47
46
  </View>
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
- import { View, TouchableOpacity, Text } from "react-native";
2
+ import { View, TouchableOpacity } from "react-native";
3
3
  import { useColorScheme } from "nativewind";
4
4
  import { Colors } from "../../../constants/Colors";
5
5
  import { Ionicons } from "@expo/vector-icons";
6
+ import { Txt } from "../../common/Typography";
6
7
 
7
8
  export interface PaginationProps {
8
9
  currentPage: number;
@@ -41,9 +42,9 @@ export default function Pagination({ currentPage, totalPages, onPageChange }: Pa
41
42
  justifyContent: "center",
42
43
  }}
43
44
  >
44
- <Text style={{ color: isActive ? theme.primaryContent : theme.baseContent, fontWeight: isActive ? "700" : "500" }}>
45
+ <Txt color={isActive ? theme.primaryContent : theme.baseContent} weight={isActive ? "bold" : "semibold"}>
45
46
  {p}
46
- </Text>
47
+ </Txt>
47
48
  </TouchableOpacity>
48
49
  );
49
50
  })}
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
- import { View, Text } from "react-native";
2
+ import { View } from "react-native";
3
3
  import { useColorScheme } from "nativewind";
4
4
  import { Colors } from "../../../constants/Colors";
5
5
  import { Ionicons } from "@expo/vector-icons";
6
+ import { Txt } from "../../common/Typography";
6
7
 
7
8
  export interface ProgressStepperProps {
8
9
  steps: string[];
@@ -36,14 +37,14 @@ export default function ProgressStepper({ steps, currentStep }: ProgressStepperP
36
37
  {isCompleted ? (
37
38
  <Ionicons name="checkmark" size={16} color="#fff" />
38
39
  ) : (
39
- <Text style={{ color: isActive ? theme.primaryContent : theme.secondary, fontWeight: "700" }}>
40
+ <Txt color={isActive ? theme.primaryContent : theme.secondary} weight="bold">
40
41
  {index + 1}
41
- </Text>
42
+ </Txt>
42
43
  )}
43
44
  </View>
44
- <Text style={{ color: isActive ? theme.primary : theme.secondary, fontSize: 10, textAlign: "center" }}>
45
+ <Txt color={isActive ? theme.primary : theme.secondary} variant="xs" align="center">
45
46
  {step}
46
- </Text>
47
+ </Txt>
47
48
  </View>
48
49
 
49
50
  {index < steps.length - 1 && (
@@ -10,12 +10,15 @@ export interface TabItem {
10
10
  label: string;
11
11
  }
12
12
 
13
+ export type TabsSize = "xs" | "sm" | "base" | "md" | "lg";
14
+
13
15
  export interface TabsProps {
14
16
  tabs: TabItem[];
15
17
  activeTab: string;
16
18
  onChange: (id: string) => void;
17
19
  variant?: "button" | "underline";
18
20
  scrollable?: boolean;
21
+ size?: TabsSize;
19
22
  }
20
23
 
21
24
  export default function Tabs({
@@ -24,10 +27,33 @@ export default function Tabs({
24
27
  onChange,
25
28
  variant = "underline",
26
29
  scrollable = false,
30
+ size = "base",
27
31
  }: TabsProps) {
28
32
  const { colorScheme } = useColorScheme();
29
33
  const theme = Colors[colorScheme ?? "light"];
30
34
 
35
+ const getSizeStyles = (): {
36
+ py: number;
37
+ fontSize: number;
38
+ } => {
39
+ switch (size) {
40
+ case "xs":
41
+ return { py: variant === "button" ? 5 : 6, fontSize: 11 };
42
+ case "sm":
43
+ return { py: variant === "button" ? 7 : 8, fontSize: 12 };
44
+ case "base":
45
+ return { py: variant === "button" ? 9 : 10, fontSize: 14 };
46
+ case "md":
47
+ return { py: variant === "button" ? 11 : 12, fontSize: 15 };
48
+ case "lg":
49
+ return { py: variant === "button" ? 13 : 14, fontSize: 17 };
50
+ default:
51
+ return { py: variant === "button" ? 9 : 10, fontSize: 14 };
52
+ }
53
+ };
54
+
55
+ const sStyles = getSizeStyles();
56
+
31
57
  const [tabWidths, setTabWidths] = useState<{ [key: string]: number }>({});
32
58
  const [tabXs, setTabXs] = useState<{ [key: string]: number }>({});
33
59
 
@@ -40,7 +66,7 @@ export default function Tabs({
40
66
  indicatorWidth.value = withTiming(tabWidths[activeTab], config);
41
67
  indicatorPosition.value = withTiming(tabXs[activeTab], config);
42
68
  }
43
- // eslint-disable-next-line react-hooks/exhaustive-deps
69
+
44
70
  }, [activeTab, tabWidths, tabXs]);
45
71
 
46
72
  const indicatorStyle = useAnimatedStyle(() => {
@@ -101,7 +127,7 @@ export default function Tabs({
101
127
  onPress={() => onChange(tab.id)}
102
128
  onLayout={(e) => handleLayout(tab.id, e)}
103
129
  style={{
104
- paddingVertical: variant === "button" ? 10 : 12, // py-2.5 for button
130
+ paddingVertical: sStyles.py,
105
131
  paddingHorizontal: 16,
106
132
  flex: scrollable ? undefined : 1,
107
133
  alignItems: "center",
@@ -110,9 +136,9 @@ export default function Tabs({
110
136
  }}
111
137
  >
112
138
  <Txt
113
- variant="mid"
139
+ variant="md"
114
140
  style={{
115
- fontSize: 14, // text-sm
141
+ fontSize: sStyles.fontSize,
116
142
  fontWeight: isActive ? "600" : "500",
117
143
  color:
118
144
  variant === "button" && isActive
@@ -1,5 +1,16 @@
1
- import axios from "axios";
1
+ import axios, { AxiosResponse, AxiosRequestConfig } from "axios";
2
2
  import { get } from "../utils/storage";
3
+ import { ApiResponse } from "../types/common.type";
4
+
5
+ declare module 'axios' {
6
+ export interface AxiosInstance {
7
+ get<T = any, R = AxiosResponse<ApiResponse<T>>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
8
+ delete<T = any, R = AxiosResponse<ApiResponse<T>>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
9
+ post<T = any, R = AxiosResponse<ApiResponse<T>>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
10
+ put<T = any, R = AxiosResponse<ApiResponse<T>>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
11
+ patch<T = any, R = AxiosResponse<ApiResponse<T>>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
12
+ }
13
+ }
3
14
 
4
15
  // eslint-disable-next-line import/no-named-as-default-member
5
16
  export const api = axios.create({
@@ -0,0 +1,72 @@
1
+ export interface SidebarMenuItem {
2
+ icon: string;
3
+ label: string;
4
+ route: string;
5
+ }
6
+
7
+ export const sidebarConfig: Record<string, SidebarMenuItem[]> = {
8
+ owner: [
9
+ { icon: "home-outline", label: "Dashboard", route: "/(owner)" },
10
+ {
11
+ icon: "business-outline",
12
+ label: "Properties",
13
+ route: "/(owner)/properties",
14
+ },
15
+ { icon: "card-outline", label: "Payments", route: "/(owner)/payments" },
16
+ { icon: "people-outline", label: "Tenants", route: "/(owner)/tenant" },
17
+ {
18
+ icon: "clipboard-outline",
19
+ label: "Requests",
20
+ route: "/(owner)/requests",
21
+ },
22
+ {
23
+ icon: "construct-outline",
24
+ label: "Maintenance",
25
+ route: "/(owner)/maintenance",
26
+ },
27
+ {
28
+ icon: "flask-outline",
29
+ label: "Test Notifications",
30
+ route: "/(owner)/test-notifications",
31
+ },
32
+ ],
33
+ tenant: [
34
+
35
+ {
36
+ icon: "business-outline",
37
+ label: "My Units",
38
+ route: "/(tenant)/my-units",
39
+ },
40
+ { icon: "search-outline", label: "Explore", route: "/(tenant)/explore" },
41
+ { icon: "card-outline", label: "Payments", route: "/(tenant)/payments" },
42
+ {
43
+ icon: "construct-outline",
44
+ label: "Maintenance",
45
+ route: "/(tenant)/maintenance",
46
+ },
47
+ {
48
+ icon: "document-text-outline",
49
+ label: "Documents",
50
+ route: "/(tenant)/documents",
51
+ },
52
+ {
53
+ icon: "chatbubble-outline",
54
+ label: "Messages",
55
+ route: "/(tenant)/messages",
56
+ },
57
+ {
58
+ icon: "notifications-outline",
59
+ label: "Notifications",
60
+ route: "/(tenant)/notifications",
61
+ },
62
+ {
63
+ icon: "flask-outline",
64
+ label: "Test Notifications",
65
+ route: "/(tenant)/test-notifications",
66
+ },
67
+ ],
68
+ default: [
69
+ { icon: "home-outline", label: "Dashboard", route: "/" },
70
+ { icon: "person-outline", label: "Profile", route: "/profile" },
71
+ ],
72
+ };