Skip to content

Wire Add Subtopics chip to suggest-then-create flow with inline UI #25

Description

@davstur

Overview

Wire the "Add subtopics" action chip in CollapsibleSection to the suggest and create subtopics APIs. When tapped, show AI-suggested subtopics, let the user select/customize, then generate and display new child nodes inline.

User Story

User Story: /docs/user-stories/active/create-subtopics.md

As a user, I want to add child sections to any node, so I can branch out and explore adjacent areas within a topic.

Suggested Priority: high 🟠

Reasoning: Turns the last "Coming soon" chip into a real feature, completing the Explorer's action chip set.

Requirements

  • Tapping "Add subtopics" chip opens SubtopicPanel inline
  • Panel shows loading while fetching suggestions
  • 3 AI suggestions displayed as selectable chips (label + emoji)
  • User can select multiple suggestions (toggle on/off)
  • Freetext input for custom subtopic labels
  • "Create" button generates content for selected + custom labels
  • Loading state during creation
  • New child nodes appear in the tree below the parent
  • Error state with retry
  • Not available on H4 nodes (max depth — chip already hidden)
  • All interactive elements have testID props

Technical Approach

UI Flow

Tap "Add subtopics" chip
  → SubtopicPanel opens inline
  → Loading: fetching suggestions...
  → 3 suggestion chips appear (toggleable)
  → User selects suggestions + optionally types custom labels
  → Tap "Create" button
  → Loading: generating content...
  → New child nodes appear in tree
  → Panel closes

Components

  • SubtopicPanel: inline below chips (like ExpandPanel pattern)
  • SuggestionChip: toggleable chip showing emoji + label
  • Custom label input with "+" button

State Management

  • On successful creation: add new child nodes to parent in tree state
  • Update the parent's children array + recalculate childCount
  • New nodes should inherit branchColor from parent's branch

Definition of Done

  • Suggest + create flow works end-to-end
  • AI suggestions are relevant and selectable
  • Custom labels work alongside suggestions
  • New nodes render correctly in the tree
  • Loading and error states work
  • testID props on all elements

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    high 🟠High priority - next milestone work✨ enhancementNew feature or capability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions