Refactor Time Selector and Scheduler UI; Implement TimePickerPopover Component
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 1m5s
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 1m5s
- Updated TimeSelector.vue styles for smaller dimensions and font sizes. - Added new API proxy for '/events' in vite.config.ts. - Created bug specifications for various UI issues and fixes in bugs-1.0.5-001.md and bugs-1.0.5-002.md. - Introduced TimePickerPopover.vue for a new time selection interface in the chore scheduler. - Refactored ScheduleModal.vue to replace checkbox rows with a chip-based design for selecting specific days. - Enhanced chore scheduling logic to ensure proper handling of time extensions and UI updates.
This commit is contained in:
@@ -2,6 +2,24 @@ import { onMounted, onBeforeUnmount, watch } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import { eventBus } from './eventBus'
|
||||
|
||||
// Singleton BroadcastChannel for cross-tab event relay.
|
||||
// When this tab receives an SSE event it rebroadcasts it so other tabs
|
||||
// (which may not have received it from the server) can react immediately.
|
||||
const tabChannel =
|
||||
typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel('app_events') : null
|
||||
|
||||
function emitEvent(data: any) {
|
||||
eventBus.emit(data.type, data)
|
||||
eventBus.emit('sse', data)
|
||||
}
|
||||
|
||||
if (tabChannel) {
|
||||
// Receive events that were relayed by another tab and emit them locally.
|
||||
tabChannel.onmessage = (msg) => {
|
||||
emitEvent(msg.data)
|
||||
}
|
||||
}
|
||||
|
||||
export function useBackendEvents(userId: Ref<string>) {
|
||||
let eventSource: EventSource | null = null
|
||||
|
||||
@@ -13,9 +31,9 @@ export function useBackendEvents(userId: Ref<string>) {
|
||||
eventSource.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data)
|
||||
|
||||
// Emit globally for any component that cares
|
||||
eventBus.emit(data.type, data)
|
||||
eventBus.emit('sse', data) // optional: catch-all channel
|
||||
// Emit locally and relay to all other same-origin tabs.
|
||||
emitEvent(data)
|
||||
tabChannel?.postMessage(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ export interface ChoreSchedule {
|
||||
mode: 'days' | 'interval'
|
||||
// mode='days'
|
||||
day_configs: DayConfig[]
|
||||
default_hour?: number // master deadline hour; present when mode='days'
|
||||
default_minute?: number // master deadline minute; present when mode='days'
|
||||
// mode='interval'
|
||||
interval_days: number // 2–7
|
||||
anchor_weekday: number // 0=Sun–6=Sat
|
||||
|
||||
Reference in New Issue
Block a user