Files
Convivo/apps/convivo/src/lib/time.ts
T
Lago b52d8ab007 Fixes & Refinements: QR token on registration, role caps, connection detail + red dot, admin schedule/sponsors
Datamodel:
- Move qr_token from contacts to registrations (per event); new migration
  20260826000000. lanyard_lookup / create_connection_request / checkin_attendee
  resolve via registrations + active event.
- reset_qr_token -> reset_registration_qr_token (fixes ambiguous 'email' col).
- upsert_contact drops the token arg; create_registration generates + syncs it.
- Pretix sync writes the token to the registration (keeps it on re-sync).

Registration types:
- Distinct pill colors; red reserved for Staff (both apps).
- Roles capitalized everywhere (Attendee/Speaker/Sponsor/Staff); 'Attendee'
  hidden only at the Home footer.
- Reset-token button moved from Contacts to Registrations (per registration).

Sessions (APPE Admin):
- Slot types capitalized; material submitted/not-submitted state.
- Speaker selection = multi-select search dropdown.
- Fix 'a session must have a speaker' on edit (diff-based setSessionSpeakers)
  and the file-upload bug (speaker save no longer aborts first).

APPE Admin:
- Sponsors contact lookup = search field (filter + pick).

Convivo App:
- Other people's QR codes hidden; connection detail sheet shows public info +
  points.
- Connect red dot recalculates immediately on accept/decline/send.
- 'My picks today' = 2 rows (current + next); 'tap to change' links to Agenda.

Docs updated across backend + frontend.
2026-08-23 10:39:21 +02:00

49 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Slot } from './types';
/** The event day (from the seed). All slot times are on this date. */
export const EVENT_DATE = '2026-10-23';
/** Simulated "now" used for the demo (matches the mockup: 10:20 on event day). */
export const DEFAULT_NOW = new Date(`${EVENT_DATE}T10:20:00`);
export type SlotStatus = 'done' | 'now' | 'next';
function at(dateStr: string, time: string): Date {
return new Date(`${dateStr}T${time}`);
}
export function slotStart(slot: Slot): Date {
return at(slot.slot_date, slot.start_time);
}
export function slotEnd(slot: Slot): Date {
return at(slot.slot_date, slot.end_time);
}
export function slotStatus(slot: Slot, now: Date): SlotStatus {
if (now >= slotEnd(slot)) return 'done';
if (now >= slotStart(slot)) return 'now';
return 'next';
}
/** "09:00" from "09:00:00". */
export function fmtTime(time: string): string {
return time.slice(0, 5);
}
export function fmtRange(slot: Slot): string {
return `${fmtTime(slot.start_time)}–${fmtTime(slot.end_time)}`;
}
export function greeting(now: Date): string {
const h = now.getHours();
if (h < 12) return 'Good morning';
if (h < 18) return 'Good afternoon';
return 'Good evening';
}
/** "lunch_break" → "Lunch Break" (capitalize each word). */
export function capWords(s: string): string {
return s.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
}