Skip to content

feat(groups): add active group switcher - #273

Open
chiptus wants to merge 21 commits into
mainfrom
claude/implement-124-f9vl65
Open

feat(groups): add active group switcher#273
chiptus wants to merge 21 commits into
mainfrom
claude/implement-124-f9vl65

Conversation

@chiptus

@chiptus chiptus commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Adds a persistent header switcher (Everyone + your groups) that sets the Active Group everywhere, and retires the Artists-tab-only group filter in favor of a two-state Vote Perspective toggle built on a shared, tested vote-scope resolver.
Selecting a group in the header re-scores and re-sorts the Artists tab immediately, without a reload.

Closes #124

Verification

  • Sign in as a user in 2+ groups; open the header switcher, pick a group, and confirm the button updates to that group's name immediately (no reload).
  • On the Artists tab, with an Active Group set, confirm the Vote Perspective toggle defaults to the group and toggling to Everyone re-sorts/re-scores sets without hiding any.
  • Sign in as a user in zero groups; confirm the header still shows the "Create/Join a Group" CTA and the Artists tab has no Vote Perspective toggle (always Everyone).
  • pnpm test passes, including new src/lib/voteScope.test.ts covering Everyone/Me/Group scopes, a member vs. non-member group, no votes, and votes only from outside the group.
  • pnpm run typecheck and pnpm run lint pass.

Generated by Claude Code

Copilot AI review requested due to automatic review settings July 31, 2026 08:27
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview Aug 14, 2026 3:59pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Playwright test results

passed  50 passed

Details

stats  50 tests across 14 suites
duration  1 minute, 7 seconds
commit  5193d1b

Comment thread src/components/layout/AppHeader/GroupsIndicator.tsx Outdated
Comment thread src/lib/voteScope.test.ts
Comment thread src/lib/voteScope.test.ts Outdated
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy → stagingworkflow run
Last updated: 2026-08-14 15:59:14 UTC

  • DB migrations failed
  • ⏭️ Edge functions skipped (no changes)

⚠️ Migration failed on staging. This often means migration history drift — another PR applied migrations that aren't in this branch. To recover, you may need to reset and re-seed staging:

supabase link --project-ref <STAGING_PROJECT_REF>
supabase db reset --linked    # wipes staging data
pnpm run db:sync:staging      # re-sync anonymized prod data

Then re-run this workflow.

chiptus commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

The migrate / Push migrations (staging) failure isn't caused by the new migration in this PR (20260801140000_add_active_group_selected_to_profiles.sql) — its timestamp is correctly ordered after everything else. The actual error from the job log:

Found local migration files to be inserted before the last migration on remote database.
Rerun the command with --include-all flag to apply these migrations:
supabase/migrations/20260728000000_add_votes_user_id_profiles_fkey.sql

This means staging is missing 20260728000000_add_votes_user_id_profiles_fkey.sql even though later migrations were already applied — pre-existing history drift unrelated to this branch's changes. This is the first commit on this PR to touch supabase/migrations/, so it's the first time the migrate check has run here.

The auto-generated deploy-status comment on this thread suggests supabase db reset --linked to recover, but that wipes staging data — I'm not running that from this session per repo policy (CLAUDE.md: never run supabase db push / db reset). Resolving the drift needs a human decision on the staging project. Happy to push --include-all myself if that's the intended fix and someone confirms it's safe for staging's current state.


Generated by Claude Code

chiptus and others added 2 commits August 14, 2026 09:15
Deriving activeGroupId from the header's transient current scope hid
the toggle whenever a user with an Active Group switched away from
"group". Also seed the initial perspective from current per ADR 0005
instead of hardcoding "group".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace hand-rolled <button> + manual state classes with the
shadcn ToggleGroup pattern already used by VotePerspectiveToggle
for the same single-select choice shape.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Decompose FilteredSetsPanel.tsx (154 lines, four mixed concerns) into
AuthedFilteredSetsPanel/GroupScopedSetsPanel/SetsPanelContent, matching
the earlier ActiveGroupSwitcher/ScopeMenuBody split. This also removes
the duplicated "everyone" SetsPanelContent call between the anonymous
and authed-non-group branches.

Also collapse useSetActiveGroupMutation/useSetActiveScopeMutation into
a shared useProfileFieldMutation, and dedupe the ToggleGroupItem
className repeated in ActiveGroupSetting/ActiveScopeSetting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
Comment thread src/api/groups/useProfileFieldMutation.ts Outdated
Comment thread src/components/layout/AppHeader/GroupSwitcher/ScopeMenuBody.tsx
ActiveGroupSwitcher.tsx, ScopeMenuBody.tsx, and scopeDisplay.ts are
used exclusively by the group switcher, so group them together
instead of leaving them loose alongside unrelated AppHeader files.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
Comment thread src/components/layout/AppHeader/GroupSwitcher/ScopeMenuBody.tsx Outdated
children: ReactNode;
}) {
const { profile } = useAuth();
const { data: groups = [], isLoading } = useQuery(userGroupsQuery(userId));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Why don't we use suspense?

Comment thread src/contexts/ActiveScopeContext.tsx Outdated
activeGroupId,
pinned,
current,
selectScope,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Why don't we use one "selects cope" fn that has pinned boolean? Instead of two?

Comment thread src/pages/groups/Groups/SignInRequired.tsx Outdated
Comment thread src/pages/Settings/settingsToggleItemClassName.ts Outdated
Comment thread supabase/migrations/20260814140000_add_active_group_selected_to_profiles.sql Outdated
claude added 5 commits August 14, 2026 15:54
column/value/errorMessage now travel as mutate() arguments instead of
useProfileFieldMutation generics, so ActiveScopeContext only needs one
mutation instance for both active_group_id and active_scope instead
of two.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
SignInRequired has two callers (Groups, Settings) with different
copy; a groups-specific default was wrong for the other one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
ActiveGroupSetting/ActiveScopeSetting used the shared className
identically on a ToggleGroupItem; encapsulate that as a
SettingsToggleItem component instead of exporting a bare string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
20260814140000 added active_group_selected only for the very next
migration to drop it — both land in the same unmerged PR, so fold the
net-zero column into the active_scope migration directly instead of
shipping a column that's never actually used.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hH41h18hKSvYxWAw17nhd
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.

Group switcher + Vote Perspective on Artists tab

3 participants