Browse Source

Hide Print and Schedule buttons in individual file actions when files are selected

Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
copilot-swe-agent[bot] 3 months ago
parent
commit
91af6f25f4
3 changed files with 7 additions and 5 deletions
  1. 6 4
      frontend/src/pages/FileManagerPage.tsx
  2. 0 0
      static/assets/index-LeR4yF6b.js
  3. 1 1
      static/index.html

+ 6 - 4
frontend/src/pages/FileManagerPage.tsx

@@ -902,6 +902,7 @@ interface FileCardProps {
   file: LibraryFileListItem;
   isSelected: boolean;
   isMobile: boolean;
+  hasAnySelection: boolean;
   onSelect: (id: number) => void;
   onDelete: (id: number) => void;
   onDownload: (id: number) => void;
@@ -916,7 +917,7 @@ interface FileCardProps {
   t: TFunction;
 }
 
-function FileCard({ file, isSelected, isMobile, onSelect, onDelete, onDownload, onAddToQueue, onPrint, onRename, onGenerateThumbnail, thumbnailVersion, hasPermission, canModify, authEnabled, t }: FileCardProps) {
+function FileCard({ file, isSelected, isMobile, hasAnySelection, onSelect, onDelete, onDownload, onAddToQueue, onPrint, onRename, onGenerateThumbnail, thumbnailVersion, hasPermission, canModify, authEnabled, t }: FileCardProps) {
   const [showActions, setShowActions] = useState(false);
 
   return (
@@ -995,7 +996,7 @@ function FileCard({ file, isSelected, isMobile, onSelect, onDelete, onDownload,
           <>
             <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]">
-              {onPrint && isSlicedFilename(file.filename) && (
+              {!hasAnySelection && 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'
@@ -1008,7 +1009,7 @@ function FileCard({ file, isSelected, isMobile, onSelect, onDelete, onDownload,
                   {t('common.print')}
                 </button>
               )}
-              {onAddToQueue && isSlicedFilename(file.filename) && (
+              {!hasAnySelection && 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'
@@ -1984,6 +1985,7 @@ export function FileManagerPage() {
                     file={file}
                     isSelected={selectedFiles.includes(file.id)}
                     isMobile={isMobile}
+                    hasAnySelection={selectedFiles.length > 0}
                     t={t}
                     onSelect={handleFileSelect}
                     onDelete={(id) => setDeleteConfirm({ type: 'file', id })}
@@ -2096,7 +2098,7 @@ export function FileManagerPage() {
                     <div className="text-sm text-bambu-gray">{file.print_count > 0 ? `${file.print_count}x` : '-'}</div>
                     {/* Actions */}
                     <div className="flex items-center gap-1" onClick={(e) => e.stopPropagation()}>
-                      {isSlicedFilename(file.filename) && (
+                      {selectedFiles.length === 0 && isSlicedFilename(file.filename) && (
                         <>
                           <button
                             onClick={() => hasPermission('printers:control') && setPrintFile(file)}

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-LeR4yF6b.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-kl_IYtg7.js"></script>
+    <script type="module" crossorigin src="/assets/index-LeR4yF6b.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-B7d6gcUW.css">
   </head>
   <body>

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