From a0821468e98f1ed55af5f68211d2133bb801682c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 25 Oct 2025 11:50:01 -0500 Subject: [PATCH] Remove "Offline Cache" section from Storage settings --- src/pages/StorageSettings.tsx | 88 +---------------------------------- 1 file changed, 2 insertions(+), 86 deletions(-) diff --git a/src/pages/StorageSettings.tsx b/src/pages/StorageSettings.tsx index ef0f8c00..775a1019 100644 --- a/src/pages/StorageSettings.tsx +++ b/src/pages/StorageSettings.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { Download, Trash2, AlertTriangle, Loader2, Database, Info, ArrowLeft, Shield, HardDrive } from 'lucide-react'; +import { Download, Trash2, AlertTriangle, Loader2, Database, Info, ArrowLeft, Shield } 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'; @@ -36,12 +36,10 @@ export function StorageSettings() { const { t } = useTranslation(); const [isExporting, setIsExporting] = useState(false); const [isClearing, setIsClearing] = useState(false); - const [isClearingCache, setIsClearingCache] = useState(false); const [isRequestingPersistent, setIsRequestingPersistent] = useState(false); const [storageInfo, setStorageInfo] = useState(null); const [storageError, setStorageError] = useState(null); const [isPersistent, setIsPersistent] = useState(null); - const [cacheSize, setCacheSize] = useState(0); const { toast } = useToast(); const { fs } = useFS(); const navigate = useNavigate(); @@ -80,30 +78,6 @@ export function StorageSettings() { // Check if storage is persistent const persistent = await isPersistentStorageGranted(); setIsPersistent(persistent); - - // Calculate cache size - if ('caches' in window) { - const cacheNames = await caches.keys(); - let totalSize = 0; - - for (const cacheName of cacheNames) { - // Include both workbox and shakespeare caches - if (cacheName.startsWith('workbox-') || cacheName.includes('shakespeare')) { - const cache = await caches.open(cacheName); - const requests = await cache.keys(); - - for (const request of requests) { - const response = await cache.match(request); - if (response) { - const blob = await response.blob(); - totalSize += blob.size; - } - } - } - } - - setCacheSize(totalSize); - } } catch (error) { console.error('Failed to get storage information:', error); setStorageError(error instanceof Error ? error.message : 'Failed to get storage information'); @@ -111,7 +85,7 @@ export function StorageSettings() { }; loadStorageInfo(); - }, [isClearingCache]); + }, []); const exportFilesAsZip = async () => { const zip = new JSZip(); @@ -245,28 +219,6 @@ export function StorageSettings() { } }; - const handleClearCache = async () => { - setIsClearingCache(true); - try { - await clearCache(); - setCacheSize(0); - - toast({ - title: t('cacheClearedSuccessfully'), - description: t('cacheClearedDescription'), - }); - } catch (error) { - console.error('Failed to clear cache:', error); - toast({ - title: t('failedToClearCache'), - description: error instanceof Error ? error.message : t('error'), - variant: "destructive", - }); - } finally { - setIsClearingCache(false); - } - }; - const handleClearAllData = async () => { setIsClearing(true); try { @@ -412,42 +364,6 @@ export function StorageSettings() { - {/* Clear Cache */} - - - - - {t('offlineCache')} - - - {t('offlineCacheDescription')} - - - -
- {t('cacheSize')}: {formatBytes(cacheSize)} -
- -
-
- {/* Export Files */}