Skip to content

Commit

Permalink
abstract image field
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoOliveira committed Feb 25, 2024
1 parent 8f2a196 commit bc0245b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/assets/components/model/model-card/ModelCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export function ModelCard({ projectUuid, asset, selected, onSelectChange, view3d
<Card withBorder padding="lg" radius="md" className={classes.card} style={{ minWidth: size, width: size, borderColor: selected ? 'red' : '' }} >
<Card.Section mb="sm" onClick={() => onSelectChange(true)}>
<AspectRatio ratio={16 / 9}>
{asset?.model?.image_id === "" ? <IconFile3d /> :
{asset?.image_id === "" ? <IconFile3d /> :
<Image
src={`${settings.localBackend}/projects/${projectUuid}/assets/${asset?.model?.image_id}`}
src={`${settings.localBackend}/projects/${projectUuid}/assets/${asset?.image_id}`}
alt={asset.name}
/>
}
Expand All @@ -49,7 +49,7 @@ export function ModelCard({ projectUuid, asset, selected, onSelectChange, view3d
downloadURL={`${settings.localBackend}/projects/${projectUuid}/assets/${asset.id}?download=true'`}
onDelete={() => onDelete(projectUuid, asset.id)}
toggleLoad={toggleLoadingCallback}>
<SetAsMain projectUuid={projectUuid} assetId={asset.model?.image_id} onChange={() => { onChange(projectUuid, asset.model?.image_id) }} />
<SetAsMain projectUuid={projectUuid} assetId={asset.model?.image_id} onChange={() => { onChange(projectUuid, asset.image_id) }} />
</DropDownMenu>
</Group>
</Group>
Expand Down
6 changes: 3 additions & 3 deletions src/assets/components/slice/slice-card/SliceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export function SliceCard({ projectUuid, asset, selected, onSelectChange, onDele
<Card withBorder padding="lg" radius="md" className={classes.card} style={{ minWidth: size, width: size, borderColor: selected ? 'red' : '' }}>
<Card.Section mb="sm" onClick={() => onSelectChange(true)}>
<AspectRatio ratio={16 / 9}>
{asset?.slice?.image_id === "" ? <IconFile /> :
{asset?.image_id === "" ? <IconFile /> :
<Image
src={`${settings.localBackend}/projects/${projectUuid}/assets/${asset?.slice?.image_id}`}
src={`${settings.localBackend}/projects/${projectUuid}/assets/${asset?.image_id}`}
alt={asset.name}
/>
}
Expand All @@ -48,7 +48,7 @@ export function SliceCard({ projectUuid, asset, selected, onSelectChange, onDele
downloadURL={`${settings.localBackend}/projects/${projectUuid}/assets/${asset?.id}?download=true'`}
onDelete={() => onDelete(projectUuid, asset.id)}
toggleLoad={toggleLoadingCallback}>
<SetAsMain projectUuid={projectUuid} assetId={asset.slice?.image_id} onChange={() => { onChange(projectUuid, asset.model?.image_id) }} />
<SetAsMain projectUuid={projectUuid} assetId={asset.slice?.image_id} onChange={() => { onChange(projectUuid, asset.image_id) }} />
</DropDownMenu>
</Group>
</Group>
Expand Down
1 change: 1 addition & 0 deletions src/assets/entities/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Asset {
asset_type: AssetType
extension: string
mime_type: string
image_id: string
model?: Model
project_image?: ProjectImage
project_file?: ProjectFile
Expand Down

0 comments on commit bc0245b

Please sign in to comment.