diff --git a/apps/mobile/src/components/modal/ImportModal.tsx b/apps/mobile/src/components/modal/ImportModal.tsx index 6ad9c7e78..c2d42c288 100644 --- a/apps/mobile/src/components/modal/ImportModal.tsx +++ b/apps/mobile/src/components/modal/ImportModal.tsx @@ -2,7 +2,7 @@ import { forwardRef, useCallback } from 'react'; import { Alert, Platform, Text, View } from 'react-native'; import DocumentPicker from 'react-native-document-picker'; import RNFS from 'react-native-fs'; -import { useLibraryMutation } from '@sd/client'; +import { useLibraryMutation, useRspcLibraryContext } from '@sd/client'; import { Modal, ModalRef } from '~/components/layout/Modal'; import { Button } from '~/components/primitive/Button'; import useForwardedRef from '~/hooks/useForwardedRef'; @@ -16,6 +16,7 @@ const ImportModal = forwardRef((_, ref) => { const addLocationToLibrary = useLibraryMutation('locations.addLibrary'); const relinkLocation = useLibraryMutation('locations.relink'); + const rspc = useRspcLibraryContext(); const createLocation = useLibraryMutation('locations.create', { onError: (error, variables) => { @@ -31,7 +32,7 @@ const ImportModal = forwardRef((_, ref) => { } }, onSettled: () => { - // Close the modal + rspc.queryClient.invalidateQueries(['locations.list']); modalRef.current?.close(); } }); diff --git a/apps/mobile/src/components/modal/confirmModals/DeleteLocationModal.tsx b/apps/mobile/src/components/modal/confirmModals/DeleteLocationModal.tsx index a477558f7..9dc6a59fd 100644 --- a/apps/mobile/src/components/modal/confirmModals/DeleteLocationModal.tsx +++ b/apps/mobile/src/components/modal/confirmModals/DeleteLocationModal.tsx @@ -1,16 +1,17 @@ import { useRef } from 'react'; -import { useLibraryMutation, usePlausibleEvent } from '@sd/client'; +import { useLibraryMutation, usePlausibleEvent, useRspcLibraryContext } from '@sd/client'; import { ConfirmModal, ModalRef } from '~/components/layout/Modal'; type Props = { locationId: number; onSubmit?: () => void; trigger: React.ReactNode; + triggerStyle?: string; }; -const DeleteLocationModal = ({ trigger, onSubmit, locationId }: Props) => { +const DeleteLocationModal = ({ trigger, onSubmit, locationId, triggerStyle }: Props) => { const modalRef = useRef(null); - + const rspc = useRspcLibraryContext(); const submitPlausibleEvent = usePlausibleEvent(); const { mutate: deleteLoc, isLoading: deleteLocLoading } = useLibraryMutation( @@ -22,6 +23,7 @@ const DeleteLocationModal = ({ trigger, onSubmit, locationId }: Props) => { }, onSettled: () => { modalRef.current?.close(); + rspc.queryClient.invalidateQueries(['locations.list']); } } ); @@ -33,6 +35,7 @@ const DeleteLocationModal = ({ trigger, onSubmit, locationId }: Props) => { ctaLabel="Delete" ctaAction={() => deleteLoc(locationId)} loading={deleteLocLoading} + triggerStyle={triggerStyle} trigger={trigger} ctaDanger /> diff --git a/apps/mobile/src/components/modal/confirmModals/DeleteTagModal.tsx b/apps/mobile/src/components/modal/confirmModals/DeleteTagModal.tsx index fea24810a..54eb5e8cf 100644 --- a/apps/mobile/src/components/modal/confirmModals/DeleteTagModal.tsx +++ b/apps/mobile/src/components/modal/confirmModals/DeleteTagModal.tsx @@ -1,5 +1,5 @@ import { useRef } from 'react'; -import { useLibraryMutation, usePlausibleEvent } from '@sd/client'; +import { useLibraryMutation, usePlausibleEvent, useRspcLibraryContext } from '@sd/client'; import { ConfirmModal, ModalRef } from '~/components/layout/Modal'; type Props = { @@ -11,13 +11,14 @@ type Props = { const DeleteTagModal = ({ trigger, onSubmit, tagId, triggerStyle }: Props) => { const modalRef = useRef(null); - + const rspc = useRspcLibraryContext(); const submitPlausibleEvent = usePlausibleEvent(); const { mutate: deleteTag, isLoading: deleteTagLoading } = useLibraryMutation('tags.delete', { onSuccess: () => { submitPlausibleEvent({ event: { type: 'tagDelete' } }); onSubmit?.(); + rspc.queryClient.invalidateQueries(['tags.list']); }, onSettled: () => { modalRef.current?.close(); diff --git a/apps/mobile/src/components/modal/location/LocationModal.tsx b/apps/mobile/src/components/modal/location/LocationModal.tsx index 41134cb3f..20972cc54 100644 --- a/apps/mobile/src/components/modal/location/LocationModal.tsx +++ b/apps/mobile/src/components/modal/location/LocationModal.tsx @@ -1,11 +1,12 @@ import { forwardRef } from 'react'; import { Text, View } from 'react-native'; -import { useLibraryMutation, usePlausibleEvent } from '@sd/client'; import { Modal, ModalRef } from '~/components/layout/Modal'; -import { Button } from '~/components/primitive/Button'; +import { Button, FakeButton } from '~/components/primitive/Button'; import useForwardedRef from '~/hooks/useForwardedRef'; import { tw } from '~/lib/tailwind'; +import DeleteLocationModal from '../confirmModals/DeleteLocationModal'; + interface Props { locationId: number; editLocation: () => void; @@ -13,24 +14,21 @@ interface Props { export const LocationModal = forwardRef(({ locationId, editLocation }, ref) => { const modalRef = useForwardedRef(ref); - const submitPlausibleEvent = usePlausibleEvent(); - const { mutate: deleteLoc } = useLibraryMutation('locations.delete', { - onSuccess: () => { - submitPlausibleEvent({ event: { type: 'locationDelete' } }); - }, - onSettled: () => { - modalRef.current?.close(); - } - }); return ( - - + + Delete + + } + /> ); diff --git a/apps/mobile/src/components/modal/tag/CreateTagModal.tsx b/apps/mobile/src/components/modal/tag/CreateTagModal.tsx index f4849f652..20ef11bfb 100644 --- a/apps/mobile/src/components/modal/tag/CreateTagModal.tsx +++ b/apps/mobile/src/components/modal/tag/CreateTagModal.tsx @@ -2,7 +2,12 @@ import { useQueryClient } from '@tanstack/react-query'; import { forwardRef, useEffect, useState } from 'react'; import { Pressable, Text, View } from 'react-native'; import ColorPicker from 'react-native-wheel-color-picker'; -import { ToastDefautlColor, useLibraryMutation, usePlausibleEvent } from '@sd/client'; +import { + ToastDefautlColor, + useLibraryMutation, + usePlausibleEvent, + useRspcLibraryContext +} from '@sd/client'; import { FadeInAnimation } from '~/components/animation/layout'; import { ModalInput } from '~/components/form/Input'; import { Modal, ModalRef } from '~/components/layout/Modal'; @@ -12,7 +17,7 @@ import { useKeyboard } from '~/hooks/useKeyboard'; import { tw, twStyle } from '~/lib/tailwind'; const CreateTagModal = forwardRef((_, ref) => { - const queryClient = useQueryClient(); + const rspc = useRspcLibraryContext(); const modalRef = useForwardedRef(ref); const [tagName, setTagName] = useState(''); @@ -33,7 +38,7 @@ const CreateTagModal = forwardRef((_, ref) => { setTagColor(ToastDefautlColor); setShowPicker(false); - queryClient.invalidateQueries(['tags.list']); + rspc.queryClient.invalidateQueries(['tags.list']); submitPlausibleEvent({ event: { type: 'tagCreate' } }); }, diff --git a/apps/mobile/src/screens/onboarding/GetStarted.tsx b/apps/mobile/src/screens/onboarding/GetStarted.tsx index c2107d121..a5cc1cb9d 100644 --- a/apps/mobile/src/screens/onboarding/GetStarted.tsx +++ b/apps/mobile/src/screens/onboarding/GetStarted.tsx @@ -49,22 +49,22 @@ export function OnboardingContainer({ children }: React.PropsWithChildren) { )} - + - + {children} - + © {new Date().getFullYear()} Spacedrive Technology Inc. {/* Bloom */} - + ); } @@ -104,7 +104,7 @@ const GetStartedScreen = ({ navigation }: OnboardingStackScreenProps<'GetStarted {/* Get Started Button */} navigation.push('NewLibrary')}> - Get Started + Get Started