refactor: address code review feedback

- Use reactive props destructuring in NodeFooter
- Remove dead isBackground parameter, replace getTabStyles with
  tabStyles constant
- Extract errorWrapperStyles to eliminate 3x class duplication
- Skip vueBoundsOverrides entry when footerHeight is 0
This commit is contained in:
jaeone94
2026-03-30 20:57:48 +09:00
committed by jaeone94
parent 959bd0f830
commit 7c4b91fca9
2 changed files with 38 additions and 23 deletions

View File

@@ -2,13 +2,13 @@
<!-- Case 1: Subgraph + Error (Dual Tabs) -->
<div
v-if="isSubgraph && hasAnyError && showErrorsTabEnabled"
class="isolate -z-1 -mx-1 -mt-5 -mb-2 box-border flex w-[calc(100%+8px)] pb-1"
:class="errorWrapperStyles"
>
<Button
variant="textonly"
:class="
cn(
getTabStyles(false),
tabStyles,
'z-10 box-border w-1/2 rounded-none bg-destructive-background pt-9 pb-4 text-white hover:bg-destructive-background-hover',
errorRadiusClass
)
@@ -26,7 +26,7 @@
data-testid="subgraph-enter-button"
:class="
cn(
getTabStyles(true),
tabStyles,
'-ml-5 box-border w-[calc(50%+20px)] rounded-none bg-node-component-header-surface pt-9 pb-4 pl-5',
enterRadiusClass
)
@@ -49,13 +49,13 @@
showErrorsTabEnabled &&
(showAdvancedInputsButton || showAdvancedState)
"
class="isolate -z-1 -mx-1 -mt-5 -mb-2 box-border flex w-[calc(100%+8px)] pb-1"
:class="errorWrapperStyles"
>
<Button
variant="textonly"
:class="
cn(
getTabStyles(false),
tabStyles,
'z-10 box-border w-1/2 rounded-none bg-destructive-background pt-9 pb-4 text-white hover:bg-destructive-background-hover',
errorRadiusClass
)
@@ -72,7 +72,7 @@
variant="textonly"
:class="
cn(
getTabStyles(true),
tabStyles,
'-ml-5 box-border w-[calc(50%+20px)] rounded-none bg-node-component-header-surface pt-9 pb-4 pl-5',
enterRadiusClass
)
@@ -100,13 +100,13 @@
<!-- Case 2: Error Only (Full Width) -->
<div
v-else-if="hasAnyError && showErrorsTabEnabled"
class="isolate -z-1 -mx-1 -mt-5 -mb-2 box-border flex w-[calc(100%+8px)] pb-1"
:class="errorWrapperStyles"
>
<Button
variant="textonly"
:class="
cn(
getTabStyles(false),
tabStyles,
'box-border w-full rounded-none bg-destructive-background pt-9 pb-4 text-white hover:bg-destructive-background-hover',
footerRadiusClass
)
@@ -135,7 +135,7 @@
data-testid="subgraph-enter-button"
:class="
cn(
getTabStyles(true),
tabStyles,
'box-border w-full rounded-none bg-node-component-header-surface',
hasAnyError ? 'pt-9 pb-4' : 'pt-8 pb-4',
footerRadiusClass
@@ -165,7 +165,7 @@
variant="textonly"
:class="
cn(
getTabStyles(true),
tabStyles,
'box-border w-full rounded-none bg-node-component-header-surface',
hasAnyError ? 'pt-9 pb-4' : 'pt-8 pb-4',
footerRadiusClass
@@ -211,7 +211,15 @@ interface Props {
shape?: RenderShape
}
const props = defineProps<Props>()
const {
isSubgraph,
hasAnyError,
showErrorsTabEnabled,
showAdvancedInputsButton,
showAdvancedState,
headerColor,
shape
} = defineProps<Props>()
defineEmits<{
(e: 'enterSubgraph'): void
@@ -220,8 +228,8 @@ defineEmits<{
}>()
const footerRadiusClass = computed(() => {
const isError = props.hasAnyError
switch (props.shape) {
const isError = hasAnyError
switch (shape) {
case RenderShape.BOX:
return ''
case RenderShape.CARD:
@@ -232,7 +240,7 @@ const footerRadiusClass = computed(() => {
})
const errorRadiusClass = computed(() => {
switch (props.shape) {
switch (shape) {
case RenderShape.BOX:
return ''
case RenderShape.CARD:
@@ -243,7 +251,7 @@ const errorRadiusClass = computed(() => {
})
const enterRadiusClass = computed(() => {
switch (props.shape) {
switch (shape) {
case RenderShape.BOX:
return ''
case RenderShape.CARD:
@@ -252,11 +260,11 @@ const enterRadiusClass = computed(() => {
}
})
const getTabStyles = (isBackground = false) => {
return cn('pointer-events-auto h-9 text-xs', isBackground ? '' : '')
}
const tabStyles = 'pointer-events-auto h-9 text-xs'
const errorWrapperStyles =
'isolate -z-1 -mx-1 -mt-5 -mb-2 box-border flex w-[calc(100%+8px)] pb-1'
const headerColorStyle = computed(() =>
props.headerColor ? { backgroundColor: props.headerColor } : undefined
headerColor ? { backgroundColor: headerColor } : undefined
)
</script>

View File

@@ -178,10 +178,17 @@ const resizeObserver = new ResizeObserver((entries) => {
// Store footer height in vueBoundsOverrides for onBounding
if (nodeId) {
const footerExtra = fullHeight - measuredEl.offsetHeight
vueBoundsOverrides.set(nodeId, {
...vueBoundsOverrides.get(nodeId),
footerHeight: footerExtra > 0 ? footerExtra : 0
})
if (footerExtra > 0) {
vueBoundsOverrides.set(nodeId, {
...vueBoundsOverrides.get(nodeId),
footerHeight: footerExtra
})
} else {
const existing = vueBoundsOverrides.get(nodeId)
if (existing?.footerHeight) {
existing.footerHeight = undefined
}
}
}
const nodeLayout = nodeId