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

Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-04 11:02:00 +00:00
co-authored by cadtoolbox
parent 39d57d5226
commit 91af6f25f4
3 changed files with 8 additions and 6 deletions
+6 -4
View File
@@ -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 one or more lines are too long
+1 -1
View File
@@ -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>