From 3d0c88189276d0a861ceccae64214030a7bac5d1 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 27 May 2026 14:00:12 +0200 Subject: [PATCH] feat : update modal style --- .claude/settings.local.json | 7 ++- app/components/malio/date/DateTime.test.ts | 7 +-- app/components/malio/date/DateTime.vue | 10 +++- app/components/malio/time/TimePicker.vue | 28 ++++++++--- .../time/composables/useInfiniteWheel.test.ts | 29 ++++++++++- .../time/composables/useInfiniteWheel.ts | 49 ++++++++++--------- .../malio/time/internal/TimeWheel.vue | 29 ++++++++--- .../malio/time/internal/TimeWheels.vue | 4 +- 8 files changed, 115 insertions(+), 48 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 278a4af..8ae878a 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -14,7 +14,12 @@ "Bash(mv InputSelect.story.vue selectCheckbox.story.vue select/)", "Bash(mv inputCheckbox.story.vue checkbox/)", "Bash(npx eslint *)", - "Bash(echo \"LINT EXIT: $?\")" + "Bash(echo \"LINT EXIT: $?\")", + "Bash(git commit *)", + "mcp__chrome__navigate_page", + "mcp__chrome__take_snapshot", + "mcp__chrome__click", + "mcp__chrome__evaluate_script" ] } } diff --git a/app/components/malio/date/DateTime.test.ts b/app/components/malio/date/DateTime.test.ts index ccb7409..803b861 100644 --- a/app/components/malio/date/DateTime.test.ts +++ b/app/components/malio/date/DateTime.test.ts @@ -31,7 +31,7 @@ const mountDateTime = (props: DateTimeProps = {}) => describe('MalioDateTime', () => { beforeEach(() => { vi.useFakeTimers() - vi.setSystemTime(new Date(2026, 4, 19)) // 19 mai 2026 + vi.setSystemTime(new Date(2026, 4, 19, 9, 5, 0)) // 19 mai 2026, 09:05 }) afterEach(() => vi.useRealTimers()) @@ -60,11 +60,12 @@ describe('MalioDateTime', () => { }) describe('sélection', () => { - it('émet le jour à 00:00 et garde le popover ouvert', async () => { + it('émet le jour à l\'heure actuelle (si aucune heure choisie) et garde le popover ouvert', async () => { const wrapper = mountDateTime() await wrapper.get('[data-test="date-input"]').trigger('click') await wrapper.get('[data-test="day"][data-iso="2026-05-19"]').trigger('click') - expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual(['2026-05-19T00:00:00']) + // heure système figée à 09:05 + expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual(['2026-05-19T09:05:00']) expect(wrapper.find('[data-test="popover"]').exists()).toBe(true) }) diff --git a/app/components/malio/date/DateTime.vue b/app/components/malio/date/DateTime.vue index 345fc02..fb62f46 100644 --- a/app/components/malio/date/DateTime.vue +++ b/app/components/malio/date/DateTime.vue @@ -28,10 +28,12 @@ :max="max?.slice(0, 10)" @select="onSelectDay" /> -
+
@@ -44,6 +46,7 @@ import {computed, ref, watch} from 'vue' import CalendarField from './internal/CalendarField.vue' import MonthGrid from './internal/MonthGrid.vue' import MalioTimePicker from '../time/TimePicker.vue' +import {formatTime} from '../time/composables/timeFormat' import {composeDateTime, formatIsoDateTimeToDisplay, isValidIsoDateTime, splitDateTime} from './composables/datetimeFormat' defineOptions({name: 'MalioDateTime', inheritAttrs: false}) @@ -100,7 +103,10 @@ const displayValue = computed(() => formatIsoDateTimeToDisplay(props.modelValue const timeValue = computed(() => parts.value.time || pendingTime.value) function onSelectDay(iso: string) { - const time = parts.value.time || pendingTime.value || '00:00' + // Si aucune heure n'a été choisie, on prend l'heure actuelle (pas 00:00). + // (heure courante au moment du clic) + const now = new Date() + const time = parts.value.time || pendingTime.value || formatTime(now.getHours(), now.getMinutes()) emit('update:modelValue', composeDateTime(iso, time)) } diff --git a/app/components/malio/time/TimePicker.vue b/app/components/malio/time/TimePicker.vue index f699b0a..a292b77 100644 --- a/app/components/malio/time/TimePicker.vue +++ b/app/components/malio/time/TimePicker.vue @@ -1,9 +1,6 @@