Skip to content

Commit

Permalink
merge: #4040
Browse files Browse the repository at this point in the history
4040: Fix authoring empty states when selecting multiple assets r=jobelenus a=jobelenus

<img src="https://media0.giphy.com/media/Az1CJ2MEjmsp2/giphy.gif"/>

Co-authored-by: John Obelenus <[email protected]>
  • Loading branch information
si-bors-ng[bot] and jobelenus authored Jun 25, 2024
2 parents ed2133a + ff48c88 commit a71ac66
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
12 changes: 11 additions & 1 deletion app/web/src/components/AssetEditorTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<WorkspaceCustomizeEmptyState
:requestStatus="loadAssetsRequestStatus"
loadingMessage="Loading assets..."
:instructions="
assetStore.selectedAssets.length > 1
? 'You have selected multiple assets, use the right pane!'
: undefined
"
/>
</template>
<TabGroupItem
Expand Down Expand Up @@ -71,7 +76,12 @@ watch(
assetStore.openAssetFuncIds,
],
([requestStatus, assetId, openAssetFuncIds]) => {
if (!requestStatus.isSuccess || !assetId) {
// no asset/multiple assets selected, don't show tabs
if (!assetId) {
currentTabs.value = [];
return;
}
if (!requestStatus.isSuccess) {
return;
}
Expand Down
20 changes: 14 additions & 6 deletions app/web/src/components/AssetFuncListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@
context="workspace-lab-assets"
defaultOpen
/>
<EmptyStateCard
v-else
iconName="funcs"
primaryText="Select Asset, View Functions"
secondaryText="Select an asset from the list above to view its attached functions here."
/>
<template v-else>
<EmptyStateCard
v-if="assetStore.selectedAssets.length > 1"
iconName="funcs"
primaryText=""
secondaryText="You have selected multiple assets above"
/>
<EmptyStateCard
v-else
iconName="funcs"
primaryText="Select Asset, View Functions"
secondaryText="Select an asset from the list above to view its attached functions here."
/>
</template>
</ScrollArea>
<AssetFuncAttachModal ref="attachModalRef" :assetId="assetId" />
</div>
Expand Down
9 changes: 8 additions & 1 deletion app/web/src/components/WorkspaceCustomizeEmptyState.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div
class="text-sm italic text-neutral-500 dark:text-neutral-400 text-center"
>
Use the left panel to get started!
{{ $props.instructions }}
</div>
<div>
<RequestStatusMessage
Expand All @@ -35,5 +35,12 @@ import EmptyStateIcon from "./EmptyStateIcon.vue";
defineProps({
requestStatus: { type: Object as PropType<ApiRequestStatus>, required: true },
loadingMessage: { type: String, required: true },
instructions: {
type: String,
required: false,
default() {
return "Use the left panel to get started!";
},
},
});
</script>

0 comments on commit a71ac66

Please sign in to comment.