Skip to content

Commit

Permalink
misc cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Aug 17, 2024
1 parent d2eff6c commit 4de3331
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/listing/ListingImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ const ListingImages = (props: Props) => {
<>
<Button
onClick={() => setCollapsed(!collapsed)}
variant="outline"
variant="primary"
className="text-md p-4 w-full"
>
Images
{collapsed ? (
<FaCaretSquareUp className="ml-4 text-gray-700" />
<FaCaretSquareUp className="mr-2" />
) : (
<FaCaretSquareDown className="ml-4 text-gray-700" />
<FaCaretSquareDown className="mr-2" />
)}
Images
</Button>
{!collapsed && (
<>
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/listing/ListingMeshes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ const ListingMeshes = (props: Props) => {
<>
<Button
onClick={() => setCollapsed(!collapsed)}
variant="outline"
variant="primary"
className="text-md p-4 w-full"
>
{collapsed ? (
<FaCaretSquareUp className="mr-4 text-gray-700" />
<FaCaretSquareUp className="mr-2" />
) : (
<FaCaretSquareDown className="mr-4 text-gray-700" />
<FaCaretSquareDown className="mr-2" />
)}
Meshes
</Button>
Expand All @@ -109,6 +109,8 @@ const ListingMeshes = (props: Props) => {
<Tooltip key={idx} content={mesh.name}>
<Button
onClick={() => {
if (idx === currentId) return;

setChangeMeshDisabled(true);
setCurrentId(idx);
setMesh(null);
Expand All @@ -117,7 +119,7 @@ const ListingMeshes = (props: Props) => {
setChangeMeshDisabled(false);
}, 300);
}}
variant={idx === currentId ? "primary" : "outline"}
variant={idx === currentId ? "primary" : "secondary"}
className="rounded-full w-full"
disabled={changeMeshDisabled}
>
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/listing/MeshRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const MeshRenderer = ({ url, name, edit, onDelete, disabled, kind }: Props) => {
MeshTypes[(MeshTypes.indexOf(meshType) + 1) % MeshTypes.length],
);
}}
variant="outline"
variant="secondary"
className="rounded-full"
>
<code>{meshType}</code>
Expand All @@ -183,7 +183,7 @@ const MeshRenderer = ({ url, name, edit, onDelete, disabled, kind }: Props) => {
setClickedCopyButton(false);
}, 1000);
}}
variant="outline"
variant="secondary"
className="rounded-full w-full"
disabled={clickedCopyButton}
>
Expand All @@ -195,7 +195,7 @@ const MeshRenderer = ({ url, name, edit, onDelete, disabled, kind }: Props) => {
<>
<Button
onClick={() => setConfirmDelete(true)}
variant="outline"
variant="secondary"
className="rounded-full"
disabled={disabled ?? false}
>
Expand All @@ -204,7 +204,7 @@ const MeshRenderer = ({ url, name, edit, onDelete, disabled, kind }: Props) => {
{confirmDelete && (
<div className="absolute inset-0 flex items-center justify-center z-50">
<div className="bg-white rounded-lg shadow-lg p-4">
<p className="text-lg">
<p className="text-lg mb-2">
Are you sure you want to delete this artifact?
</p>
<div className="flex justify-center space-x-4">
Expand All @@ -213,13 +213,13 @@ const MeshRenderer = ({ url, name, edit, onDelete, disabled, kind }: Props) => {
onDelete?.();
setConfirmDelete(false);
}}
variant="outline"
variant="secondary"
>
<code>yes</code>
</Button>
<Button
onClick={() => setConfirmDelete(false)}
variant="outline"
variant="secondary"
>
<code>no</code>
</Button>
Expand Down
6 changes: 4 additions & 2 deletions store/app/crud/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,12 @@ async def remove_artifact(self, artifact: Artifact, user_id: str) -> None:
await self._remove_raw_artifact(artifact, artifact.artifact_type, user_id)

async def get_listing_artifacts(self, listing_id: str) -> list[Artifact]:
return await self._get_items_from_secondary_index("listing_id", listing_id, Artifact)
artifacts = await self._get_items_from_secondary_index("listing_id", listing_id, Artifact)
return sorted(artifacts, key=lambda a: a.timestamp)

async def get_listings_artifacts(self, listing_ids: list[str]) -> list[list[Artifact]]:
return await self._get_items_from_secondary_index_batch("listing_id", listing_ids, Artifact)
artifact_chunks = await self._get_items_from_secondary_index_batch("listing_id", listing_ids, Artifact)
return [sorted(artifacts, key=lambda a: a.timestamp) for artifacts in artifact_chunks]

async def edit_artifact(
self,
Expand Down

0 comments on commit 4de3331

Please sign in to comment.