Skip to content

Commit

Permalink
4379 feat update resources panel layout with new designs (#4421)
Browse files Browse the repository at this point in the history
Co-authored-by: Brittany Kondo <[email protected]>
Co-authored-by: Brittany Kondo <[email protected]>
Co-authored-by: Yohann Paris <[email protected]>
  • Loading branch information
4 people authored Aug 12, 2024
1 parent 3ad7cb2 commit f1ced2f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 49 deletions.
4 changes: 2 additions & 2 deletions packages/client/hmi-client/src/assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** CSS Layers order
* https://developer.mozilla.org/en-US/docs/Web/CSS/@layer
*/
@layer vendor, reset, theme, terarium, layout;
@layer vendor, reset, theme, terarium;

/* Vendor */
@import '@jupyterlab/application/style/index.css' layer(vendor);
Expand All @@ -23,7 +23,7 @@
/* Terarium PrimeVue Theme */
@import '@assets/css/theme/theme.scss' layer(terarium);

@layer layout {
@layer terarium {
:root {
--navbar-outer-height: 51px;
-webkit-font-smoothing: antialiased;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<template>
<nav>
<header>
<div class="p-inputgroup">
<InputText
v-model="searchAsset"
placeholder="Filter resources"
id="searchAsset"
@focus="inputFocused = true"
@blur="inputFocused = false"
/>
<span v-if="searchAsset || inputFocused" class="clear-icon" @click="clearSearch()">
<i class="pi pi-times"></i>
</span>
<span class="p-inputgroup-addon">
<i class="pi pi-filter"></i>
</span>
</div>
<InputText
v-model="searchAsset"
class="resource-panel-search"
placeholder="Filter"
id="searchAsset"
@focus="inputFocused = true"
@blur="inputFocused = false"
/>
<Button
class="upload-resources-button"
size="small"
label="Upload"
@click="isUploadResourcesModalVisible = true"
/>
<tera-upload-resources-modal
:visible="isUploadResourcesModalVisible"
@close="isUploadResourcesModalVisible = false"
/>
</header>
<Button
class="asset-button"
Expand Down Expand Up @@ -48,7 +51,8 @@
<div class="flex justify-space-between w-full">
<div class="flex align-items-center w-full">
<template v-if="type === AssetType.Document">Documents</template>
<template v-else>{{ capitalize(type) }}</template>
<template v-else-if="type === AssetType.Code">Code Files</template>
<template v-else>{{ capitalize(type) }}s</template>
<aside>({{ assetItems.length }})</aside>
</div>
<!-- New asset buttons for some types -->
Expand Down Expand Up @@ -156,6 +160,7 @@ import InputText from 'primevue/inputtext';
import Skeleton from 'primevue/skeleton';
import { computed, ref } from 'vue';
import { getElapsedTimeText } from '@/utils/date';
import TeraUploadResourcesModal from '@/components/project/tera-upload-resources-modal.vue';

defineProps<{
pageType: ProjectPages | AssetType;
Expand All @@ -172,6 +177,7 @@ const draggedAsset = ref<AssetRoute | null>(null);
const assetToDelete = ref<AssetItem | null>(null);
const searchAsset = ref<string>('');
const inputFocused = ref(false);
const isUploadResourcesModalVisible = ref(false);

const assetItemsMap = computed(() => generateProjectAssetsMap(searchAsset.value));
const assetItemsKeysNotEmpty = computed(() => getNonNullSetOfVisibleItems(assetItemsMap.value));
Expand All @@ -182,10 +188,6 @@ const activeAccordionTabs = ref(
)
);

function clearSearch() {
searchAsset.value = '';
}

function removeAsset() {
if (assetToDelete.value) {
const { assetId, pageType } = assetToDelete.value;
Expand Down Expand Up @@ -326,6 +328,7 @@ header {
text-align: left;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: var(--font-weight);
}

.loading-spinner {
Expand All @@ -350,6 +353,7 @@ p.remove {

.resource-panel-search {
width: 100%;
margin-left: var(--gap-2);
}

:deep(.p-button-icon-left.icon) {
Expand All @@ -362,4 +366,13 @@ p.remove {
align-items: center;
row-gap: 0.5rem;
}

.upload-resources-button {
margin: 0 var(--gap-2);
justify-content: center;

& :deep(.p-button-label) {
flex-grow: 0;
}
}
</style>
28 changes: 1 addition & 27 deletions packages/client/hmi-client/src/page/tera-project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@
@open-new-asset="openNewAsset"
/>
</template>
<template v-slot:footerButtons>
<Button
class="upload-resources-button"
size="small"
icon="pi pi-upload"
label="Upload resources"
@click="isUploadResourcesModalVisible = true"
/>
<tera-upload-resources-modal
:visible="isUploadResourcesModalVisible"
@close="isUploadResourcesModalVisible = false"
/>
</template>
</tera-slider-panel>
<section class="project-page">
<tera-model v-if="pageType === AssetType.Model" :asset-id="assetId" />
Expand Down Expand Up @@ -78,11 +65,9 @@ import { AssetType } from '@/types/Types';
import { AssetRoute } from '@/types/common';
import { logger } from '@/utils/logger';
import { isEqual } from 'lodash';
import Button from 'primevue/button';
import { computed, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import TeraSaveAssetModal from '@/components/project/tera-save-asset-modal.vue';
import TeraUploadResourcesModal from '@/components/project/tera-upload-resources-modal.vue';
const route = useRoute();
const router = useRouter();
Expand All @@ -91,7 +76,6 @@ const isResourcesSliderOpen = ref(true);
const isNotesSliderOpen = ref(false);
const showSaveAssetModal = ref(false);
const assetTypeToCreate = ref<AssetType>(AssetType.Model);
const isUploadResourcesModalVisible = ref(false);
const pageType = computed(() => (route.params.pageType as ProjectPages | AssetType) ?? '');
const assetId = computed(() => (route.params.assetId as string) ?? '');
Expand Down Expand Up @@ -142,6 +126,7 @@ onMounted(() => {
.resource-panel {
z-index: 1000;
isolation: isolate;
outline-color: var(--surface-border);
}
.tab-group {
Expand All @@ -158,17 +143,6 @@ section {
overflow-y: hidden;
}
.upload-resources-button {
margin: 0 1rem;
flex-grow: 1;
min-width: 140px;
justify-content: center;
& :deep(.p-button-label) {
flex-grow: 0;
}
}
.p-tabmenu:deep(.p-tabmenuitem) {
display: inline;
max-width: 15rem;
Expand Down

0 comments on commit f1ced2f

Please sign in to comment.