From c0b16ef6dc405534ea0be8ee28303bd93ac493c0 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 13 Mar 2026 16:44:30 +0100 Subject: [PATCH] refactor(frontend) : redesign TaskGitSection with tabs and collapsible commits, add scrollable modal Co-Authored-By: Claude Opus 4.6 --- frontend/components/task/TaskGitSection.vue | 385 ++++++++++++++------ frontend/components/task/TaskModal.vue | 5 +- 2 files changed, 268 insertions(+), 122 deletions(-) diff --git a/frontend/components/task/TaskGitSection.vue b/frontend/components/task/TaskGitSection.vue index 70224fa..2f70830 100644 --- a/frontend/components/task/TaskGitSection.vue +++ b/frontend/components/task/TaskGitSection.vue @@ -1,147 +1,231 @@ @@ -158,6 +242,7 @@ const props = defineProps<{ const { listBranches, createBranch, listPullRequests, getBranchName } = useGiteaService() +const activeTab = ref<'branches' | 'prs'>('branches') const branches = ref([]) const pullRequests = ref([]) const isLoading = ref(true) @@ -165,6 +250,7 @@ const isLoadingPrs = ref(true) const isCreating = ref(false) const error = ref(false) const showCreateForm = ref(false) +const expandedBranches = ref(new Set()) const branchForm = reactive({ type: 'feature', @@ -179,6 +265,8 @@ const typeOptions = [ { label: t('gitea.branch.types.chore'), value: 'chore' }, ] +const hasOpenPr = computed(() => pullRequests.value.some(pr => pr.state === 'open' && !pr.merged)) + const branchPreview = computed(() => { if (!props.task.project?.code || !props.task.number) return '' const slug = props.task.title @@ -191,6 +279,14 @@ const branchPreview = computed(() => { return `${branchForm.type}/${props.task.project.code}-${props.task.number}-${slug}` }) +function toggleBranch(name: string) { + if (expandedBranches.value.has(name)) { + expandedBranches.value.delete(name) + } else { + expandedBranches.value.add(name) + } +} + function branchUrl(name: string): string { const project = props.task.project if (!project?.giteaOwner || !project?.giteaRepo) return '#' @@ -201,6 +297,18 @@ function commitFirstLine(message: string): string { return message.split('\n')[0] } +function formatDate(dateStr: string): string { + const d = new Date(dateStr) + const now = new Date() + const diffMs = now.getTime() - d.getTime() + const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)) + + if (diffDays === 0) return "aujourd'hui" + if (diffDays === 1) return 'hier' + if (diffDays < 7) return `il y a ${diffDays}j` + return d.toLocaleDateString('fr-FR', { day: 'numeric', month: 'short' }) +} + function prStatusClass(pr: GiteaPullRequest): string { if (pr.merged) return 'bg-purple-500' if (pr.state === 'open') return 'bg-green-500' @@ -234,6 +342,10 @@ async function loadData() { try { branches.value = await listBranches(props.task.id) + // Auto-expand first branch + if (branches.value.length === 1) { + expandedBranches.value.add(branches.value[0].name) + } } catch { error.value = true } finally { @@ -278,3 +390,36 @@ onMounted(() => { loadData() }) + + diff --git a/frontend/components/task/TaskModal.vue b/frontend/components/task/TaskModal.vue index f026c5f..8cd8d38 100644 --- a/frontend/components/task/TaskModal.vue +++ b/frontend/components/task/TaskModal.vue @@ -10,7 +10,8 @@
@@ -37,7 +38,7 @@
-
+