Browse Source

Added missing toast messages to Spoolman settings

maziggy 3 months ago
parent
commit
5803c8ceb1

+ 3 - 6
frontend/src/components/SpoolmanSettings.tsx

@@ -6,16 +6,17 @@ import { api } from '../api/client';
 import type { SpoolmanSyncResult, Printer } from '../api/client';
 import type { SpoolmanSyncResult, Printer } from '../api/client';
 import { Card, CardContent, CardHeader } from './Card';
 import { Card, CardContent, CardHeader } from './Card';
 import { Button } from './Button';
 import { Button } from './Button';
+import { useToast } from '../contexts/ToastContext';
 
 
 export function SpoolmanSettings() {
 export function SpoolmanSettings() {
   const { t } = useTranslation();
   const { t } = useTranslation();
   const queryClient = useQueryClient();
   const queryClient = useQueryClient();
+  const { showToast } = useToast();
   const [localEnabled, setLocalEnabled] = useState(false);
   const [localEnabled, setLocalEnabled] = useState(false);
   const [localUrl, setLocalUrl] = useState('');
   const [localUrl, setLocalUrl] = useState('');
   const [localSyncMode, setLocalSyncMode] = useState('auto');
   const [localSyncMode, setLocalSyncMode] = useState('auto');
   const [localDisableWeightSync, setLocalDisableWeightSync] = useState(false);
   const [localDisableWeightSync, setLocalDisableWeightSync] = useState(false);
   const [localReportPartialUsage, setLocalReportPartialUsage] = useState(true);
   const [localReportPartialUsage, setLocalReportPartialUsage] = useState(true);
-  const [showSaved, setShowSaved] = useState(false);
   const [selectedPrinterId, setSelectedPrinterId] = useState<number | 'all'>('all');
   const [selectedPrinterId, setSelectedPrinterId] = useState<number | 'all'>('all');
   const [isInitialized, setIsInitialized] = useState(false);
   const [isInitialized, setIsInitialized] = useState(false);
   const [showAllSkipped, setShowAllSkipped] = useState(false);
   const [showAllSkipped, setShowAllSkipped] = useState(false);
@@ -85,8 +86,7 @@ export function SpoolmanSettings() {
     onSuccess: () => {
     onSuccess: () => {
       queryClient.invalidateQueries({ queryKey: ['spoolman-settings'] });
       queryClient.invalidateQueries({ queryKey: ['spoolman-settings'] });
       queryClient.invalidateQueries({ queryKey: ['spoolman-status'] });
       queryClient.invalidateQueries({ queryKey: ['spoolman-status'] });
-      setShowSaved(true);
-      setTimeout(() => setShowSaved(false), 2000);
+      showToast(t('settings.toast.settingsSaved'));
     },
     },
   });
   });
 
 
@@ -169,9 +169,6 @@ export function SpoolmanSettings() {
           {saveMutation.isPending && (
           {saveMutation.isPending && (
             <Loader2 className="w-4 h-4 text-bambu-green animate-spin" />
             <Loader2 className="w-4 h-4 text-bambu-green animate-spin" />
           )}
           )}
-          {showSaved && (
-            <Check className="w-4 h-4 text-bambu-green" />
-          )}
         </div>
         </div>
       </CardHeader>
       </CardHeader>
       <CardContent className="space-y-4">
       <CardContent className="space-y-4">

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-BZQD54OI.js


+ 1 - 1
static/index.html

@@ -23,7 +23,7 @@
 
 
     <!-- Splash screens for iOS -->
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-AXQRHtw2.js"></script>
+    <script type="module" crossorigin src="/assets/index-BZQD54OI.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-togsBDt6.css">
     <link rel="stylesheet" crossorigin href="/assets/index-togsBDt6.css">
   </head>
   </head>
   <body>
   <body>

Some files were not shown because too many files changed in this diff