Skip to content

Topics: add an "Add topic" action to the main Topics page #462

Closed

Description

@gkhngyk

Problem

The main Topics page (/dashboard/topics) is read-only: KPI cards and the Topic leaderboard, with no way to add a topic. Creation lives only in Brands → [brand] → Topics (web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsx) — buried in brand management, same gap #460 covers for prompts: you should be able to add where you see the list.

Fix

Add an Add topic button to the header of web/src/app/[locale]/(dashboard)/dashboard/topics/page.tsx, opening a small name dialog for the active brand:

  • Use the existing singular createTopic(brandId, name) action (web/src/lib/actions/topic.ts). Do not use the plural createTopics — it deletes all of the brand's topics before inserting (an onboarding-only resubmit behavior) and would wipe existing topics.
  • The add dialog on the brands/[id]/topics page is the styling/validation reference — share rather than fork if practical (trim, non-empty, duplicate-name check against existing topics).
  • After adding: close the dialog, refresh the leaderboard; the new topic appears with zero metrics until prompts are assigned — a short toast pointing at that ("assign prompts to this topic to start tracking it") avoids confusion.
  • The leaderboard's empty state should get the same button.
  • Role gate: hide or disable for members without write access (canManage from useUserRole).

Acceptance criteria

  • Add topic button visible in the page header (and empty state) for admin/manager; works for the active brand.
  • Duplicate names are rejected with a clear message; whitespace-only input can't be submitted.
  • The new topic shows up in the leaderboard immediately after adding.
  • Members without write access don't see (or can't use) the button.
  • Existing topics are never touched by the add flow.

Getting started

See CONTRIBUTING.md for setup. From web/, yarn lint, yarn typecheck and yarn format:check must pass. Comment here to claim the issue before opening a PR.

Activity

  1. added
    enhancement
    good first issue
    on Jul 17, 2026
  2. BharadwajKanneveti commented on Jul 18, 2026

    @BharadwajKanneveti
    Contributor

    Hi @gkhngyk can I work on this issue?

  3. gkhngyk commented on Jul 22, 2026

    @gkhngyk
    ContributorAuthor

    Hi @BharadwajKanneveti, I've assigned you. Thank you!

  4. BharadwajKanneveti commented on Jul 22, 2026

    @BharadwajKanneveti
    Contributor

    Sure @gkhngyk I will raise the PR for this

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

Metadata

Metadata

Labels

enhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions