From 1b2eb78643a92dd5fd4e4bb73e6b693fa60f01e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 23:27:55 +0000 Subject: [PATCH] Refactor: add helper functions for year formatting and improve code clarity Co-authored-by: ArthurDanjou <29738535+ArthurDanjou@users.noreply.github.com> --- app/pages/ecosystem.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/pages/ecosystem.vue b/app/pages/ecosystem.vue index 62fbb05..afd6c89 100644 --- a/app/pages/ecosystem.vue +++ b/app/pages/ecosystem.vue @@ -55,6 +55,13 @@ const generatePosition = (index: number, total: number, column: number, offset = } } +// Helper function to format date range +const formatYearRange = (startDate?: string, endDate?: string): string => { + const start = startDate?.substring(0, 4) || '?' + const end = endDate?.substring(0, 4) || 'Present' + return `${start}-${end}` +} + // Create center node const centerNode: Node = { id: 'center', @@ -89,7 +96,7 @@ const educationNodes: Node[] = (education.value || []).map((item: EducationItem, data: { label: item.degree, subtitle: item.institution, - years: `${item.startDate?.substring(0, 4) || ''}-${item.endDate?.substring(0, 4) || ''}` + years: formatYearRange(item.startDate, item.endDate) }, style: { background: '#3b82f6', @@ -118,7 +125,7 @@ const experienceNodes: Node[] = (experiences.value || []).map((item: ExperienceI data: { label: item.title, subtitle: item.company, - years: `${item.startDate?.substring(0, 4) || ''}-${item.endDate?.substring(0, 4) || ''}` + years: formatYearRange(item.startDate, item.endDate) }, style: { background: '#10b981', @@ -246,11 +253,14 @@ const edges = ref([ // Initialize VueFlow const { fitView } = useVueFlow() +// Delay for DOM readiness before fitting view +const FIT_VIEW_DELAY_MS = 100 + onMounted(() => { nextTick(() => { setTimeout(() => { fitView({ padding: 0.15, duration: 800 }) - }, 100) + }, FIT_VIEW_DELAY_MS) }) })