From 03bc054d645ef5f301e04f3febeb0c41f7f5d8d5 Mon Sep 17 00:00:00 2001 From: Taron Date: Mon, 6 Jan 2025 01:34:42 +0400 Subject: [PATCH 1/4] fix trips duplicates --- packages/app/hooks/trips/useAddTrip.ts | 1 + packages/app/hooks/trips/useDeleteTrips.ts | 3 +++ packages/app/screens/trip/TripScreen.tsx | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/app/hooks/trips/useAddTrip.ts b/packages/app/hooks/trips/useAddTrip.ts index 69ad9548d..2df269591 100644 --- a/packages/app/hooks/trips/useAddTrip.ts +++ b/packages/app/hooks/trips/useAddTrip.ts @@ -8,6 +8,7 @@ export const useAddTrip = () => { mutation.mutate(newTrip, { onSuccess: (result) => { utils.getTrips.invalidate(); + utils.getUserTripsFeed.invalidate(); }, }); }; diff --git a/packages/app/hooks/trips/useDeleteTrips.ts b/packages/app/hooks/trips/useDeleteTrips.ts index 69cd36cd8..4ee16682a 100644 --- a/packages/app/hooks/trips/useDeleteTrips.ts +++ b/packages/app/hooks/trips/useDeleteTrips.ts @@ -3,11 +3,14 @@ import { queryTrpc } from 'app/trpc'; export const useDeleteTrips = (id) => { const { mutateAsync: deleteTrip } = queryTrpc.deleteTrip.useMutation(); + const utils = queryTrpc.useUtils(); const router = useRouter(); const handleDeleteTrip = async () => { try { await deleteTrip({ tripId: id }); + utils.getTrips.invalidate(); + utils.getUserTripsFeed.invalidate(); router.replace('/trips'); } catch {} }; diff --git a/packages/app/screens/trip/TripScreen.tsx b/packages/app/screens/trip/TripScreen.tsx index bccc524a1..b86ed4751 100644 --- a/packages/app/screens/trip/TripScreen.tsx +++ b/packages/app/screens/trip/TripScreen.tsx @@ -118,7 +118,7 @@ export function TripScreen({ flexWrap: 'wrap', }} > - + {isViewOnlyMode ? 'Trip Details' : 'Plan Your Trip'} {!isViewOnlyMode && ( From 0f4ecb53b0cd295e5e24edb97130ee70e8f44ab1 Mon Sep 17 00:00:00 2001 From: Taron Date: Wed, 8 Jan 2025 01:50:42 +0400 Subject: [PATCH 2/4] bring back dashboard search --- .../app/(app)/(drawer)/(tabs)/(stack)/maps/index.tsx | 2 ++ .../(app)/(drawer)/(tabs)/(stack)/products/index.tsx | 2 ++ .../app/(app)/(drawer)/(tabs)/(stack)/trips/index.tsx | 2 ++ apps/expo/app/(app)/(drawer)/(tabs)/feed/index.tsx | 2 ++ apps/expo/app/(app)/(drawer)/(tabs)/index/index.tsx | 10 ++++++++++ apps/expo/app/(app)/(drawer)/(tabs)/packs/index.tsx | 2 ++ 6 files changed, 20 insertions(+) diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/maps/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/maps/index.tsx index 2130f4f28..4bc5a26f4 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/maps/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/maps/index.tsx @@ -30,6 +30,8 @@ export default function MapsScreen() { hideWhenScrolling: false, headerIconColor: currentTheme.colors.text, inputType: 'text', + textColor: + Platform.OS === 'android' ? currentTheme.colors.text : undefined, onChangeText: (e) => setSearchQuery(e.nativeEvent.text), }, headerStyle: { diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/products/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/products/index.tsx index d4ebfa05f..a89dd6bdc 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/products/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/products/index.tsx @@ -30,6 +30,8 @@ export default function ProductsPage() { headerIconColor: currentTheme.colors.text, hideWhenScrolling: false, inputType: 'text', + textColor: + Platform.OS === 'android' ? currentTheme.colors.text : undefined, onChangeText: (e) => setSearchQuery(e.nativeEvent.text), }, diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/trips/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/trips/index.tsx index 8794344d0..76b9737ca 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/trips/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/(stack)/trips/index.tsx @@ -26,6 +26,8 @@ export default function FeedNav() { headerIconColor: currentTheme.colors.text, hideWhenScrolling: false, inputType: 'text', + textColor: + Platform.OS === 'android' ? currentTheme.colors.text : undefined, onChangeText: (e) => setSearchQuery(e.nativeEvent.text), }, // https://reactnavigation.org/docs/headers#adjusting-header-styles diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/feed/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/feed/index.tsx index 256b23528..71c53177c 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/feed/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/feed/index.tsx @@ -35,6 +35,8 @@ export default function FeedNav() { hideWhenScrolling: false, inputType: 'text', + textColor: + Platform.OS === 'android' ? currentTheme.colors.text : undefined, onChangeText: (e) => setSearchQuery(e.nativeEvent.text), }, diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/index/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/index/index.tsx index 73f9352e1..446d957db 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/index/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/index/index.tsx @@ -36,6 +36,16 @@ export default function HomeScreen() { setSearchQuery(e.nativeEvent.text), + } + : undefined, }} /> {connectionStatus === 'connected' && ( diff --git a/apps/expo/app/(app)/(drawer)/(tabs)/packs/index.tsx b/apps/expo/app/(app)/(drawer)/(tabs)/packs/index.tsx index e00f6b1ae..a1993c17d 100644 --- a/apps/expo/app/(app)/(drawer)/(tabs)/packs/index.tsx +++ b/apps/expo/app/(app)/(drawer)/(tabs)/packs/index.tsx @@ -28,6 +28,8 @@ export default function Packs() { headerIconColor: currentTheme.colors.text, hideWhenScrolling: false, inputType: 'text', + textColor: + Platform.OS === 'android' ? currentTheme.colors.text : undefined, onChangeText: (e) => setSearchQuery(e.nativeEvent.text), }, From 5c27c5f5e12a910567e84cbcc4b72b08102e68aa Mon Sep 17 00:00:00 2001 From: Taron Date: Wed, 8 Jan 2025 18:16:24 +0400 Subject: [PATCH 3/4] fix fab closing on native --- packages/app/components/Fab/FabNative.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/app/components/Fab/FabNative.tsx b/packages/app/components/Fab/FabNative.tsx index 1b1446cdf..e2d2de34b 100644 --- a/packages/app/components/Fab/FabNative.tsx +++ b/packages/app/components/Fab/FabNative.tsx @@ -21,7 +21,14 @@ const FABNative: React.FC = ({ const { currentTheme } = useTheme(); return ( - + { + if (!open) { + closeQuickActions(); + } + }} + > = ({ bottom: 20, alignSelf: 'center', }} + onPress={toggleQuickActions} > = ({ {quickActionData.map((action) => ( handleActionSelect(action.action)} + onPress={() => { + handleActionSelect(action.action); + closeQuickActions(); + }} iconName={action.iconName} text={action.text} /> From 529fe65d47527d89d16ad17b49b514b9a7086bd2 Mon Sep 17 00:00:00 2001 From: Anmol Verma Date: Thu, 9 Jan 2025 17:08:51 +0530 Subject: [PATCH 4/4] add toggle theme button --- packages/app/components/settings/index.tsx | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/packages/app/components/settings/index.tsx b/packages/app/components/settings/index.tsx index 09ab87680..7290afd15 100644 --- a/packages/app/components/settings/index.tsx +++ b/packages/app/components/settings/index.tsx @@ -1,6 +1,6 @@ import { AnimatePresence, Button, H1, Label, Spinner, View } from 'tamagui'; import { Input } from './components/inputParts'; -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; import { Info } from '@tamagui/lucide-icons'; import { FormCard } from './components/layoutParts'; import { useForm, Controller } from 'react-hook-form'; @@ -10,12 +10,16 @@ import { FormSelect, ImageUpload, RH5, + RIconButton, RLabel, RStack, SubmitButton, + RText, } from '@packrat/ui'; import Avatar from '../Avatar/Avatar'; import { useProfileSettings } from 'app/modules/user/hooks'; +import Feather from '@expo/vector-icons/Feather'; + import { deleteUserForm, passwordChangeSchema, @@ -23,6 +27,8 @@ import { } from '@packrat/validations'; import { useDeleteProfile } from 'app/modules/user/hooks'; import useResponsive from 'app/hooks/useResponsive'; +import ThemeContext from '../../context/theme'; +import { Platform } from 'react-native'; export function SettingsForm() { const [showConfirmPassword, setShowConfirmPassword] = useState(false); @@ -30,6 +36,17 @@ export function SettingsForm() { const { user, handleEditUser, handleUpdatePassword } = useProfileSettings(); const { deleteProfile, isLoading } = useDeleteProfile(); const { xs, sm, md } = useResponsive(); + const { isDark, enableDarkMode, enableLightMode } = useContext(ThemeContext); + + const iconName = isDark ? 'moon' : 'sun'; + const iconColor = isDark ? 'white' : 'black'; + const handlePress = () => { + if (isDark) { + enableLightMode(); + } else { + enableDarkMode(); + } + }; const { control, @@ -177,6 +194,26 @@ export function SettingsForm() { Update Profile + {Platform.OS !== 'web' && ( + + + Toggle theme + + } + onPress={handlePress} + /> + + )}