4.2 KiB
4.2 KiB
TASK METADATA
- Target Files:
ui/components/SessionsPage.tsx,ui/components/sessions/WorkshopDrawer.tsx,ui/components/sessions/SessionsScript.tsx - Core Objective: Overhaul visual hierarchy of
/dashboard/sessionsand enforce strict 2-state mutually exclusive rendering inWorkshopDrawer.tsx. - Dependencies: None.
- Additional Important Notes: Must use pure vanilla JavaScript for DOM
manipulation (no React/framework state). Ensure copy pills trigger accessible
notifications (aria-live/toast). Fix double emoji bug in JS. Ensure mobile
title wrapping. All changes must pass
ui/ui_scripts.test.ts.
Architectural Considerations & Risks
-
Risks:
- DOM Manipulation Regression: Because this UI operates strictly on
vanilla JavaScript, changing the layout and grouping DOM elements within new
containers (like
#eventCreateStateand#eventHandoffState) risks breaking existing DOM ID bindings inSessionsScript.tsxif IDs are changed or misplaced. We must strictly preserve all existing DOM IDs. - Test Compatibility: The client-side scripts are tested via hermetic
new Function()execution inui/ui_scripts.test.ts(validateJsSyntax). The script modifications must remain structurally valid and strictly avoid any unsupported syntax or external framework dependencies. - Mobile Layout Breakage: When fixing the long titles to wrap correctly,
we must ensure CSS properties like
word-break: break-wordandoverflow-wrap: break-worddon't inadvertently stretch flex containers horizontally on small screens.
- DOM Manipulation Regression: Because this UI operates strictly on
vanilla JavaScript, changing the layout and grouping DOM elements within new
containers (like
-
Alternatives:
- The proposed container-based 2-state machine approach for
WorkshopDrawer.tsxis native and robust. It's the most appropriate solution given our constraints (no client-side frameworks). Using a class-based toggle could also work, but explicit element display manipulation is clearer for the specific 2-state requirement.
- The proposed container-based 2-state machine approach for
Proposed Implementation
1. Page Hierarchy Update (ui/components/SessionsPage.tsx)
- Relocate the main header block (containing
<h1>Active Sessions & Passes</h1>and the[ 🔑 Delegate Session ]button) to be the uppermost visible element below the#status-banner. - Move the
EventCockpitDeckcomponent to render below the new header block. - Keep the
SessionTableandSessionDeckat the bottom.
2. WorkshopDrawer 2-State Machine (ui/components/sessions/WorkshopDrawer.tsx)
- Wrap the initial creation form (
#eventForm), including inputs, submit button, and cancel button, into a new containerdivwithid="eventCreateState". Default this container todisplay: block. - Rename or wrap the
#eventHandoffModalcontent into a new containerdivwithid="eventHandoffState". Default this container todisplay: none. - In
#eventHandoffState, ensure it contains the 3 cards (PIN + /join, Direct Link, CLI 1-Liner) and update the final button to be a single "Dismiss" button. - Ensure
createdEventTitlehasoverflow-wrap: break-wordandword-break: break-wordalong with a max-width to allow long titles to wrap cleanly on mobile screens.
3. JavaScript Logic Update (ui/components/sessions/SessionsScript.tsx)
- State Toggling: Update
handleCreateEventso that upon successful creation, it setsdocument.getElementById('eventCreateState').style.display = 'none'anddocument.getElementById('eventHandoffState').style.display = 'block'. - Drawer Reset: Ensure when the delegate drawer is closed (via
closeDelegateDraweror the new Dismiss button), the states are reset:#eventCreateStateto block,#eventHandoffStateto none. - Emoji Fix: Remove the hardcoded
'🎟️ 'prefix from the event title injection line:document.getElementById('createdEventTitle').textContent = ev.name + ' Live!'; - Accessibility / Toast: Ensure
copyEventHandofffunction already triggersshowNotice(which acts as a toast). Verify ARIA roles for the banner if necessary, or just rely on the existingshowNoticefunction which is already in place.
4. Quality Gates
- Run Deno tests:
deno test --allow-all(specifically validatingui/ui_scripts.test.ts). - Run code formatting:
deno fmt.