From bda9501e638416b328e3ca10113130e30030ae50 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Fri, 19 Sep 2025 23:32:57 -0500 Subject: [PATCH] Add mobile back button to Data and About settings pages - Added mobile navigation with back button to DataSettings.tsx - Added mobile navigation with back button to AboutSettings.tsx - Import ArrowLeft icon and useIsMobile hook in both pages - Maintain consistency with other settings pages (AISettings, NostrSettings) - Show mobile back button only on mobile devices - Preserve existing desktop header layout --- src/pages/AboutSettings.tsx | 49 +++++++++++++++++++++++++++++-------- src/pages/DataSettings.tsx | 47 +++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 20 deletions(-) diff --git a/src/pages/AboutSettings.tsx b/src/pages/AboutSettings.tsx index 837cab14..296ee731 100644 --- a/src/pages/AboutSettings.tsx +++ b/src/pages/AboutSettings.tsx @@ -1,13 +1,17 @@ import { useState, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { Info, ExternalLink, Loader2, AlertTriangle } from 'lucide-react'; +import { Info, ExternalLink, Loader2, AlertTriangle, ArrowLeft } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Alert, AlertDescription } from '@/components/ui/alert'; +import { useIsMobile } from '@/hooks/useIsMobile'; export function AboutSettings() { const { t } = useTranslation(); + const navigate = useNavigate(); + const isMobile = useIsMobile(); const [license, setLicense] = useState(null); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); @@ -39,15 +43,40 @@ export function AboutSettings() { return (
-
-

- - {t('aboutShakespeare')} -

-

- {t('aboutShakespeareDescription')} -

-
+ {isMobile && ( +
+ +
+

+ + {t('aboutShakespeare')} +

+

+ {t('aboutShakespeareDescription')} +

+
+
+ )} + + {!isMobile && ( +
+

+ + {t('aboutShakespeare')} +

+

+ {t('aboutShakespeareDescription')} +

+
+ )}
{/* Project Information */} diff --git a/src/pages/DataSettings.tsx b/src/pages/DataSettings.tsx index 568a22c3..ef439a26 100644 --- a/src/pages/DataSettings.tsx +++ b/src/pages/DataSettings.tsx @@ -1,13 +1,14 @@ import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { Download, Trash2, AlertTriangle, Loader2, Database, Info } from 'lucide-react'; +import { Download, Trash2, AlertTriangle, Loader2, Database, Info, ArrowLeft } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog'; import { Progress } from '@/components/ui/progress'; import { useToast } from '@/hooks/useToast'; import { useFS } from '@/hooks/useFS'; +import { useIsMobile } from '@/hooks/useIsMobile'; import JSZip from 'jszip'; interface StorageUsageDetails { @@ -32,6 +33,7 @@ export function DataSettings() { const { toast } = useToast(); const { fs } = useFS(); const navigate = useNavigate(); + const isMobile = useIsMobile(); // Format bytes to human readable format const formatBytes = (bytes: number): string => { @@ -196,15 +198,40 @@ export function DataSettings() { return (
-
-

- - {t('dataSettings')} -

-

- {t('dataSettingsDescriptionLong')} -

-
+ {isMobile && ( +
+ +
+

+ + {t('dataSettings')} +

+

+ {t('dataSettingsDescriptionLong')} +

+
+
+ )} + + {!isMobile && ( +
+

+ + {t('dataSettings')} +

+

+ {t('dataSettingsDescriptionLong')} +

+
+ )}
{/* Storage Information */}