Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/areas/generate/components/WorkspacePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ import { useCollectionsStore } from '@shared/stores/collectionsStore'
import { ConfirmModal } from '@shared/components/ui'
import { formatTime, formatDate } from '@shared/utils/format'

function ThumbnailItem({ job, isActive, onClick, onDelete }: {
function ThumbnailItem({ job, isActive, onClick, onDelete, disabled }: {
job: GenerationJob
isActive: boolean
onClick: () => void
onDelete: () => void
disabled?: boolean
}): JSX.Element {
return (
<div
title={disabled ? 'A generation is in progress' : undefined}
className={`
relative group aspect-square rounded-xl overflow-hidden border transition-all duration-150 cursor-pointer
relative group aspect-square rounded-xl overflow-hidden border transition-all duration-150
${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}
${isActive
? 'border-accent ring-1 ring-accent/40'
: 'border-zinc-700/50 hover:border-zinc-500'
Expand Down Expand Up @@ -94,6 +97,7 @@ export default function WorkspacePanel(): JSX.Element {
const [creating, setCreating] = useState(false)
const [newName, setNewName] = useState('')

const isGenerating = currentJob?.status === 'uploading' || currentJob?.status === 'generating'
const activeCollection = collections.find((c) => c.id === activeCollectionId)
const jobs = activeCollection?.jobs ?? []

Expand Down Expand Up @@ -218,8 +222,9 @@ export default function WorkspacePanel(): JSX.Element {
key={job.id}
job={job}
isActive={currentJob?.id === job.id}
onClick={() => handleJobClick(job)}
onDelete={() => setPendingDeleteId(job.id)}
onClick={() => !isGenerating && handleJobClick(job)}
onDelete={() => !isGenerating && setPendingDeleteId(job.id)}
disabled={isGenerating}
/>
))}
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/areas/workspace/WorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export default function WorkspacePage(): JSX.Element {
const [addingCol, setAddingCol] = useState(false)
const newColRef = useRef<HTMLInputElement>(null)

const isGenerating = currentJob?.status === 'uploading' || currentJob?.status === 'generating'
const activeCollection = collections.find((c) => c.id === activeCollectionId)

const handleJobClick = (job: GenerationJob) => {
if (isGenerating) return
// Always restore the original mesh (before any optimization)
setCurrentJob({ ...job, outputUrl: job.originalOutputUrl ?? job.outputUrl })
navigate('generate')
Expand Down Expand Up @@ -146,6 +148,7 @@ export default function WorkspacePage(): JSX.Element {
isActive={currentJob?.id === job.id}
onClick={() => handleJobClick(job)}
onDelete={() => setPendingDeleteId(job.id)}
disabled={isGenerating}
/>
))}
</div>
Expand Down
9 changes: 6 additions & 3 deletions src/areas/workspace/components/WorkspaceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ interface Props {
isActive: boolean
onClick: () => void
onDelete: () => void
disabled?: boolean
}

export function WorkspaceCard({ job, isActive, onClick, onDelete }: Props): JSX.Element {
export function WorkspaceCard({ job, isActive, onClick, onDelete, disabled }: Props): JSX.Element {
const modelLabel = job.modelId ? (MODEL_LABEL[job.modelId] ?? job.modelId) : null

return (
<div
title={disabled ? 'A generation is in progress' : undefined}
className={`
group flex flex-col rounded-xl overflow-hidden border transition-all duration-150 cursor-pointer
group flex flex-col rounded-xl overflow-hidden border transition-all duration-150
${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}
${isActive
? 'border-accent ring-1 ring-accent/40'
: 'border-zinc-800 hover:border-zinc-600'
}
`}
onClick={onClick}
onClick={disabled ? undefined : onClick}
>
{/* Thumbnail */}
<div className="relative aspect-square bg-zinc-900 overflow-hidden">
Expand Down