Skip to content

refactor(routing): modular route architecture with access control groups - #190

Merged
thinkclay merged 15 commits into
mainfrom
claude/funny-swanson
Mar 22, 2026
Merged

thinkclay merged 15 commits into
mainfrom
claude/funny-swanson

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Summary

  • Introduce 4 access-control route groups: (auth), (public), (protected), (admin) — each with its own layout handling auth/session/prerequisites at the group level
  • Extract 7 sections from monolithic /dashboard (50+ Drawer.Screen entries) into top-level routes with individual DrawerLayouts: /workers, /employers, /jobs, /assessments, /profile, /communities, /dashboard (slimmed to home, news, settings, analytics)
  • Centralize auth/session/prerequisites logic in (protected)/_layout.tsx and (admin)/_layout.tsx instead of duplicating across every section layout
  • Move teams and work-logs under /employers (renamed work-logs → logs), career-explorer under /assessments, map under /workers
  • Rename /u/:slug → /users/:slug for public profiles
  • Update 65+ files of hardcoded path references across tests, feature components, and backend notifications
  • Includes merged analytics dashboard from claude/crazy-curie branch

Test plan

  • Typecheck passes (only pre-existing analytics/EEO errors)
  • Metro bundler builds successfully (7172 modules)
  • All routes verified in dev server: /dashboard, /workers, /employers, /jobs, /assessments, /profile, /communities
  • Desktop sidebar navigation works across all sections
  • Each section shows correct expanded sub-items in drawer
  • Auth redirect flow intact (protected routes gate unauthenticated users)
  • E2E test suite (paths updated, needs CI run)
  • Mobile bottom nav section switching

🤖 Generated with Claude Code

thinkclay and others added 15 commits March 22, 2026 04:43
- MobileBottomNav: replace custom getGlassStyle helper with GlassSurface
  components for back button, center pill, search bar, and search results.
  Use glassVibrantColors for icon colors.
- Spinner: add variant="ios" (8-spoke activity indicator) across all
  feature screens (~180 instances)
- Discover cards: EmployerCard and InternalJobCard use variant="glass"
  with glassMaterial="thin" for frosted list items

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…branches

- Update CI workflow to route Supabase URLs per environment:
  prod → main project, preview → preview branch (uhjkipdwayqfihkanabk),
  dev/main → dev branch (pmtdqrfpumqwkdhpgwcz)
- Simplify Google OAuth to single shared secret set (same GCP project)
- Deploy edge functions to branch refs on dev/preview, not separate projects
- Add all scaffald domains to Supabase auth redirect allowlist in config.toml

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Convert all Card and DashboardWidget instances to use the Liquid Glass
aesthetic for a unified frosted surface look throughout the app.

- Remove `elevated` prop from 9 DashboardWidget instances (communities,
  assessments, office, profile identity) so they use default glass
- Convert Card variant="elevated" and variant="surface" to variant="glass"
  across profile, communities, office, discover, oauth, and privacy screens
- Convert Cards with inline backgroundColor to variant="glass"
- Convert Cards with inline borderWidth to variant="outlined"
- Update discover cards (JobCard, ExternalJobCard, OrganizationCard)
  non-selected state from "surface" to "glass"

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add RefreshCw button to reload news feed on demand
- Replace hard-coded "CONSTRUCTION" chip with a Popover industry selector
  that lists all available industries from useIndustries hook
- Selected industry drives useNewsIndustryResolution for filtered feed
- Disable refresh button while fetching to prevent double-requests

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move "Get Verified" and "Background Check" buttons from the identity
section into the Profile Strength completion row. All action buttons
now share the same outline/gray style and sit in a horizontal ScrollView
for overflow on narrow screens.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Duplicate `env:` keys in a YAML step are invalid — GitHub was rejecting
the workflow entirely. Merged the two env blocks into one.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…up backend

Add a full analytics section to the dashboard with Overview, Engagement,
Visibility, and Search tabs. Backend includes rollup tables with pg_cron
aggregation, real-time Supabase subscriptions, and REST API endpoints.
Frontend features KPI cards, date range selectors, live indicators, and
SDK integration with React Query hooks.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move all routes into 4 access-control groups:
- (auth): guest-only routes (login, verify, terms)
- (public): no auth required (public profiles, public jobs, invitations)
- (protected): authenticated + prerequisites (dashboard, communities, onboarding)
- (admin): authenticated + role-based (office, developers, oauth)

Centralize auth/session/prerequisites logic in (protected)/_layout.tsx
and (admin)/_layout.tsx instead of duplicating across every section layout.
Strip auth logic from dashboard and communities layouts (now Drawer-only).

Also comments out missing CryptoWallet component exports in @scaffald/ui
to fix pre-existing Metro bundling failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Resolve merge conflict in scaffald-ui (both sides commented out crypto
components). Move new analytics route files into (protected)/dashboard/
to match the route group structure from Phase 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move workers and map from (protected)/dashboard/ to (protected)/workers/
with its own DrawerLayout. Add ROUTES.WORKERS top-level constant,
deprecate ROUTES.DASHBOARD.DISCOVER.WORKERS alias. Update drawer config,
utils, and all feature file references.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move employers, teams, work-logs (renamed to logs), and organizations
from (protected)/dashboard/ to (protected)/employers/ with its own
DrawerLayout. Add ROUTES.EMPLOYERS top-level constant with nested
TEAMS, LOGS, ORG, and ORGANIZATIONS sub-routes. Update all drawer
config, utils, and feature file references.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…vel routes

- /jobs: search, detail, applications, my-listings
- /assessments: all assessments + career-explorer (moved from dashboard)
- /profile: all profile sub-routes (resume, skills, education, etc.)

Add top-level ROUTES.JOBS, ROUTES.ASSESSMENTS (with CAREER_EXPLORER),
and ROUTES.PROFILE constants. Update all drawer config, utils,
mobile nav, and feature file references. Rename /u/:slug to /users/:slug
for public profiles.

Dashboard now only keeps: index, users, settings, news, analytics.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace all hardcoded /dashboard/workers, /dashboard/jobs, etc. path
strings across 65 files (tests, feature components, backend
notifications) with new top-level paths. Update RouteBuilder methods
to use ROUTES.EMPLOYERS.ORG instead of deprecated ROUTES.ORG alias.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace Slot-only layout with DrawerLayout matching other extracted
sections. Profile now shows sidebar navigation with sub-items:
Overview, Resume, Skills, Experience, Verification, and all other
profile sub-routes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thinkclay
thinkclay merged commit 7d928d8 into main Mar 22, 2026
3 of 11 checks passed
@thinkclay
thinkclay deleted the claude/funny-swanson branch March 22, 2026 11:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/Unicorn/UNI-Construct/blob/8c6891351e9e6cca425ea4a6d6900de60e3e878b/.github/workflows/deploy-web.yml#L144-L145
P1 Badge Deploy the api function alongside the analytics rollout

This workflow still deploys only job-import and news, but the new analytics endpoints were added under packages/supabase/functions/api/index.ts. I searched .github/workflows and did not find any other supabase functions deploy api step, so after this merges the web app will start requesting /v1/analytics/* against the previously deployed api function and the analytics pages will fail until someone does a manual edge-function deploy.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/** Public profile by slug - /u/:slug (no auth) */
PUBLIC_PROFILE: {
path: '/u/:slug',
path: '/users/:slug',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep /u/:slug working for public profile URLs

Changing ROUTES.PUBLIC_PROFILE.path to /users/:slug also moved the only route file to app/(public)/users/[slug].tsx, but repo-wide search still shows multiple callers generating /u/${slug} (packages/scf-core/utils/publicProfileUrl.ts, VanityUrlSection.tsx, and the profile widgets/drawer helpers). As written, copied or shared vanity links will now resolve to a missing route, so existing public profile URLs break unless we keep a /u/[slug] alias or preserve the old path.

Useful? React with 👍 / 👎.

Comment on lines +121 to +125
CREATE POLICY search_impressions_insert_authenticated
ON engagement.search_impressions
FOR INSERT
TO authenticated
WITH CHECK (true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Constrain search_impressions inserts to the authenticated user

This INSERT policy accepts any row with WITH CHECK (true), so any signed-in web/mobile client can write arbitrary user_id/searcher_id values directly into engagement.search_impressions via the public Supabase API. That lets users fabricate impressions for other profiles and poison the new analytics dashboards without touching the server route; the policy needs to tie inserted identities back to auth.uid() or disallow direct client inserts.

Useful? React with 👍 / 👎.

Comment on lines +768 to +774
const { data: rollups } = await supabase
.schema('engagement')
.from('daily_visibility_rollups')
.select('date, impressions, clicks')
.eq('user_id', user.id)
.gte('date', startDate.toISOString().split('T')[0])
.order('date', { ascending: true })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit the search timeline to search_result rollups

GET /v1/analytics/search/timeline currently reads every row in daily_visibility_rollups for the user and sums them together, so the Search Analytics chart is inflated by recommendation and feed_appearance traffic as soon as those channels exist. The visibility endpoint already reports those impression types separately, so this endpoint needs an impression_type = 'search_result' filter to keep the “Search Appearances” metric accurate.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant