From bb64c1c7534b46025413b1609693cb028d3d466c Mon Sep 17 00:00:00 2001 From: Mocilac Date: Fri, 25 Jul 2025 10:30:50 +0200 Subject: [PATCH 1/7] added language support for task tooltip --- src/components/TaskBar.vue | 24 +++++++++++++++++------- src/composables/useI18n.ts | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/TaskBar.vue b/src/components/TaskBar.vue index 37ed492..3d9faa1 100644 --- a/src/components/TaskBar.vue +++ b/src/components/TaskBar.vue @@ -3,6 +3,10 @@ import { ref, computed, onUnmounted, onMounted, nextTick, watch } from 'vue' import type { Task } from '../models/classes/Task' import { TimelineScale } from '../models/types/TimelineScale' + +import { useI18n } from '../composables/useI18n' + + interface Props { task: Task rowHeight: number @@ -30,6 +34,12 @@ interface Props { const props = defineProps() +const { setLocale, getTranslation } = useI18n() + +const t = (key: string): string => { + return getTranslation(key) +} + const emit = defineEmits([ 'update:task', 'bar-mounted', @@ -825,9 +835,9 @@ const handleBubbleMouseDown = (event: MouseEvent) => { // 格式化日期显示 const formatDisplayDate = (dateStr: string | undefined): string => { - if (!dateStr) return '未设置' + if (!dateStr) return t('dateNotSet') const date = createLocalDate(dateStr) - if (!date) return '未设置' + if (!date) return t('dateNotSet') const year = date.getFullYear() const month = String(date.getMonth() + 1).padStart(2, '0') @@ -1065,23 +1075,23 @@ const calculatePositionFromTimelineData = (
{{ task.name }}
- 计划开始: + {{ t('startDate') }}: {{ formatDisplayDate(task.startDate) }}
- 计划结束: + {{ t('endDate') }}: {{ formatDisplayDate(task.endDate) }}
- 计划工时: + {{ t('estimatedHours') }}: {{ workHourInfo.total }}h
- 已用工时: + {{ t('actualHours') }}: {{ workHourInfo.used }}h
- 完成率: + {{ t('progress') }}: {{ task.progress || 0 }}%
diff --git a/src/composables/useI18n.ts b/src/composables/useI18n.ts index 5eb906b..c126f53 100644 --- a/src/composables/useI18n.ts +++ b/src/composables/useI18n.ts @@ -6,6 +6,7 @@ export type Locale = 'zh-CN' | 'en-US' // 多语言配置 const messages = { 'zh-CN': { + dateNotSet: '未设置', // TaskList Header taskName: '任务名称', predecessor: '前置任务', @@ -158,6 +159,7 @@ const messages = { days: '天', }, 'en-US': { + dateNotSet:'Not set', // TaskList Header taskName: 'Task Name', predecessor: 'Predecessor', From 9b18d49e00a0bb9bc394c6f8dbbdbf69541dc7c1 Mon Sep 17 00:00:00 2001 From: Mocilac Date: Fri, 25 Jul 2025 10:31:41 +0200 Subject: [PATCH 2/7] English version of githubpages --- docs/GITHUB-PAGES-EN.md.txt | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 docs/GITHUB-PAGES-EN.md.txt diff --git a/docs/GITHUB-PAGES-EN.md.txt b/docs/GITHUB-PAGES-EN.md.txt new file mode 100644 index 0000000..22a9f41 --- /dev/null +++ b/docs/GITHUB-PAGES-EN.md.txt @@ -0,0 +1,61 @@ +# GitHub Pages Deployment Guide + +This project has been configured with automatic deployment of GitHub Pages, and users can experience the complete Gantt charting function online. + +## 🌐 Online visit + +**Demo Address**: https://nelson820125.github.io/jordium-gantt-vue3/ + +## 🔧 Deployment Configuration + +### Automated deployment + +Projects are automatically deployed to GitHub Pages using GitHub Actions: + +- **Triggering condition**: Push to `main` or `master` branch +- **Build Command**: `npm run build:pages` +- **Deployment Directory**: `./dist` +- **Workflows**: `.github/workflows/deploy-github-pages.yml` + +### Enable GitHub Pages manually + +1. Enter the GitHub repository settings page +2. Find the "Pages" setting options +3. Select "Source" as "GitHub Actions" +4. Push code to the main branch and automatically trigger deployment + +## 📁 Construct the product + +- **Development and Construction**: `npm run build` → `dist/` +- **GitHub Pages**: `npm run build:pages` → `dist/` (contains the correct base path) +- **NPM package build**: `npm run build:lib` → `npm-package/dist/` + +## 🛠️ Local Preview + +```bash +# Installation dependencies +npm install + +# Start the development server +npm run dev + +# Build and preview the production version +npm run build:pages +npm run preview +``` + +## 🔄 Update deployment + +GitHub Actions will automatically: + +1. Check out the code +2. Install Node.js and dependencies +3. Build demo application +4. Deploy to GitHub Pages + +## 📝 Notes + +- Deployment usually takes 1-5 minutes to take effect +- Make sure GitHub Pages is enabled in repository settings +- Custom domain names need to be configured in the `demo/public/CNAME` file +- Static resource paths use relative paths to ensure normal loading in the Pages environment \ No newline at end of file From 88578d48d77965bf98fa520d49621cb34959e16a Mon Sep 17 00:00:00 2001 From: Mocilac Date: Fri, 25 Jul 2025 10:33:14 +0200 Subject: [PATCH 3/7] Removed default task assignees --- src/components/TaskDrawer.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/TaskDrawer.vue b/src/components/TaskDrawer.vue index f46f7e2..8aa91c0 100644 --- a/src/components/TaskDrawer.vue +++ b/src/components/TaskDrawer.vue @@ -426,15 +426,15 @@ watch( {{ errors.type }} -
+
From 0861ec7ef71cc18afc8be337dcad76d3a74747fc Mon Sep 17 00:00:00 2001 From: Mocilac Date: Sat, 26 Jul 2025 11:24:40 +0200 Subject: [PATCH 4/7] removed chinese year label --- src/components/Timeline.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 363d3cd..b7bf082 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -1648,7 +1648,7 @@ const generateMonthTimelineData = () => { class="timeline-year" :style="{ width: '719px' }" > -
{{ yearValue }}年
+
{{ yearValue }}
From 24783f9f748d90b8d0abfe2d19a0035f117a65bb Mon Sep 17 00:00:00 2001 From: Mocilac Date: Sat, 26 Jul 2025 11:25:26 +0200 Subject: [PATCH 5/7] Milestone tooltip internationalisation --- src/components/MilestonePoint.vue | 19 +++++++++++++------ src/composables/useI18n.ts | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/MilestonePoint.vue b/src/components/MilestonePoint.vue index bdf1985..0789aa5 100644 --- a/src/components/MilestonePoint.vue +++ b/src/components/MilestonePoint.vue @@ -2,6 +2,13 @@ import { computed, ref, onUnmounted } from 'vue' import type { Milestone } from '../models/classes/Milestone' import { TimelineScale } from '../models/types/TimelineScale' +import { useI18n } from '../composables/useI18n' + +const { setLocale, getTranslation } = useI18n() + +const t = (key: string): string => { + return getTranslation(key) +} interface Props { date: string // 里程碑日期 @@ -478,26 +485,26 @@ const handleMilestoneMouseLeave = () => { // 格式化日期显示 const formatDisplayDate = (dateStr: string): string => { - if (!dateStr) return '未设置' + if (!dateStr) return t('dateNotSet') //Not Set try { const date = new Date(dateStr) - if (isNaN(date.getTime())) return '未设置' + if (isNaN(date.getTime())) return t('dateNotSet') const year = date.getFullYear() const month = String(date.getMonth() + 1).padStart(2, '0') const day = String(date.getDate()).padStart(2, '0') return `${year}-${month}-${day}` } catch { - return '未设置' + return t('dateNotSet') } } -// Tooltip内容 +// Tooltip内容 Target date const tooltipContent = computed(() => { - const milestoneName = props.name || props.milestone?.name || '里程碑' + const milestoneName = props.name || props.milestone?.name || t('milestone') const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '') - return `里程碑:${milestoneName} - 目标日期:${targetDate}` + return `${t('milestone')}:${milestoneName} - ${t('targetDate')}:${targetDate}` }) // 组件销毁时清理事件监听器 diff --git a/src/composables/useI18n.ts b/src/composables/useI18n.ts index c126f53..21b503d 100644 --- a/src/composables/useI18n.ts +++ b/src/composables/useI18n.ts @@ -41,6 +41,7 @@ const messages = { // 其他 milestone: '里程碑', + targetDate: '目标日期', today: '今天', // 里程碑对话框 milestoneDetails: '里程碑详情', @@ -192,6 +193,7 @@ const messages = { // 其他 milestone: 'Milestone', + targetDate: 'Target Date', today: 'Today', // 里程碑对话框 milestoneDetails: 'Milestone Details', From 9197813517d050f269160e5fecfafbe6d3f4559f Mon Sep 17 00:00:00 2001 From: Mocilac Date: Sat, 26 Jul 2025 17:14:41 +0200 Subject: [PATCH 6/7] Milestone tooltip internationalistation --- src/components/MilestonePoint.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/MilestonePoint.vue b/src/components/MilestonePoint.vue index 0789aa5..ccfcc4a 100644 --- a/src/components/MilestonePoint.vue +++ b/src/components/MilestonePoint.vue @@ -504,7 +504,7 @@ const formatDisplayDate = (dateStr: string): string => { const tooltipContent = computed(() => { const milestoneName = props.name || props.milestone?.name || t('milestone') const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '') - return `${t('milestone')}:${milestoneName} - ${t('targetDate')}:${targetDate}` + return `${t('milestone')}:${milestoneName}
${t('targetDate')}:${targetDate}` }) // 组件销毁时清理事件监听器 @@ -688,8 +688,7 @@ const calculateMilestonePositionFromTimelineData = ( top: `${tooltipPosition.y}px`, }" > -
- {{ tooltipContent }} +
From d6f1908431a5437920de69d00795c0de6ce5d2a8 Mon Sep 17 00:00:00 2001 From: Mocilac Date: Thu, 31 Jul 2025 12:00:16 +0200 Subject: [PATCH 7/7] Datepicker internationalisation --- src/components/DatePicker.vue | 21 ++++++++++++++++----- src/composables/useI18n.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 70ec47c..5371dbe 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -1,5 +1,10 @@