Commit Graph

138 Commits

Author SHA1 Message Date
Matt c321d4711e Improve pipeline editor UX: stage detail sheet, structured predicates, page reorganization
Build and Push Docker Image / build (push) Failing after 40s Details
- Add Sheet UI component and StageDetailSheet with config/activity tabs
- Stage config opens in right-side sheet (always-editable, no collapsed summary)
- Replace JSON textarea in routing rules with structured PredicateBuilder form
- Remove StageTransitionsEditor from UI (transitions auto-managed)
- Promote Stage Management section to immediately after flowchart
- Conditionally hide Routing Rules (single track) and Award Governance (no awards)
- Add section headers with descriptions and increase spacing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:11:48 +01:00
Matt 2d91ce02fc Fix pipeline detail hook order causing React error 310 2026-02-14 17:04:43 +01:00
Matt 3975b5c51f Fix CRLF line endings in runtime/deploy scripts and enforce LF 2026-02-14 16:35:26 +01:00
Matt b5425e705e Apply full refactor updates plus pipeline/email UX confirmations 2026-02-14 15:26:42 +01:00
Matt e56e143a40 Update CI workflow to use new Gitea registry at code.monaco-opc.com
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:00:50 +01:00
Matt 9ee767b6cd Use session role for invite page, handle stale user sessions gracefully
Build and Push Docker Image / build (push) Failing after 9m17s Details
Switch invite page from DB query (user.me) to JWT session for role checks,
avoiding failures when user ID is stale. Return friendly error from user.me
instead of throwing on missing user.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:30:55 +01:00
Matt 0afd4d97c6 Fix admin roles dropdown, rewrite MOPC-specific expertise tags
Build and Push Docker Image / build (push) Has been cancelled Details
- Refactor role selector to use computed availableRoles array instead of
  conditional JSX fragments, fixing Radix Select not re-rendering admin
  options when async user data loads
- Rewrite 38 generic expertise tags to 44 MOPC-specific tags across 8
  categories aligned with OceanIssue enum: Pollution & Waste, Climate &
  Carbon, Seafood & Aquaculture, Biodiversity & Habitat, Ocean Technology,
  Shipping & Ports, Community & Education, Business & Investment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:25:41 +01:00
Matt 2a374195c4 Add explicit edit actions for existing pipeline cards
Build and Push Docker Image / build (push) Successful in 10m16s Details
2026-02-14 13:04:27 +01:00
Matt c88f540633 Fix pipeline config crashes, settings UX, invite roles, seed expertise tags
Build and Push Docker Image / build (push) Successful in 9m51s Details
- Fix critical crash when clicking Edit on INTAKE stage configs: normalize
  DB fileRequirements shape (type/required → acceptedMimeTypes/isRequired),
  add null guard in getActiveCategoriesFromMimeTypes
- Fix config summary display for all stage types to handle seed data key
  mismatches (votingEnabled→juryVotingEnabled, minAssignmentsPerJuror→
  minLoadPerJuror, deterministic.rules→rules, etc.)
- Add AWARD_MASTER role to invite page dropdown and user router validations
- Restructure settings sidebar: Tags and Webhooks as direct links instead
  of nested tabs, remove redundant Quick Links section
- Seed 38 expertise tags across 7 categories (Marine Science, Technology,
  Policy, Conservation, Business, Education, Engineering)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:40:44 +01:00
Matt ae0ac58547 Mobile responsiveness fixes for pipeline UI redesign
Build and Push Docker Image / build (push) Successful in 9m31s Details
- Detail page header: stack on mobile, icon-only Advanced button on small screens
- InlineEditableText: show pencil icon on mobile (not hover-only)
- EditableCard: show Edit button on mobile (not hover-only)
- PipelineFlowchart: add right-edge fade gradient as scroll hint on mobile
- Summary cards: always 3-col grid (compact on mobile)
- Track switcher: add overflow-x-auto for horizontal scroll

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 01:59:42 +01:00
Matt 59f90ccc37 Pipeline UI/UX redesign: inline editing, flowchart, sidebar stepper
Build and Push Docker Image / build (push) Failing after 8m59s Details
- Add InlineEditableText, EditableCard, SidebarStepper shared components
- Add PipelineFlowchart (interactive SVG stage visualization)
- Add StageConfigEditor and usePipelineInlineEdit hook
- Redesign detail page: flowchart replaces nested tabs, inline editing
- Redesign creation wizard: sidebar stepper replaces accordion sections
- Enhance list page: status dots, track indicators, relative timestamps
- Convert edit page to redirect (editing now inline on detail page)
- Delete old WizardSection accordion component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 01:54:56 +01:00
Matt 70cfad7d46 Platform polish: bulk invite, file requirements, filtering redesign, UX fixes
Build and Push Docker Image / build (push) Successful in 11m41s Details
- F1: Set seed jury/mentors/observers to NONE status (not invited), remove passwords
- F2: Add bulk invite UI with checkbox selection and floating toolbar
- F3: Add getProjectRequirements backend query + requirement slots on project detail
- F4: Redesign filtering section: AI criteria textarea, "What AI sees" card,
  field-aware eligibility rules with human-readable previews
- F5: Auto-redirect to pipeline detail when only one pipeline exists
- F6: Make project names clickable in pipeline intake panel
- F7: Fix pipeline creation error: edition context fallback + .min(1) validation
- Pipeline wizard sections: add isActive locking, info tooltips, UX improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:45:21 +01:00
Matt 451b483880 Fix pipeline edit crash: merge defaults with DB configJson
Build and Push Docker Image / build (push) Successful in 10m2s Details
The DB configJson uses different field names than wizard types expect
(e.g., deterministic.rules vs rules, votingEnabled vs juryVotingEnabled).
The ?? operator only guards null/undefined, but configJson is {} (truthy),
so defaults never applied. This caused config.rules.map() to crash with
"Cannot read properties of undefined (reading 'map')".

Fix: spread defaults first then overlay DB values, and add defensive ??
fallbacks in all section components for potentially undefined properties.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:55:35 +01:00
Matt 7d1c87e938 UI/UX audit fixes: clickable pipelines, broken links, isActive locking
Build and Push Docker Image / build (push) Successful in 10m55s Details
- Make pipeline cards clickable on list page (navigate to detail view)
- Fix broken nav link: applicant /messages → /mentor
- Fix broken nav link: mentor /messages → /projects
- Add isActive field locking to all 7 wizard sections (intake, main-track,
  filtering, assignment, awards, live-finals, notifications)
- Add minLoad ≤ maxLoad cross-field validation in assignment section
- Add duplicate stage slug detection in main track section
- Add active pipeline warning banners in intake and main track sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 20:50:22 +01:00
Matt 31225b099e Fix migration: drop RoundTemplate before RoundType enum
Build and Push Docker Image / build (push) Successful in 10m26s Details
RoundTemplate table depends on RoundType enum, must be dropped first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:45:34 +01:00
Matt dc075f8969 Fix migration with fully idempotent SQL to handle partial application
Build and Push Docker Image / build (push) Successful in 11m46s Details
Rewrote pipeline/stage migration with defensive guards:
- DO blocks with EXCEPTION handlers for enum/constraint creation
- IF NOT EXISTS on all CREATE TABLE/INDEX
- IF EXISTS on all DROP INDEX
- Handles re-running after partial failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 16:42:54 +01:00
Matt 68d3dde1aa Add migration for pipeline/stage system, new enums, and Round retirement
Build and Push Docker Image / build (push) Successful in 12m7s Details
The Round system redesign commit added Pipeline, Track, Stage models
and converted roundId to legacy fields but was missing the SQL migration.
This caused seed failure (AWARD_MASTER enum not found in DB).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 16:19:56 +01:00
Matt 331b67dae0 Round system redesign: Phases 1-7 complete
Build and Push Docker Image / build (push) Successful in 19m31s Details
Full pipeline/track/stage architecture replacing the legacy round system.

Schema: 11 new models (Pipeline, Track, Stage, StageTransition,
ProjectStageState, RoutingRule, Cohort, CohortProject, LiveProgressCursor,
OverrideAction, AudienceVoter) + 8 new enums.

Backend: 9 new routers (pipeline, stage, routing, stageFiltering,
stageAssignment, cohort, live, decision, award) + 6 new services
(stage-engine, routing-engine, stage-filtering, stage-assignment,
stage-notifications, live-control).

Frontend: Pipeline wizard (17 components), jury stage pages (7),
applicant pipeline pages (3), public stage pages (2), admin pipeline
pages (5), shared stage components (3), SSE route, live hook.

Phase 6 refit: 23 routers/services migrated from roundId to stageId,
all frontend components refitted. Deleted round.ts (985 lines),
roundTemplate.ts, round-helpers.ts, round-settings.ts, round-type-settings.tsx,
10 legacy admin pages, 7 legacy jury pages, 3 legacy dialogs.

Phase 7 validation: 36 tests (10 unit + 8 integration files) all passing,
TypeScript 0 errors, Next.js build succeeds, 13 integrity checks,
legacy symbol sweep clean, auto-seed on first Docker startup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 13:57:09 +01:00
root 8a328357e3 Fix round assignment pool, create-page parity, and file settings UX
Build and Push Docker Image / build (push) Successful in 14m5s Details
2026-02-12 17:25:30 +01:00
Matt 52cdca1b85 Move required reviews field into evaluation settings and add live voting migration
Build and Push Docker Image / build (push) Successful in 13m22s Details
Move the "Required Reviews per Project" field from the Basic Information
card into the Evaluation Settings section of RoundTypeSettings, where it
contextually belongs. Add missing database migration for live voting
enhancements (criteria voting, audience voting, AudienceVoter table).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 16:57:56 +01:00
Matt 7b85fd9602 Auto-assign projects to first round, auto-filter on close, pipeline UX consolidation
Build and Push Docker Image / build (push) Successful in 10m30s Details
- New projects (admin create, CSV import, public form) auto-assign to program's
  first round (by sortOrder) when no round is specified
- Closing a FILTERING round auto-starts filtering job (configurable via
  autoFilterOnClose setting, defaults to true)
- Add SUBMISSION_RECEIVED notification type for confirming submissions
- Replace separate List/Pipeline toggle with integrated pipeline view below
  the sortable round list
- Add autoFilterOnClose toggle to filtering round type settings UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:06:11 +01:00
Matt 2a5fa463b3 Round system redesign: criteria voting, audience voting, pipeline view, and admin UX improvements
Build and Push Docker Image / build (push) Successful in 10m53s Details
- Schema: Extend LiveVotingSession with votingMode, criteriaJson, audience fields;
  add AudienceVoter model; make LiveVote.userId nullable for audience voters
- Backend: Criteria-based voting with weighted scores, audience registration/voting
  with token-based dedup, configurable jury/audience weight in results
- Jury UI: Criteria scoring with per-criterion sliders alongside simple 1-10 mode
- Public audience voting page at /vote/[sessionId] with mobile-first design
- Admin live voting: Tabbed layout (Session/Config/Results), criteria config,
  audience settings, weight-adjustable results with tie detection
- Round type settings: Visual card selector replacing dropdown, feature tags
- Round detail page: Live event status section, type-specific stats and actions
- Round pipeline view: Horizontal visualization with bottleneck detection,
  List/Pipeline toggle on rounds page
- SSE: Separate jury/audience vote events, audience vote tracking
- Field visibility: Hide irrelevant fields per round type in create/edit forms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:27:49 +01:00
Matt b5d90d3c26 Add project reports section and fix mobile overflow issues
Build and Push Docker Image / build (push) Successful in 11m20s Details
- Add project-wide reporting table with scope selector (all rounds / per round)
- Fix horizontal overflow on mobile (body, admin sidebar, logo truncation)
- Make members header and reports tabs responsive with flex-wrap

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 19:08:04 +01:00
Matt bd9cd310fc Remove next-intl localization infrastructure
Build and Push Docker Image / build (push) Successful in 16m25s Details
Strips out the i18n layer (next-intl, message files, language switcher,
provider) to reduce complexity. Nav components now use plain English strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 14:57:27 +01:00
Matt ce4069bf92 Platform-wide visual overhaul, team invites, analytics improvements, and deployment hardening
Build and Push Docker Image / build (push) Successful in 11m14s Details
UI overhaul applying jury dashboard design patterns across all pages:
- Stat cards with border-l-4 accent + icon pills on admin, observer, mentor, applicant dashboards and reports
- Card section headers with color-coded icon pills throughout
- Hover lift effects (translate-y + shadow) on cards and list items
- Gradient progress bars (brand-teal to brand-blue) platform-wide
- AnimatedCard stagger animations on all dashboard sections
- Auth pages with gradient accent strip and polished icon containers
- EmptyState component upgraded with rounded icon pill containers
- Replaced AI-looking icons (Brain/Sparkles/Bot/Wand2/Cpu) with descriptive alternatives across 12 files
- Removed gradient overlay from jury dashboard header
- Quick actions restyled as card links with group hover effects

Backend improvements:
- Team member invite emails with account setup flow and notification logging
- Analytics routers accept edition-wide queries (programId) in addition to roundId
- Round detail endpoint returns inline progress data (eliminates extra getProgress call)
- Award voting endpoints parallelized with Promise.all
- Bulk invite supports optional sendInvitation flag
- AwardVote composite index migration for query performance

Infrastructure:
- Docker entrypoint with migration retry loop (configurable retries/delay)
- docker-compose pull_policy: always for automatic image refresh
- Simplified deploy/update scripts using docker compose up -d --pull always
- Updated deployment documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:20:52 +01:00
Matt 98f4a957cc Performance optimization, applicant portal, and missing DB migration
Build and Push Docker Image / build (push) Successful in 14m6s Details
Performance:
- Convert admin dashboard from SSR to client-side tRPC (fixes 503/ChunkLoadError)
- New dashboard.getStats tRPC endpoint batches 16 queries into single response
- Parallelize jury dashboard queries (assignments + gracePeriods via Promise.all)
- Add project.getFullDetail combined endpoint (project + assignments + stats)
- Configure Prisma connection pool (connection_limit=20, pool_timeout=10)
- Add optimizePackageImports for lucide-react tree-shaking
- Increase React Query staleTime from 1min to 5min

Applicant portal:
- Add applicant layout, nav, dashboard, documents, team, and mentor pages
- Add applicant router with document and team management endpoints
- Add chunk error recovery utility
- Update role nav and auth redirect for applicant role

Database:
- Add migration for missing schema elements (SpecialAward job tracking
  columns, WizardTemplate table, missing indexes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 11:04:26 +01:00
Matt 09091d7c08 Jury dashboard compact layout, assignment redesign, auth fixes
Build and Push Docker Image / build (push) Successful in 10m25s Details
- Jury dashboard: collapse zero-assignment state into single welcome card
  with inline quick actions; merge completion bar into stats row; tighten spacing
- Manual assignment: replace tiny Dialog modal with inline collapsible section
  featuring searchable juror combobox and multi-select project list with bulk assign
- Fix applicant invite URL path (/auth/accept-invite -> /accept-invite)
- Add APPLICANT role redirect to /my-submission from root page
- Add Applicant label to accept-invite role display
- Fix a/an grammar in invitation emails and accept-invite page
- Set-password page: use MOPC logo instead of lock icon
- Notification bell: remove filter tabs, always show all notifications

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:26:19 +01:00
Matt 74515768f5 Reports general data, projects import fix, and Docker entrypoint cleanup
Build and Push Docker Image / build (push) Successful in 10m22s Details
- Reports page now shows platform-wide stats even when no rounds exist
- Fix missing getCountryFlag import on projects page
- Clean up Docker entrypoint: remove hardcoded migrate resolve

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:29:21 +01:00
Matt 7e3d600eed Fix project detail 500 error and round deletion data integrity
Build and Push Docker Image / build (push) Has been cancelled Details
- Add missing migration for FileRequirement table and ProjectFile.requirementId
  column (existed in Prisma schema but had no migration, causing all queries
  with `include: { files: true }` to fail with column not found)
- Make projectTags query resilient with try-catch in project.get
- Reset project status to SUBMITTED when round is deleted (prevents orphaned
  ASSIGNED status after ON DELETE SET NULL nullifies roundId)
- Fix round creation/update to allow requiredReviews=0 for filtering rounds
- Parse Zod validation errors in round creation error display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:20:28 +01:00
Matt 0631dbb64f Replace red focus ring with light grey outline on form fields and dropdowns
Build and Push Docker Image / build (push) Successful in 9m59s Details
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:53:21 +01:00
Matt d787a24921 Observer dashboard extraction, PDF reports, jury UX overhaul, and miscellaneous improvements
Build and Push Docker Image / build (push) Successful in 15m32s Details
- Extract observer dashboard to client component, add PDF export button
- Add PDF report generator with jsPDF for analytics reports
- Overhaul jury evaluation page with improved layout and UX
- Add new analytics endpoints for observer/admin reports
- Improve round creation/edit forms with better settings
- Fix filtering rules page, CSV export dialog, notification bell
- Update auth, prisma schema, and various type fixes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:08:00 +01:00
Matt 5c8d22ac11 Inline filtering results, select-all across pages, country flags, settings RBAC, and inline role changes
- Round detail: add skeleton loading for filtering stats, inline results table
  with expandable rows, pagination, override/reinstate, CSV export, and tooltip
  on AI summaries button (removes need for separate results page)
- Projects: add select-all-across-pages with Gmail-style banner, show country
  flags with tooltip instead of country codes (table + card views), add listAllIds
  backend endpoint
- Settings: allow PROGRAM_ADMIN access to settings page, restrict infrastructure
  tabs (AI, Email, Storage, Security, Webhooks) to SUPER_ADMIN only
- Members: add inline role change via dropdown submenu in user actions, enforce
  role hierarchy (only super admins can modify admin/super-admin roles) in both
  backend and UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:07:38 +01:00
Matt 5cae78fe0c Fix first-login error, awards performance, filter animation, cache invalidation, and query fixes
Build and Push Docker Image / build (push) Successful in 11m24s Details
- Guard onboarding tRPC queries with session hydration check (fixes UNAUTHORIZED on first login)
- Defer expensive queries on awards page until UI elements are opened (dialog/tab)
- Fix perPage: 500 exceeding backend Zod max of 100 on awards eligibility query
- Add smooth open/close animation to project filters collapsible bar
- Fix seeded user status from ACTIVE to INVITED in seed-candidatures.ts
- Add router.refresh() cache invalidation across ~22 admin forms
- Fix geographic analytics query to use programId instead of round.programId
- Fix dashboard queries to scope by programId correctly
- Fix project.listPool and round queries for projects outside round context
- Add rounds page useEffect for state sync after mutations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 21:21:54 +01:00
Matt 573785e440 Fix round deletion FK constraint with migration and defensive code
Build and Push Docker Image / build (push) Failing after 7m3s Details
- Add SQL migration to CASCADE Evaluation.formId and SET NULL ProjectFile.roundId
- Explicitly delete evaluations in round delete transaction as defensive measure
- Make sidebar Apply Page link dynamic using current edition context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 20:42:33 +01:00
Matt 5c4200158f Improve projects UX, settings layout, uppercase names, per-page selector, and fix round deletion
Build and Push Docker Image / build (push) Successful in 10m7s Details
- Fix round deletion FK constraint: add onDelete Cascade on Evaluation.form and SetNull on ProjectFile.round
- Add configurable per-page selector (10/20/50/100) to Pagination component, wired in projects page with URL sync
- Add display_project_names_uppercase setting in admin defaults, applied to project titles across desktop/mobile views
- Redesign admin settings page: vertical sidebar nav on desktop with grouped sections, horizontal scrollable tabs on mobile
- Polish projects page: responsive header with total count, search clear button with result count, status stats bar, submission date column, country display, mobile card file count

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 20:13:47 +01:00
Matt 829acf8d4e Add file requirements per round and super admin promotion via UI
Build and Push Docker Image / build (push) Successful in 10m11s Details
Part A: File Requirements per Round
- New FileRequirement model with name, description, accepted MIME types, max size, required flag, sort order
- Added requirementId FK to ProjectFile for linking uploads to requirements
- Backend CRUD (create/update/delete/reorder) in file router with audit logging
- Mime type validation and team member upload authorization in applicant router
- Admin UI: FileRequirementsEditor component in round edit page
- Applicant UI: RequirementUploadSlot/List components in submission detail and team pages
- Viewer UI: RequirementChecklist with fulfillment status in file-viewer

Part B: Super Admin Promotion
- Added SUPER_ADMIN to role enums in user create/update/bulkCreate with guards
- Member detail page: SUPER_ADMIN dropdown option with AlertDialog confirmation
- Invite page: SUPER_ADMIN option visible only to super admins

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 23:01:33 +01:00
Matt e73a676412 Comprehensive platform audit: security, UX, performance, and visual polish
Build and Push Docker Image / build (push) Successful in 10m57s Details
Phase 1: Security - status transition validation, Zod tightening, DB indexes, transactions

Phase 2: Admin UX - search/filter for awards, learning, partners pages

Phase 3: Dashboard - Recent Activity feed, Pending Actions card, quick actions

Phase 4: Jury - assignments progress/urgency, autosave indicator, divergence highlighting

Phase 5: Portals - observer charts, mentor search, login/onboarding polish

Phase 6: Messages preview dialog, CsvExportDialog with column selection

Phase 7: Performance - query optimizations, loading skeletons, useDebounce hook

Phase 8: Visual - AnimatedCard, hover effects, StatusBadge, empty state CTAs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:05:01 +01:00
Matt e0e4cb2a32 Reconcile schema with migrations and fix failed migration
Build and Push Docker Image / build (push) Successful in 17m39s Details
- Align schema.prisma with add_15_features migration (15 discrepancies):
  nullability, column names, PKs, missing/extra columns, onDelete behavior
- Make universal_apply_programid migration idempotent for safe re-execution
- Add reconciliation migration for missing FKs and indexes
- Fix message.ts and mentor.ts to match corrected schema field names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:37:32 +01:00
Matt 04d0deced1 Fix build errors: add missing Prisma models/fields and resolve TypeScript type errors
Build and Push Docker Image / build (push) Successful in 11m24s Details
Schema: Add 11 new models (RoundTemplate, MentorNote, MentorMilestone,
MentorMilestoneCompletion, EvaluationDiscussion, DiscussionComment,
Message, MessageRecipient, MessageTemplate, Webhook, WebhookDelivery,
DigestLog) and missing fields on existing models (Project.isDraft,
ProjectFile.version, LiveVotingSession.allowAudienceVotes, User.digestFrequency,
AuditLog.sessionId, MentorAssignment.completionStatus, etc).
Add AUDIT_CONFIG/LOCALIZATION/DIGEST/ANALYTICS enum values.

Code: Fix implicit any types, route type casts, enum casts, null safety,
composite key handling, and relation field names across 11 source files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:04:02 +01:00
Matt 24fdd2f6be Fix build error: remove non-existent version property from ProjectFile mapping
Build and Push Docker Image / build (push) Failing after 3m17s Details
ProjectFile model does not have a version field; FileViewer accepts it as optional.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:41:53 +01:00
Matt e7c86a7b1b Add dynamic apply wizard customization with admin settings UI
Build and Push Docker Image / build (push) Failing after 3m29s Details
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
  option management, feature toggles, welcome message customization, and
  custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
  mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
  field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
  admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
  MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
  to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
  safe area insets for notched phones, buildStepsArray field visibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:21:26 +01:00
Matt 98fe658c33 UI polish: grouped dropdowns, analytics readability, invite tag picker
Build and Push Docker Image / build (push) Successful in 9m56s Details
- Messages: group users by role in recipient dropdown (SelectGroup)
- Analytics: full country names via Intl.DisplayNames, format SNAKE_CASE
  labels to Title Case, custom tooltips, increased font sizes
- Invite: replace free-text tag input with grouped dropdown from DB tags
  using Command/Popover, showing tags organized by category with colors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 00:06:47 +01:00
Matt 4830c0638c Add database migration for 15 platform features
Build and Push Docker Image / build (push) Successful in 14m6s Details
Creates tables: DigestLog, RoundTemplate, MentorNote, MentorMilestone,
MentorMilestoneCompletion, Message, MessageTemplate, MessageRecipient,
Webhook, WebhookDelivery, EvaluationDiscussion, DiscussionComment,
ReminderLog, ConflictOfInterest, EvaluationSummary, ProjectStatusHistory,
MentorMessage. Adds columns to User, AuditLog, LiveVotingSession, LiveVote,
MentorAssignment, Project, ProjectFile. Adds SettingCategory enum values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:32:25 +01:00
Matt 59436ed67a Implement 15 platform features: digest, availability, templates, comparison, live voting SSE, file versioning, mentorship, messaging, analytics, drafts, webhooks, peer review, audit enhancements, i18n
Build and Push Docker Image / build (push) Has been cancelled Details
Features implemented:
- F1: Email digest notifications with cron endpoint and per-user frequency
- F2: Jury availability windows and workload preferences in smart assignment
- F3: Round templates with save-from-round and CRUD management
- F4: Side-by-side project comparison view for jury members
- F5: Real-time voting dashboard with Server-Sent Events (SSE)
- F6: Live voting UX: QR codes, audience voting, tie-breaking, score animations
- F7: File versioning, inline preview, bulk download with presigned URLs
- F8: Mentor dashboard: milestones, private notes, activity tracking
- F9: Communication hub with broadcasts, templates, and recipient targeting
- F10: Advanced analytics: cross-round comparison, juror consistency, diversity metrics, PDF export
- F11: Applicant draft saving with magic link resume and cron cleanup
- F12: Webhook integration layer with HMAC signing, retry, and delivery logs
- F13: Peer review discussions with anonymized scores and threaded comments
- F14: Audit log enhancements: before/after diffs, session grouping, anomaly detection, retention
- F15: i18n foundation with next-intl (EN/FR), cookie-based locale, language switcher

Schema: 12 new models, field additions to User, Project, ProjectFile, LiveVotingSession, LiveVote, MentorAssignment, AuditLog, Program
New routers: roundTemplate, message, webhook (registered in _app.ts)
New services: email-digest, webhook-dispatcher
New cron endpoints: /api/cron/digest, /api/cron/draft-cleanup, /api/cron/audit-cleanup
New API routes: /api/live-voting/stream (SSE), /api/files/bulk-download

All features are admin-configurable via SystemSettings or per-model settingsJson fields.
Docker build verified successfully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:31:41 +01:00
Matt f038c95777 Fix Docker build failure: lazy-initialize MinIO client
Build and Push Docker Image / build (push) Successful in 13m48s Details
The production env var check in createMinioClient() was throwing during
`next build` page data collection because MINIO_ACCESS_KEY/SECRET_KEY
aren't available at Docker build time. Changed from eager module-level
initialization to a lazy Proxy pattern that defers client creation to
first actual use, while maintaining backward compatibility with all
existing `minio.method()` call sites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 22:16:29 +01:00
Matt 699248e40b Implement 10 platform features: evaluation UX, admin tools, AI summaries, applicant portal
Build and Push Docker Image / build (push) Failing after 5m5s Details
Batch 1 - Quick Wins:
- F1: Evaluation progress indicator with touch tracking in sticky status bar
- F2: Export filtering results as CSV with dynamic AI column flattening
- F3: Observer access to analytics dashboards (8 procedures changed to observerProcedure)

Batch 2 - Jury Experience:
- F4: Countdown timer component with urgency colors + email reminder service with cron endpoint
- F5: Conflict of interest declaration system (dialog, admin management, review workflow)

Batch 3 - Admin & AI Enhancements:
- F6: Bulk status update UI with selection checkboxes, floating toolbar, status history recording
- F7: AI-powered evaluation summary with anonymized data, OpenAI integration, scoring patterns
- F8: Smart assignment improvements (geo diversity penalty, round familiarity bonus, COI blocking)

Batch 4 - Form Flexibility & Applicant Portal:
- F9: Evaluation form flexibility (text, boolean, section_header types, conditional visibility)
- F10: Applicant portal (status timeline, per-round documents, mentor messaging)

Schema: 5 new models (ReminderLog, ConflictOfInterest, EvaluationSummary, ProjectStatusHistory, MentorMessage), ProjectFile extended with roundId + isLate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 21:58:27 +01:00
Matt 002a9dbfc3 Platform review round 2: audit logging migration, nav unification, DB indexes, and UI polish
- Migrate ~41 inline audit log calls to shared logAudit() utility across all routers
- Add transaction-aware prisma parameter to logAudit() for atomic operations
- Unify jury/mentor/observer navigation into shared RoleNav component
- Add composite DB indexes (Evaluation, GracePeriod, AuditLog) for query performance
- Fix profile page: consolidate dual save buttons, proper useEffect initialization
- Enhance auth error page with MOPC branding and navigation
- Improve observer dashboard with prominent read-only badge
- Fix DI-3: fetch projects before bulk status update for accurate notifications
- Remove unused aiBoost field from smart-assignment scoring
- Add shared image-upload utility and structured logger module

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 21:09:06 +01:00
Matt 8d0979e649 Comprehensive platform review: security fixes, query optimization, UI improvements, and code cleanup
Security (Critical/High):
- Fix path traversal bypass in local storage provider (path.resolve + prefix check)
- Fix timing-unsafe HMAC comparison (crypto.timingSafeEqual)
- Add auth + ownership checks to email API routes (verify-credentials, change-password)
- Remove hardcoded secret key fallback in local storage provider
- Add production credential check for MinIO (fail loudly if not set)
- Remove DB error details from health check response
- Add stricter rate limiting on application submissions (5/hour)
- Add rate limiting on email availability check (anti-enumeration)
- Change getAIAssignmentJobStatus to adminProcedure
- Block dangerous file extensions on upload
- Reduce project list max perPage from 5000 to 200

Query Optimization:
- Optimize analytics getProjectRankings with select instead of full includes
- Fix N+1 in mentor.getSuggestions (batch findMany instead of loop)
- Use _count for files instead of fetching full file records in project list
- Switch to bulk notifications in assignment and user bulk operations
- Batch filtering upserts (25 per transaction instead of all at once)

UI/UX:
- Replace Inter font with Montserrat in public layout (brand consistency)
- Use Logo component in public layout instead of placeholder
- Create branded 404 and error pages
- Make admin rounds table responsive with mobile card layout
- Fix notification bell paths to be role-aware
- Replace hardcoded slate colors with semantic tokens in admin sidebar
- Force light mode (dark mode untested)
- Adjust CardTitle default size
- Improve muted-foreground contrast for accessibility (A11Y)
- Move profile form state initialization to useEffect

Code Quality:
- Extract shared toProjectWithRelations to anonymization.ts (removed 3 duplicates)
- Remove dead code: getObjectInfo, isValidImageSize, unused batch tag functions, debug logs
- Remove unused twilio dependency
- Remove redundant email index from schema
- Add actual storage object deletion when file records are deleted
- Wrap evaluation submit + assignment update in
- Add comprehensive platform review document

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 20:31:08 +01:00
Matt a1f32597a0 Fix evaluation submission redirect to assignments page
Build and Push Docker Image / build (push) Successful in 9m25s Details
The previous code incorrectly tried to extract a project ID from the
assignment ID by splitting on '-', which doesn't work with CUIDs.

Now redirects to /jury/assignments with a success toast message
after submitting an evaluation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 17:13:31 +01:00
Matt 049ac9257f Fix voting start time race condition
Build and Push Docker Image / build (push) Has been cancelled Details
Set votingStartAt to 1 minute in the past when opening/reopening rounds
or awards. This ensures voting is immediately available without the
"opens in less than a minute" message appearing due to timing differences
between when the date is set and when the page renders.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 17:08:09 +01:00