Quellcode durchsuchen

Fix: Hide Print/Schedule buttons only when more than 1 file selected

Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
copilot-swe-agent[bot] vor 3 Monaten
Ursprung
Commit
c28fa602e5
3 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 5 5
      frontend/src/pages/FileManagerPage.tsx
  2. 0 0
      static/assets/index-DVZX8_s6.js
  3. 1 1
      static/index.html

+ 5 - 5
frontend/src/pages/FileManagerPage.tsx

@@ -902,7 +902,7 @@ interface FileCardProps {
   file: LibraryFileListItem;
   isSelected: boolean;
   isMobile: boolean;
-  hasAnySelection: boolean;
+  hasMultipleSelection: boolean;
   onSelect: (id: number) => void;
   onDelete: (id: number) => void;
   onDownload: (id: number) => void;
@@ -917,7 +917,7 @@ interface FileCardProps {
   t: TFunction;
 }
 
-function FileCard({ file, isSelected, isMobile, hasAnySelection, onSelect, onDelete, onDownload, onAddToQueue, onPrint, onRename, onGenerateThumbnail, thumbnailVersion, hasPermission, canModify, authEnabled, t }: FileCardProps) {
+function FileCard({ file, isSelected, isMobile, hasMultipleSelection, onSelect, onDelete, onDownload, onAddToQueue, onPrint, onRename, onGenerateThumbnail, thumbnailVersion, hasPermission, canModify, authEnabled, t }: FileCardProps) {
   const [showActions, setShowActions] = useState(false);
 
   return (
@@ -996,7 +996,7 @@ function FileCard({ file, isSelected, isMobile, hasAnySelection, onSelect, onDel
           <>
             <div className="fixed inset-0 z-10" onClick={() => setShowActions(false)} />
             <div className="absolute right-0 bottom-8 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[140px]">
-              {!hasAnySelection && onPrint && isSlicedFilename(file.filename) && (
+              {!hasMultipleSelection && onPrint && isSlicedFilename(file.filename) && (
                 <button
                   className={`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${
                     hasPermission('printers:control') ? 'text-bambu-green hover:bg-bambu-dark' : 'text-bambu-gray cursor-not-allowed'
@@ -1009,7 +1009,7 @@ function FileCard({ file, isSelected, isMobile, hasAnySelection, onSelect, onDel
                   {t('common.print')}
                 </button>
               )}
-              {!hasAnySelection && onAddToQueue && isSlicedFilename(file.filename) && (
+              {!hasMultipleSelection && onAddToQueue && isSlicedFilename(file.filename) && (
                 <button
                   className={`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${
                     hasPermission('queue:create') ? 'text-white hover:bg-bambu-dark' : 'text-bambu-gray cursor-not-allowed'
@@ -1985,7 +1985,7 @@ export function FileManagerPage() {
                     file={file}
                     isSelected={selectedFiles.includes(file.id)}
                     isMobile={isMobile}
-                    hasAnySelection={selectedFiles.length > 0}
+                    hasMultipleSelection={selectedFiles.length > 1}
                     t={t}
                     onSelect={handleFileSelect}
                     onDelete={(id) => setDeleteConfirm({ type: 'file', id })}

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
static/assets/index-DVZX8_s6.js


+ 1 - 1
static/index.html

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

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.