Skip to content

feat: replace inert Project tab with working Organization tab - #825

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
Maqbool61:feat/organization-settings-tab
Sep 22, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
Maqbool61:feat/organization-settings-tab

Conversation

@Maqbool61

Copy link
Copy Markdown
Contributor

Closes #753

What

Replaces the dead "Project" settings tab (inputs with no handlers, a Save
button that did nothing) with a fully working "Organization" tab, and wires
the Account tab's Save button which had the same dead-button bug.

Changes

web/src/lib/actions/organization.ts

Three new server actions:

updateOrganizationName(name)

  • Calls requireAdmin() (belt-and-braces on top of RLS, mirrors team.ts)
  • Trims whitespace, rejects empty, caps at 100 chars
  • Updates organizations.name only — leaves slug untouched

getOrganization()

  • Returns { name, slug, plan, memberCount } for the current org

updateAccountName(name)

  • Writes profiles.full_name (the column all app queries read)
  • Syncs auth.users.user_metadata.full_name so supabase.auth.getUser()
    reflects the new name immediately without waiting for a session refresh

web/src/components/settings/organization-section.tsx (new)

Follows TeamSection / AgentSection patterns exactly:

  • useCallback load in useEffect, Skeleton while loading
  • canAdmin gate via useUserRole() — non-admins see all fields read-only
    with a lock hint; admins get an editable name field
  • Save button disabled when name is unchanged or empty
  • toast.success / toast.error, Loader2 spinner on the button
  • Slug always read-only with an explanatory hint

web/src/app/.../settings/page.tsx

  • 'project' removed from the Section type; replaced with 'organization'
  • OrganizationSection imported and rendered for the new tab
  • updateAccountName wired to the Account Save button with loading state
    and toast on success/error
  • Legacy deep-link ?tab=project preserved — still maps to organization
  • Removed the now-dead Label / Input / Button block for the old
    Project card (Label import kept — still used in the Account tab)

web/messages/en.json

  • Removed unused keys: project, projectName, domain
  • Added: organization, org_title, org_description, org_name,
    org_namePlaceholder, org_slug, org_slugHint, org_plan,
    org_members, org_adminOnly, org_loadFailed, org_saveFailed,
    accountSaveFailed

Verification

  • yarn lint — 0 errors
  • yarn build — compiled and type-checked successfully (supabaseUrl error
    is a missing local env var, not related to these changes)
  • yarn format:check — all files pass Prettier

@gkhngyk gkhngyk 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.

The Organization tab and Account Save work is exactly what #753 asked for — requireAdmin, validation, slug untouched, auth-metadata sync all check out, and the component follows the TeamSection pattern well.

One blocking issue: the en.json cleanup removed more than the three Project-tab keys. signalTexts.visibility_slipping, states.slipping, actionTexts.protect_visibility, and the diagnose_slip / review_responses / reinforce_content task keys are all live — they're referenced through dynamically composed keys (t(`${kind}.title`)) in web/src/lib/signals/display.ts and web/src/lib/action-center/display.ts, and the server emits those kinds in production (server/src/lib/pulse/metrics.js, server/src/lib/action-center/generate.js). An unused-key scan can't see dynamic composition, which is probably how they got flagged. Please restore those blocks — keeping only the project / projectName / domain removals — and this is good to go.

…nsvisor#753)

- add updateOrganizationName server action (requireAdmin, trim, max 100 chars, slug untouched)
- add getOrganization server action (name, slug, plan, memberCount)
- add updateAccountName server action (writes profiles.full_name + syncs auth metadata)
- new OrganizationSection component following TeamSection/AgentSection pattern
- settings page: project → organization tab, wire Account Save button
- en.json: remove dead project/projectName/domain keys, add org_* keys
@Maqbool61
Maqbool61 force-pushed the feat/organization-settings-tab branch from 662db2c to 2cc6db9 Compare September 19, 2026 06:44
@Maqbool61

Copy link
Copy Markdown
Contributor Author

Fixed. The en.json was rebuilt from the latest main as the base, so visibility_slipping, protect_visibility, diagnose_slip, review_responses, and reinforce_content are all restored. Only project, projectName, and domain were removed. Force-pushed.

@Maqbool61
Maqbool61 requested a review from gkhngyk September 19, 2026 06:48

@gkhngyk gkhngyk 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.

Verified the update: the en.json cleanup is now scoped to the three Project-tab keys only, with all the dynamically referenced actionCenter keys intact, and the code is unchanged from the version already reviewed. Thanks for the quick turnaround — good to go.

@gkhngyk
gkhngyk merged commit 5c3c106 into ansvisor:main Sep 22, 2026
5 checks passed
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.

feat: replace the inert Project settings tab with a working Organization tab

2 participants