From a7e0a604f45facbd0efad21cc574ff99209ea42b Mon Sep 17 00:00:00 2001 From: Lukas Gross Date: Thu, 26 Mar 2026 15:20:46 +0100 Subject: [PATCH 1/3] collapse tags (vibe coded) --- .../__tests__/components/GStatusTag.spec.js | 4 +- frontend/src/components/GScrollContainer.vue | 120 +++++++++++++++--- frontend/src/components/GSeedStatusTag.vue | 98 ++++++++++++-- frontend/src/components/GSeedStatusTags.vue | 31 ++++- frontend/src/components/GShootListRow.vue | 18 ++- frontend/src/components/GStatusTag.vue | 100 +++++++++++++-- frontend/src/components/GStatusTags.vue | 27 +++- frontend/src/plugins/vuetify.js | 1 + 8 files changed, 356 insertions(+), 43 deletions(-) diff --git a/frontend/__tests__/components/GStatusTag.spec.js b/frontend/__tests__/components/GStatusTag.spec.js index b2440311eb..713850ebc9 100644 --- a/frontend/__tests__/components/GStatusTag.spec.js +++ b/frontend/__tests__/components/GStatusTag.spec.js @@ -56,7 +56,7 @@ describe('components', () => { expect(vm.chipTooltip.title).toBe('foo-bar') expect(vm.chipIcon).toBe('') expect(vm.isError || vm.isUnknown || vm.isProgressing).toBe(false) - expect(vm.color).toBe('primary') + expect(vm.color).toBe('success') expect(vm.visible).toBe(true) }) @@ -89,7 +89,7 @@ describe('components', () => { const vm = wrapper.vm expect(vm.visible).toBe(false) expect(vm.isProgressing).toBe(true) - expect(vm.color).toBe('primary') + expect(vm.color).toBe('success') expect(vm.chipStatus).toBe('Progressing') expect(vm.chipIcon).toBe('') }) diff --git a/frontend/src/components/GScrollContainer.vue b/frontend/src/components/GScrollContainer.vue index 1ad9edcb3f..94019a48db 100644 --- a/frontend/src/components/GScrollContainer.vue +++ b/frontend/src/components/GScrollContainer.vue @@ -6,11 +6,22 @@ SPDX-License-Identifier: Apache-2.0 @@ -18,49 +29,128 @@ SPDX-License-Identifier: Apache-2.0 import { ref, computed, + toRefs, } from 'vue' import { useScroll, useElementSize, } from '@vueuse/core' +const props = defineProps({ + direction: { + type: String, + default: 'vertical', + validator: value => ['vertical', 'horizontal'].includes(value), + }, +}) + +const { direction } = toRefs(props) + const scrollRef = ref(null) -const { y } = useScroll(scrollRef) -const { height } = useElementSize(scrollRef) +const contentRef = ref(null) +const { x, y } = useScroll(scrollRef) +const { width, height } = useElementSize(scrollRef) +const { width: contentWidth, height: contentHeight } = useElementSize(contentRef) -const fadeHeight = Math.max(40, height.value / 2) +const fadeSize = computed(() => { + if (direction.value === 'horizontal') { + return Math.max(20, width.value / 4) + } + return Math.max(40, height.value / 2) +}) const fadeOpacity = computed(() => { const el = scrollRef.value if (!el) { - return false + return 0 } - const remainingY = el.scrollHeight - (y.value + height.value) - if (remainingY >= fadeHeight) { - return 1 + if (direction.value === 'horizontal') { + const remainingX = contentWidth.value - (x.value + width.value) + if (remainingX <= 0) { + return 0 + } + if (remainingX >= fadeSize.value) { + return 1 + } + return remainingX / fadeSize.value } - return remainingY / fadeHeight + const remainingY = contentHeight.value - (y.value + height.value) + if (remainingY <= 0) { + return 0 + } + if (remainingY >= fadeSize.value) { + return 1 + } + return remainingY / fadeSize.value }) +const wrapperClasses = computed(() => ({ + 'scroll-wrapper--vertical': direction.value === 'vertical', + 'scroll-wrapper--horizontal': direction.value === 'horizontal', +})) + +const containerClasses = computed(() => ({ + 'scrollable-container--vertical': direction.value === 'vertical', + 'scrollable-container--horizontal': direction.value === 'horizontal', +})) + +const cssVars = computed(() => ({ + '--fadeOpacity': fadeOpacity.value, + '--fadeSize': `${fadeSize.value}px`, +})) diff --git a/frontend/src/components/GSeedStatusTag.vue b/frontend/src/components/GSeedStatusTag.vue index 61a31f2821..4df4b911b0 100644 --- a/frontend/src/components/GSeedStatusTag.vue +++ b/frontend/src/components/GSeedStatusTag.vue @@ -5,7 +5,12 @@ SPDX-License-Identifier: Apache-2.0 -->