Commit Graph

125 Commits

Author SHA1 Message Date
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
Matt d6386be678 Add reopen button for closed rounds
Build and Push Docker Image / build (push) Successful in 9m43s Details
Allows admins to reopen a closed round. When reopened, the voting start
date will automatically update to now (if it was in the future).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:51:02 +01:00
Matt 13de30775e Add special awards management features and fix voting/assignment issues
Build and Push Docker Image / build (push) Successful in 10m4s Details
Special Awards:
- Add delete button with confirmation dialog to award detail page
- Add voting window dates (start/end) to award edit page
- Add manual project eligibility management (add/remove projects)
- Show eligibility method (Auto/Manual) in eligibility table
- Auto-set votingStartAt when opening voting if date is in future

Assignment Suggestions:
- Replace toggle with proper tabs UI (Algorithm vs AI Powered)
- Persist AI suggestions when navigating away (stored in database)
- Show suggestion counts on tab badges
- Independent refresh/start buttons per tab

Round Voting:
- Auto-update votingStartAt to now when activating round if date is in future
- Fixes issue where round was opened but voting dates were in future

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:29:36 +01:00
Matt e01d741f01 Fix GPT-5 nano empty response issue with token limits
Build and Push Docker Image / build (push) Successful in 9m36s Details
GPT-5 nano (and other GPT-5 models) use reasoning that consumes
the output token budget. When max_tokens is too low, all tokens
get used by internal reasoning, leaving nothing for the response.

- Add needsHigherTokenLimit() to detect models needing more tokens
- Add getMinTokenLimit() to ensure minimum 16k tokens for GPT-5
- Update buildCompletionParams to apply minimum token limits
- This fixes the No response from AI error with gpt-5-nano

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 15:02:22 +01:00
Matt bf187e4b9a Improve AI assignment error messages for invalid models
Build and Push Docker Image / build (push) Has been cancelled Details
- Add try-catch around OpenAI API call to catch model errors
- Provide clearer error messages when model name is invalid
- Handle empty response cases with helpful feedback
- Suggest checking AI Configuration settings when model fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:56:21 +01:00
Matt c82406abcf Hide All projects covered message while AI job is running
Build and Push Docker Image / build (push) Has been cancelled Details
The empty state message was incorrectly showing during AI processing.
Now it only shows when job is complete and there are no suggestions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:53:45 +01:00
Matt 3abfccb22a Fix AI suggestions not displaying after job completion
Build and Push Docker Image / build (push) Successful in 9m26s Details
BREAKING CHANGE: AI assignment job now stores suggestions in database

- Add suggestionsJson column to AssignmentJob table
- Store enriched suggestions when job completes
- Update getAISuggestions to retrieve stored suggestions instead of regenerating
- Filter out already-assigned pairs from stored suggestions

Previously, the background job generated suggestions but discarded them,
and getAISuggestions tried to regenerate from scratch (causing infinite loading).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:38:43 +01:00
Matt e3e3fa9da4 Fix AI assignment errors and tag matching
Build and Push Docker Image / build (push) Successful in 9m7s Details
- Add missing updatedAt column to AssignmentJob table
- Fix algorithmic assignment to use AI-assigned projectTags instead of raw CSV tags
- Add case-insensitive tag matching for better expertise matching
- Scores should now properly reflect tag matches between judges and projects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:14:19 +01:00
Matt d7f0118940 Add user tag editing and improve member error display
Build and Push Docker Image / build (push) Successful in 9m4s Details
- Display actual error message in member detail page instead of generic Member not found
- Add debug logging to user.get query to help diagnose issues
- Add expertise tags editing for users in profile settings page
- Update user.updateProfile mutation to accept expertiseTags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 13:45:34 +01:00
Matt f59cfd393b Display AI-assigned expertise tags on project detail page
Build and Push Docker Image / build (push) Successful in 8m56s Details
- Add projectTags relation to project.get query
- Show expertise tags with confidence percentages
- Tags displayed with their assigned colors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 13:18:45 +01:00
Matt 4d8823e8e9 Show all errors in scrollable list instead of just first one
Build and Push Docker Image / build (push) Has been cancelled Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 13:13:25 +01:00
Matt 1b2311b4a3 Convert AI tagging to background job with progress tracking
Build and Push Docker Image / build (push) Successful in 9m40s Details
- Add TaggingJob model for tracking tagging progress
- Convert batch tagging to background job processing (prevents timeouts)
- Add real-time progress polling in UI with percentage/count display
- Add admin notifications when tagging job completes or fails
- Export getTaggingSettings and getAvailableTags functions

After deployment, run: npx prisma migrate deploy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 11:48:57 +01:00
Matt 0b86dc6477 Add detailed logging for AI tagging progress
Build and Push Docker Image / build (push) Successful in 9m41s Details
- Log each project being processed with timing
- Log progress every 10 projects with time estimates
- Log final completion stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 11:34:32 +01:00
Matt 05862f1e55 Redesign AI Tagging dialog and add edition-wide tagging
Build and Push Docker Image / build (push) Successful in 9m22s Details
- Redesign AI Tagging dialog with scope selection (Round vs Edition)
- Add visual progress indicator during AI processing
- Display result stats (tagged/skipped/failed) after completion
- Add batchTagProgramProjects endpoint for edition-wide tagging
- Fix getFilterOptions to include program.id for filtering
- Improve error handling with toast notifications

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:27:52 +01:00
Matt 7f95f681d6 Fix AI tagging issues and improve error messages
Build and Push Docker Image / build (push) Successful in 9m33s Details
- Fall back to ai_enabled setting if ai_tagging_enabled not set
- Check both tags array and projectTags relationship for untagged projects
- Add detailed logging for debugging
- Show errors in toast instead of just counts
- Handle "no projects to tag" case with appropriate message
- Add early checks for OpenAI config and available tags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 09:24:44 +01:00
Matt 6f6d5ef501 Add visual progress indicator for AI assignment batches
Build and Push Docker Image / build (push) Successful in 9m13s Details
- Add AssignmentJob model to track AI assignment progress
- Create startAIAssignmentJob mutation for background processing
- Add getAIAssignmentJobStatus query for polling progress
- Update AI assignment service with progress callback support
- Add progress bar UI showing batch/project processing status
- Add toast notifications for job completion/failure
- Add AI_SUGGESTIONS_READY notification type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:40:26 +01:00
Matt 148925cb95 Fix AI suggestions query running twice
Build and Push Docker Image / build (push) Successful in 9m8s Details
Disable automatic refetching for expensive AI assignment query:
- Set staleTime to Infinity (never auto-refetch)
- Disable refetchOnWindowFocus, refetchOnReconnect, refetchOnMount
- Only manual refresh via button will trigger new request

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:19:20 +01:00
Matt c45a428d8b Add AI Assignment toggle and Tags tab to settings
Build and Push Docker Image / build (push) Successful in 9m25s Details
- Add "Use AI" button to assignments page to switch between algorithmic and GPT-powered suggestions
- Normalize AI suggestions format to match algorithmic format for consistent UI
- Add Tags tab to Settings page with link to expertise tags management
- AI assignment mode shows GPT-analyzed suggestions with confidence scores

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:56:07 +01:00
Matt c0f318a867 Add country mapping support for imports and geographic map
Build and Push Docker Image / build (push) Successful in 9m7s Details
- Add normalizeCountryToCode utility to convert country names to ISO-2 codes
- Support English, French and common alternate spellings
- Update Typeform import to support country field mapping
- Update Notion import to support country field mapping
- Allow project.update to set/update country with automatic normalization
- Fix geographic distribution map showing empty when country data exists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:13:40 +01:00
Matt 6d2537ec04 Add per-round assignment constraints (min/max per judge)
Build and Push Docker Image / build (push) Successful in 9m41s Details
- Add minAssignmentsPerJuror and maxAssignmentsPerJuror fields to Round model
- Update assignment router:
  - Calculate effective max from user override or round default
  - Add forceOverride parameter for manual assignment beyond limits
  - Update getSuggestions to use round constraints with min target bonus
  - Update getAISuggestions to pass constraints to AI service
- Update AI assignment service:
  - Add minAssignmentsPerJuror to constraints interface
  - Update fallback algorithm with under-min bonus scoring
  - New score weights: 50% expertise, 30% load, 20% under-min bonus
- Update round router:
  - Add new constraint fields to create/update schemas
  - Add validation for min <= max constraint
- Update admin UI:
  - Add min/max constraint fields to round edit page
  - Remove hardcoded maxPerJuror from assignments page
- Add migration files for production deployment:
  - User.bio field for judge/mentor profiles
  - Round assignment constraint fields

Constraint hierarchy:
1. User.maxAssignments (if set) overrides round default
2. Round.maxAssignmentsPerJuror is the default cap
3. Admin can force-override any limit with confirmation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:01:18 +01:00
Matt ff26769ce1 Add bio field and enhance smart assignment with bio matching
Build and Push Docker Image / build (push) Successful in 9m13s Details
- Add bio field to User model for judge/mentor profile descriptions
- Add bio step to onboarding wizard (optional step with 500 char limit)
- Enhance smart assignment to match judge bio against project description
  - Uses keyword extraction and Jaccard-like similarity scoring
  - Only applies if judge has a bio (no penalty for empty bio)
  - Max 15 points for bio match on top of existing scoring
- Fix geographic distribution query to use round relation for programId
- Update score breakdown: tags (40), bio (15), workload (25), country (15)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:27:28 +01:00
Matt 3a7177c652 Rename Assignments to Judge Assignments for clarity
Build and Push Docker Image / build (push) Successful in 9m21s Details
Updates labels in admin round pages:
- "Assignments" → "Judge Assignments"
- "Manage Assignments" → "Manage Judge Assignments"
- "Current Assignments" → "Current Judge Assignments"
- Updated descriptions to reference judges instead of jury members

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:15:10 +01:00
Matt 5cbcad28ad Add AI Tags button to admin projects page
Build and Push Docker Image / build (push) Has been cancelled Details
Adds a new "AI Tags" button that opens a dialog to batch-generate
expertise tags using AI for all untagged projects in a selected round.

The feature uses the existing tag.batchTagProjects endpoint which:
- Only processes projects without existing tags
- Preserves any manually added tags
- Logs AI usage for cost tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:08:46 +01:00
Matt 29827268b2 Remove dynamic form builder and complete RoundProject→roundId migration
Build and Push Docker Image / build (push) Successful in 14m3s Details
Major cleanup and schema migration:
- Remove unused dynamic form builder system (ApplicationForm, ApplicationFormField, etc.)
- Complete migration from RoundProject junction table to direct Project.roundId
- Add sortOrder and entryNotificationType fields to Round model
- Add country field to User model for mentor matching
- Enhance onboarding with profile photo and country selection steps
- Fix all TypeScript errors related to roundProjects references
- Remove unused libraries (@radix-ui/react-toast, embla-carousel-react, vaul)

Files removed:
- admin/forms/* pages and related components
- admin/onboarding/* pages
- applicationForm.ts and onboarding.ts routers
- Dynamic form builder Prisma models and enums

Schema changes:
- Removed ApplicationForm, ApplicationFormField, OnboardingStep, ApplicationFormSubmission, SubmissionFile models
- Removed FormFieldType and SpecialFieldType enums
- Added Round.sortOrder, Round.entryNotificationType
- Added User.country

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 14:15:06 +01:00
Matt 7bcd2ce6ca Remove red focus ring from command input
Build and Push Docker Image / build (push) Successful in 8m55s Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:54:37 +01:00
Matt 20db3e1e3a Add visual indicator for eliminated projects
Build and Push Docker Image / build (push) Has been cancelled Details
- Shows "Eliminated" badge next to round name for REJECTED projects
- Rows for eliminated projects have reduced opacity and red tint
- Works in both table and mobile card views

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:49:31 +01:00
Matt 68c0ed00e4 Add manual assignment feature to assignments page
- Added "Manual Assignment" button with dialog
- Select jury member and project from dropdowns
- Shows current assignment counts and prevents duplicates
- Disables full-capacity jurors and already-assigned combinations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:45:32 +01:00
Matt 1b12aa8ccd Fix smart assignment suggestions to display juror/project names
Build and Push Docker Image / build (push) Successful in 8m57s Details
The suggestions table was showing truncated IDs instead of actual names.
Updated getSuggestions to include jurorName and projectTitle in response.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:36:33 +01:00
Matt 8cdf6c9e5e Add unified expertise tag system and round entry notifications
Build and Push Docker Image / build (push) Successful in 9m14s Details
- ExpertiseSelect now fetches tags from database with category grouping
- Tags set by admin during invitation are locked and cannot be removed
- Onboarding merges user-selected tags with admin-preset tags
- MENTOR role now goes through onboarding flow
- Added migration for Round.entryNotificationType column
- Added seed script with ~90 comprehensive expertise tags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:15:21 +01:00
Matt 41a36f72b3 Add WhatsApp feature flag and improve onboarding
Build and Push Docker Image / build (push) Failing after 2m59s Details
- Add getFeatureFlags endpoint to check if WhatsApp is enabled
- Skip phone step in onboarding when WhatsApp is disabled
- Hide WhatsApp notification options when disabled
- Add ExpertiseSelect component with predefined ocean conservation tags
- Fix onboarding layout to fill viewport on desktop

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:58:22 +01:00
Matt 4f0531d2ee Add ExpertiseSelect component for onboarding
Replace database-backed TagInput with a cleaner ExpertiseSelect
component that has predefined ocean conservation expertise areas.
Features a checkbox grid UI that's more user-friendly for onboarding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:56:03 +01:00
Matt 39f7bc207b Use PhoneInput component with country dropdown in onboarding
Replace plain text input with the existing PhoneInput component that
includes country code dropdown with flags and auto-formatting.
Default country is set to Monaco (MC).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:54:57 +01:00
Matt a3cc73e49d Fix redirect loop for users who need to set password
Build and Push Docker Image / build (push) Successful in 8m19s Details
The auth layout was redirecting logged-in users to their dashboard even
when they still needed to set their password. This caused a redirect
loop: auth layout redirects to /jury, middleware redirects back to
/set-password, repeat until crash.

Now the auth layout checks mustSetPassword before redirecting, allowing
users to complete the password setup flow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:41:32 +01:00
Matt 0f956cf23f Fix invitation flow by allowing unauthenticated tRPC requests
Build and Push Docker Image / build (push) Successful in 8m28s Details
The middleware was blocking /api/trpc requests for unauthenticated users,
which prevented the accept-invite page from calling the public
validateInviteToken procedure. tRPC handles its own authentication
via procedure middleware, so the NextAuth middleware should allow
all tRPC requests through.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:26:05 +01:00
Matt b0189cad92 Add styled notification emails and round-attached notifications
Build and Push Docker Image / build (push) Successful in 8m18s Details
- Add 15+ styled email templates matching existing invite email design
- Wire up notification triggers in all routers (assignment, round, project, mentor, application, onboarding)
- Add test email button for each notification type in admin settings
- Add round-attached notifications: admins can configure which notification to send when projects enter a round
- Fall back to status-based notifications when round has no configured notification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:10:51 +01:00
Matt 3be6a743ed Add multiple admin improvements and bug fixes
Build and Push Docker Image / build (push) Successful in 8m58s Details
- Email settings: Add separate sender display name field
- Rounds page: Drag-and-drop reordering with visible order numbers
- Round creation: Auto-assign projects to filtering rounds, auto-activate if voting started
- Round detail: Fix incorrect "voting period ended" message for draft rounds
- Projects page: Add delete option with confirmation dialog
- AI filtering: Add configurable batch size and parallel request settings
- Filtering results: Fix duplicate criteria display
- Add seed scripts for notification settings and MOPC onboarding form

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:19:45 +01:00
Matt 1d137ce93e Improve notification bell placement and change sender to MOPC Portal
Build and Push Docker Image / build (push) Successful in 8m14s Details
- Move notification bell to sidebar header next to logo (desktop)
- Keep bell in mobile header bar (already well-placed)
- Change email sender name from 'MOPC Platform' to 'MOPC Portal'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 22:47:24 +01:00
Matt b663aae846 Fix invitation flow error by adding SessionProvider
Build and Push Docker Image / build (push) Has been cancelled Details
- Add SessionProvider to root Providers for NextAuth React hooks
- Add error handling to auth layout to prevent crashes on auth check failure
- Add MENTOR role redirect in auth layout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 22:44:09 +01:00
Matt 03c031a8b6 Fix rounds management bugs and invitation flow
Build and Push Docker Image / build (push) Successful in 8m45s Details
- Fix rounds list showing 0 projects by adding _count to program.list query
- Fix round reordering by using correct cache invalidation params
- Fix finalizeResults to auto-advance passed projects to next round
- Fix member list not updating after add/remove by invalidating user.list
- Fix invitation link error page by correcting path from /auth-error to /error
- Add /apply, /verify, /error to public paths in auth config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 22:15:22 +01:00
Matt 0277768ed7 Add notification bell system and MOPC onboarding form
Build and Push Docker Image / build (push) Successful in 8m59s Details
Notification System:
- Add InAppNotification and NotificationEmailSetting database models
- Create notification service with 60+ notification types for all user roles
- Add notification router with CRUD endpoints
- Build NotificationBell UI component with dropdown and unread count
- Integrate bell into admin, jury, mentor, and observer navs
- Add notification email settings admin UI in Settings > Notifications
- Add notification triggers to filtering router (complete/failed)
- Add sendNotificationEmail function to email library
- Add formatRelativeTime utility function

MOPC Onboarding Form:
- Create /apply landing page with auto-redirect for single form
- Create seed script for MOPC 2026 application form (6 steps)
- Create seed script for default notification email settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 21:30:25 +01:00
Matt e1968d45df Filter award juror selection to show only JURY_MEMBER role
Build and Push Docker Image / build (push) Successful in 8m57s Details
The dropdown was showing all users instead of only jury members.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:09:32 +01:00
Matt e2782b2b19 Add background filtering jobs, improved date picker, AI reasoning display
Build and Push Docker Image / build (push) Successful in 14m19s Details
- Implement background job system for AI filtering to avoid HTTP timeouts
- Add FilteringJob model to track progress of long-running filtering operations
- Add real-time progress polling for filtering operations on round details page
- Create custom DateTimePicker component with calendar popup (no year picker hassle)
- Fix round date persistence bug (refetchOnWindowFocus was resetting form state)
- Integrate filtering controls into round details page for filtering rounds
- Display AI reasoning for flagged/filtered projects in results table
- Add onboarding system scaffolding (schema, routes, basic UI)
- Allow setting round dates in the past for manual overrides

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 19:48:41 +01:00
Matt 8be740a4fb Fix multiple UI/UX issues and invite token migration
Build and Push Docker Image / build (push) Successful in 8m39s Details
Fixes:
- Round edit: Add cache invalidation for voting dates
- Criteria weights: Replace number input with visual slider
- Member invite: Per-member expertise tags with suggestions
  - Tags now added per member, not globally
  - Comma key support for quick tag entry
  - Suggested tags based on ocean/business expertise
- Accept-invite: Add Suspense boundary for useSearchParams
- Add missing inviteToken columns migration

The invite token columns were accidentally skipped in prototype1
migration. This adds them with IF NOT EXISTS checks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:25:28 +01:00
Matt 3986da172f Fix GPT-5 API compatibility and add AIUsageLog migration
Build and Push Docker Image / build (push) Successful in 8m50s Details
- Add AIUsageLog table migration for token tracking
- Fix GPT-5 temperature parameter (not supported, like o-series)
- Add usesNewTokenParam() and supportsTemperature() functions
- Add GPT-5+ category to model selection UI
- Update model sorting to show GPT-5+ first

GPT-5 and newer models use max_completion_tokens and don't support
custom temperature values, similar to reasoning models.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:04:16 +01:00
Matt c0ce6f9f1f Fix GPT-5 max_completion_tokens parameter detection
Build and Push Docker Image / build (push) Successful in 8m35s Details
GPT-5 and newer models require max_completion_tokens instead of max_tokens.
Added usesNewTokenParam() to detect GPT-5+ models separately from reasoning
model restrictions (temperature, json_object, system messages).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 13:08:01 +01:00
Matt 928b1c65dc Optimize AI system with batching, token tracking, and GDPR compliance
Build and Push Docker Image / build (push) Successful in 9m11s Details
- Add AIUsageLog model for persistent token/cost tracking
- Implement batched processing for all AI services:
  - Assignment: 15 projects/batch
  - Filtering: 20 projects/batch
  - Award eligibility: 20 projects/batch
  - Mentor matching: 15 projects/batch
- Create unified error classification (ai-errors.ts)
- Enhance anonymization with comprehensive project data
- Add AI usage dashboard to Settings page
- Add usage stats endpoints to settings router
- Create AI system documentation (5 files)
- Create GDPR compliance documentation (2 files)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:58:12 +01:00
Matt a72e815d3a Remove remaining Settings and Assignments links
Build and Push Docker Image / build (push) Successful in 8m43s Details
Fix stale links to deleted pages:
- Remove Settings link from programs list dropdown
- Remove Manage Assignments link from projects list dropdown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:56:14 +01:00
Matt 406ec46c81 UI simplification: remove redundant pages, reorganize Quick Actions
Phase 2 UI Cleanup:
- Delete empty programs/[id]/settings page
- Delete redundant projects/[id]/assignments page (use round-level management)
- Delete unused /users redirect directory
- Remove Settings button from program detail page
- Reorganize Round Quick Actions into visual groups (Project Management, Round Management)

Note: Mentor inline assignment deferred - the existing mentor page has
complex AI suggestion functionality that would need careful refactoring.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:50:47 +01:00
Matt d068d9b6f6 Improve AI filtering error handling and visibility
- Add listAvailableModels() and validateModel() to openai.ts
- Improve testOpenAIConnection() to test configured model
- Add checkAIStatus endpoint to filtering router
- Add pre-execution AI config check in executeRules
- Improve error messages in AI filtering service (rate limit, quota, etc.)
- Add AI status warning banner on round detail page for filtering rounds

Now admins get clear errors when AI is misconfigured instead of silent flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:46:38 +01:00
Matt d45eccea47 Add detailed logging to AI filtering for debugging
Added console logging throughout the AI screening process to help
diagnose issues when all projects get flagged. Logs model being used,
batch processing, token usage, and actual error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:36:51 +01:00
Matt c063f5bba3 Display filtering controls inline for FILTERING round type
For rounds with roundType=FILTERING, the filtering controls (run button,
stats, finalize) are now shown directly on the round detail page instead
of requiring navigation to a separate /filtering page. Rules configuration
and results review still link to their dedicated pages for detailed work.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:33:34 +01:00
Matt db728830d4 Add cache invalidation to all project/round mutations platform-wide
Build and Push Docker Image / build (push) Successful in 8m21s Details
Mutations for create, update, delete, import, filtering finalize,
override, and reinstate now properly invalidate related queries so
the UI updates without requiring a page refresh.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 23:36:46 +01:00
Matt 56a44049d3 Show full country name instead of code in assign dialog
Build and Push Docker Image / build (push) Successful in 8m11s Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 23:15:51 +01:00
Matt a3f12ed5de Raise project list limit to 5000 for admin dialogs
Build and Push Docker Image / build (push) Has been cancelled Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 23:11:43 +01:00
Matt fd5e5222da Decouple projects from rounds with RoundProject join table
Build and Push Docker Image / build (push) Successful in 8m16s Details
Projects now exist at the program level instead of being locked to a
single round. A new RoundProject join table enables many-to-many
relationships with per-round status tracking. Rounds have sortOrder
for configurable progression paths.

- Add RoundProject model, programId on Project, sortOrder on Round
- Migration preserves existing data (roundId -> RoundProject entries)
- Update all routers to query through RoundProject join
- Add assign/remove/advance/reorder round endpoints
- Add Assign, Advance, Remove Projects dialogs on round detail page
- Add round reorder controls (up/down arrows) on rounds list
- Show all rounds on project detail page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:33:55 +01:00
Matt 0d2bc4db7e Fix modal animation to scale from center instead of sliding from top-left
Build and Push Docker Image / build (push) Successful in 8m32s Details
Remove slide-in-from-left/top animations from Dialog and AlertDialog
components, keeping only fade + zoom for a clean center-grow effect.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:09:06 +01:00
Matt 0b3c2b6804 Redesign member invite page with per-member form rows
Build and Push Docker Image / build (push) Waiting to run Details
Replace bulk email textarea with individual name/email/role rows.
Each member gets their own entry with full name, email, and role
selector. New rows inherit the role from the previous row. CSV
import kept as an alternative tab. Invites sent automatically on
creation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:07:03 +01:00
Matt 8931da98ba Add AI eligibility toggle and include-submitted filter for awards
Build and Push Docker Image / build (push) Has been cancelled Details
- Add useAiEligibility boolean to SpecialAward schema (default true)
- Toggle on creation form lets admins disable AI for feeling-based awards
- Detail page shows "Load All Projects" when AI is off vs "Run AI Eligibility"
- Include Submitted toggle lets admins include SUBMITTED-status projects
- Fix perPage: 200 → 100 to match user.list validation max
- Fix edition display on award detail page
- Add migration for new column

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:02:58 +01:00
Matt e34cafebbf Show edition year instead of program name platform-wide
Build and Push Docker Image / build (push) Successful in 8m33s Details
Change program selectors and display labels from full program name
to "2026 Edition" format across admin, jury, mentor, observer, and
public pages. Selector labels changed from "Program" to "Edition".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:52:52 +01:00
Matt 86d38ba743 Add delete button for draft rounds with confirmation dialog
Build and Push Docker Image / build (push) Successful in 8m26s Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:37:54 +01:00
Matt 46694154dc Fix favicon: point to existing MOPC logo PNG instead of missing favicon.ico
Build and Push Docker Image / build (push) Has been cancelled Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:32:55 +01:00
Matt 90e3adfab2 Implement Prototype 1 improvements: unified members, project filters, audit expansion, filtering rounds, special awards
Build and Push Docker Image / build (push) Successful in 9m9s Details
- Unified Member Management: merge /admin/users and /admin/mentors into /admin/members with role tabs, search, pagination
- Project List Filters: add search, multi-status filter, round/category/country selects, boolean toggles, URL persistence
- Audit Log Expansion: track logins, round state changes, evaluation submissions, file access, role changes via shared logAudit utility
- Founding Date Field: add foundedAt to Project model with CSV import support
- Filtering Round System: configurable rules (field-based, document check, AI screening), execution engine, results review with override/reinstate
- Special Awards System: named awards with eligibility criteria, dedicated jury, PICK_WINNER/RANKED/SCORED voting modes, AI eligibility
- Dashboard resilience: wrap heavy queries in try-catch to prevent error boundary on transient DB failures
- Reusable pagination component extracted to src/components/shared/pagination.tsx
- Old /admin/users and /admin/mentors routes redirect to /admin/members
- Prisma migration for all schema additions (additive, no data loss)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:58:29 +01:00
Matt 8fda8deded Add image cropping to avatar upload and show avatars platform-wide
Build and Push Docker Image / build (push) Successful in 12m20s Details
- Add react-easy-crop for circular crop + zoom UI on avatar upload
- Create server-side getUserAvatarUrl utility for generating pre-signed URLs
- Update all nav components (admin, jury, mentor, observer) to show user avatars
- Add avatar URLs to user list, mentor list, and project detail API responses
- Replace initials-only avatars with UserAvatar component across admin pages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:19:28 +01:00
Matt f9f88d68ab Restore EmailProvider server config required by NextAuth validation
Build and Push Docker Image / build (push) Successful in 8m6s Details
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 14:16:31 +01:00
Matt 81db15333f Fix S3/SMTP connectivity and add one-click invite flow
Build and Push Docker Image / build (push) Failing after 2m29s Details
- Fix MinIO port parsing bug: use protocol-appropriate defaults (443/80)
  instead of hardcoded 9000 fallback, enabling public URL endpoint
- Remove unused SMTP server config from NextAuth EmailProvider to prevent
  connection errors (sendVerificationRequest is fully overridden)
- Replace extra_hosts with DNS config (8.8.8.8) so container resolves
  mail.monaco-opc.com to public IP instead of host loopback
- Add invite token auth: single-click accept-invite flow replacing broken
  two-email invitation process
- Auto-send invitation emails on bulk user creation
- Update email template expiry text from 24 hours to 7 days

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 14:13:16 +01:00
Matt 5aedade41d Use DB settings for SMTP and unify email design to all-white
Build and Push Docker Image / build (push) Successful in 7m43s Details
- Read SMTP settings from database (admin panel) with env var fallback
- Cache transporter and rebuild when settings change
- Remove dark blue footer from emails; use single white content box
  with logo and tagline at the bottom separated by a subtle border

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 11:49:35 +01:00
Matt 43680d4173 Log tRPC errors in all environments
Build and Push Docker Image / build (push) Has been cancelled Details
Previously only logged in development mode, making production
debugging impossible.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 11:44:34 +01:00
Matt 7ff961f0c2 Fix profile photo section: replace hover overlay with button
Build and Push Docker Image / build (push) Has been cancelled Details
Remove showEditOverlay that stretched across the full width.
Show avatar and a "Change Photo" button side by side instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:08:59 +01:00
Matt 402bdfd8c5 Add profile settings page, mentor management, and S3 email logos
Build and Push Docker Image / build (push) Successful in 8m10s Details
- Add universal /settings/profile page accessible to all roles with
  avatar upload, bio, phone, password change, and account deletion
- Expand updateProfile endpoint to accept bio (metadataJson), phone,
  and notification preference
- Add deleteAccount endpoint with password confirmation
- Add Profile Settings link to all nav components (admin, jury, mentor,
  observer)
- Add /admin/mentors list page and /admin/mentors/[id] detail page for
  mentor management
- Add Mentors nav item to admin sidebar
- Update email logo URLs to S3 (s3.monaco-opc.com/public/)
- Add ocean.png background image to email wrapper

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:57:12 +01:00
Matt 0c0a9b7eb5 Add round delete with confirmation dialog
Build and Push Docker Image / build (push) Successful in 7m57s Details
- Add delete procedure to round tRPC router with cascade and audit log
- Add delete option to rounds list dropdown menu
- Show confirmation dialog with project/assignment counts before deletion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:28:57 +01:00
Matt bfcfd84008 Use admin-configured AI model and add GPT-5/o-series options
Build and Push Docker Image / build (push) Successful in 4m6s Details
- Add getConfiguredModel() that reads ai_model from SystemSettings
- AI assignment and mentor matching now use the admin-selected model
- Remove duplicate OpenAI client in mentor-matching (use shared singleton)
- Add GPT-5, GPT-5 Mini, o3, o3 Mini, o4 Mini to model dropdown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:24:46 +01:00
Matt 8c598ba3ee Add email password change feature and fix nginx config
Build and Push Docker Image / build (push) Successful in 4m22s Details
- Add public page at /email/change-password for Poste.io mailbox password management
- Add API routes for SMTP credential verification and Poste.io password change
- Rewrite nginx config as HTTP-only (certbot --nginx will add SSL)
- Add Poste.io admin API env vars to docker-compose and env templates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:15:08 +01:00
Matt a606292aaa Initial commit: MOPC platform with Docker deployment setup
Build and Push Docker Image / build (push) Failing after 10s Details
Full Next.js 15 platform with tRPC, Prisma, PostgreSQL, NextAuth.
Includes production Dockerfile (multi-stage, port 7600), docker-compose
with registry-based image pull, Gitea Actions CI workflow, nginx config
for portal.monaco-opc.com, deployment scripts, and DEPLOYMENT.md guide.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 13:41:32 +01:00