Sprint: ll (#206)
* feat(jobs): voeg lib/jobs-time-filter.ts toe met tijdvenster-predikaat Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(user-settings): voeg views.jobs.timeFilter toe aan UserSettingsSchema Breidt ViewsPrefs uit met een jobs-object (JobsViewPrefs) dat timeFilter accepteert met waarden '1h' | '24h' | 'all'. ViewsPrefs blijft .strict(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(jobs-time-filter): voeg unit-tests toe voor isWithinTimeWindow en UserSettings-schema Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(jobs-time-filter): voeg JobsTimeFilterControl component toe Nieuw client-component dat views.jobs.timeFilter leest/schrijft via useUserSettingsStore met pill-stijl (MD3-tokens). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(jobs): wire JobsTimeFilter in jobs page header Plaatst het tijdfilter-component rechts van de Jobs-kop via justify-between op de header-div. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(jobs): pas tijdvenster-filter toe in JobsColumn Lees views.jobs.timeFilter uit de store en filter jobs op createdAt via isWithinTimeWindow, als eerste check vóór de bestaande kind/status-filters. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ea28a62973
commit
3ad352c10f
7 changed files with 152 additions and 1 deletions
21
lib/jobs-time-filter.ts
Normal file
21
lib/jobs-time-filter.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export const JOBS_TIME_FILTER_VALUES = ['1h', '24h', 'all'] as const;
|
||||
|
||||
export type JobsTimeFilter = (typeof JOBS_TIME_FILTER_VALUES)[number];
|
||||
|
||||
export const DEFAULT_JOBS_TIME_FILTER: JobsTimeFilter = 'all';
|
||||
|
||||
const WINDOW_MS: Record<'1h' | '24h', number> = {
|
||||
'1h': 60 * 60 * 1000,
|
||||
'24h': 24 * 60 * 60 * 1000,
|
||||
};
|
||||
|
||||
export function isWithinTimeWindow(
|
||||
createdAt: Date | string,
|
||||
filter: JobsTimeFilter,
|
||||
now: number = Date.now(),
|
||||
): boolean {
|
||||
if (filter === 'all') return true;
|
||||
const ts = new Date(createdAt).getTime();
|
||||
if (Number.isNaN(ts)) return true;
|
||||
return ts >= now - WINDOW_MS[filter];
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { z } from 'zod'
|
||||
import { JOBS_TIME_FILTER_VALUES } from '@/lib/jobs-time-filter'
|
||||
|
||||
const PriorityFilter = z.union([
|
||||
z.number().int().min(1).max(4),
|
||||
|
|
@ -32,11 +33,16 @@ const JobsColumnPrefs = z.object({
|
|||
statuses: z.array(z.string()),
|
||||
}).strict()
|
||||
|
||||
const JobsViewPrefs = z.object({
|
||||
timeFilter: z.enum(JOBS_TIME_FILTER_VALUES).optional(),
|
||||
}).strict()
|
||||
|
||||
const ViewsPrefs = z.object({
|
||||
sprintBacklog: SprintBacklogPrefs.optional(),
|
||||
pbiList: PbiListPrefs.optional(),
|
||||
storyPanel: StoryPanelPrefs.optional(),
|
||||
jobsColumns: z.record(z.string(), JobsColumnPrefs).optional(),
|
||||
jobs: JobsViewPrefs.optional(),
|
||||
}).strict()
|
||||
|
||||
const DevToolsPrefs = z.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue