Skip to content

feat(playground/homepage): add Chat/Builder mode routing and showcase#224

Open
gargameljyh wants to merge 2 commits into
devfrom
jyh/builder-mode-route
Open

feat(playground/homepage): add Chat/Builder mode routing and showcase#224
gargameljyh wants to merge 2 commits into
devfrom
jyh/builder-mode-route

Conversation

@gargameljyh

@gargameljyh gargameljyh commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator
  • Introduce vue-router in Playground for Chat / Builder mode switching (/chat, /builder), with sidebar tabs gated by mode (history vs templates)
  • Add a compact capsule mode switcher, gated by VITE_ENABLE_TEMPLATE
  • Add a homepage Builder showcase section (conversation editing / version history / live preview) with assets and i18n

Summary by CodeRabbit

  • New Features
    • Added Builder Mode to the homepage with interactive feature previews and a “Try now” link.
    • Added Chat and Builder modes to the playground with dedicated navigation and views.
    • Added responsive Builder Mode layouts and localized English and Chinese content.
    • Added route-aware mode switching and preserved navigation context.
  • Improvements
    • Playground chat and builder screens now share a consistent layout and context.
    • Homepage ability sections can now omit subtitles without displaying empty elements.
    • Improved responsive styling across homepage and playground interfaces.

gargameljyh and others added 2 commits July 22, 2026 16:58
Use vue-router to separate chat and builder views, gate tabs by mode, and style the mode switcher as a compact capsule button group.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce HomeBuilderContent with demo assets and i18n, and wire it into the home page ability flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The homepage adds a localized, interactive Builder section. The playground gains Vue Router-based Chat and Builder modes, shared view context, separate routed views, and sidebar navigation controlled by route state and the template feature flag.

Changes

Homepage Builder

Layer / File(s) Summary
Builder content and localization
sites/homepage/web/src/components/HomeBuilderContent.vue, sites/homepage/web/src/i18n/*.json
Adds responsive builder feature cards, active preview images, keyboard interaction, localized content, and a playground CTA.
Homepage section integration
sites/homepage/web/src/views/home.vue
Renders the new builder section on the homepage.
Optional ability subtitle layout
sites/homepage/web/src/components/HomeAbility.vue
Makes the subtitle optional, hides it when empty, and updates title layout styling.

Playground route-driven modes

Layer / File(s) Summary
Mode routing and route guard
sites/playground/web/package.json, sites/playground/web/src/constants/*, sites/playground/web/src/router/index.ts, sites/playground/web/src/main.ts
Installs Vue Router, defines Chat and Builder modes, registers routes, redirects the root path, and guards Builder navigation with VITE_ENABLE_TEMPLATE.
Routed views and shared context
sites/playground/web/src/App.vue, sites/playground/web/src/views/*
Moves Chat and Builder rendering into routed keep-alive views backed by shared injected context and a common layout shell.
Sidebar mode switching
sites/playground/web/src/components/PlaygroundSidebar.vue, sites/playground/web/src/i18n/*.json
Adds route-driven mode controls, mode-specific tabs, Builder template navigation, localized labels, and related styling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PlaygroundSidebar
  participant Router
  participant BuilderView
  participant GenuiTemplate
  User->>PlaygroundSidebar: Select Builder mode
  PlaygroundSidebar->>Router: Navigate to /builder
  Router->>Router: Check VITE_ENABLE_TEMPLATE
  Router->>BuilderView: Resolve Builder route
  BuilderView->>GenuiTemplate: Render with shared context
Loading

Possibly related PRs

Suggested reviewers: lhuans, gimmyhehe, rhlin

Poem

I’m a rabbit hopping through Builder’s bright new trail,
Chat and templates now ride the router rail.
Cards flip, previews glow, translations bloom,
Shared views make space in the playground room.
“Try now!” I thump—then vanish with a cheer!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: Chat/Builder mode routing in Playground and a Builder showcase on the homepage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jyh/builder-mode-route

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
sites/playground/web/src/views/usePlaygroundViewContext.ts (1)

3-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define a shared typed playgroundContext key.

App.vue still provides the context with a raw string key, and several consumers bypass usePlaygroundViewContext() (PlaygroundSidebar.vue, ModelConfig.vue, ToolCallConfig.vue, McpServerPanel.vue, SkillPanel.vue, AgentPanel.vue). Export a typed InjectionKey<PlaygroundViewContext> from usePlaygroundViewContext.ts, use it in App.vue, and route the direct inject() calls through the helper.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sites/playground/web/src/views/usePlaygroundViewContext.ts` around lines 3 -
8, Define and export a typed InjectionKey<PlaygroundViewContext> from
usePlaygroundViewContext.ts, and update its inject call to use that key. In
App.vue, provide the context with the shared key instead of the raw string;
update direct inject consumers in PlaygroundSidebar.vue (lines 32-33),
ModelConfig.vue, ToolCallConfig.vue, McpServerPanel.vue, SkillPanel.vue, and
AgentPanel.vue to call usePlaygroundViewContext() so all consumers share the
typed context.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sites/homepage/web/src/components/HomeBuilderContent.vue`:
- Around line 91-95: Update the Playground CTA anchor in HomeBuilderContent.vue
to add rel="noopener noreferrer" alongside target="_blank", preserving its
existing href, styling, and content.
- Around line 91-95: Update the CTA anchor in HomeBuilderContent to target the
Builder route at /builder instead of linkMap[LinkKey.Playground]. Guard or hide
this CTA when the VITE_ENABLE_TEMPLATE feature flag is disabled, using the
component’s existing configuration or feature-flag pattern.

---

Nitpick comments:
In `@sites/playground/web/src/views/usePlaygroundViewContext.ts`:
- Around line 3-8: Define and export a typed InjectionKey<PlaygroundViewContext>
from usePlaygroundViewContext.ts, and update its inject call to use that key. In
App.vue, provide the context with the shared key instead of the raw string;
update direct inject consumers in PlaygroundSidebar.vue (lines 32-33),
ModelConfig.vue, ToolCallConfig.vue, McpServerPanel.vue, SkillPanel.vue, and
AgentPanel.vue to call usePlaygroundViewContext() so all consumers share the
typed context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0058f2a2-df49-46ad-9b6c-3cc350a07489

📥 Commits

Reviewing files that changed from the base of the PR and between 9dcf624 and d8cc9c5.

⛔ Files ignored due to path filters (7)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • sites/homepage/web/src/assets/genui_builder_demo_chat.png is excluded by !**/*.png
  • sites/homepage/web/src/assets/genui_builder_demo_preview.png is excluded by !**/*.png
  • sites/homepage/web/src/assets/genui_builder_demo_version.png is excluded by !**/*.png
  • sites/homepage/web/src/assets/genui_builder_icon_chat.svg is excluded by !**/*.svg
  • sites/homepage/web/src/assets/genui_builder_icon_preview.svg is excluded by !**/*.svg
  • sites/homepage/web/src/assets/genui_builder_icon_version.svg is excluded by !**/*.svg
📒 Files selected for processing (19)
  • sites/homepage/web/src/components/HomeAbility.vue
  • sites/homepage/web/src/components/HomeBuilderContent.vue
  • sites/homepage/web/src/i18n/en.json
  • sites/homepage/web/src/i18n/zh.json
  • sites/homepage/web/src/views/home.vue
  • sites/playground/web/package.json
  • sites/playground/web/src/App.vue
  • sites/playground/web/src/components/PlaygroundSidebar.vue
  • sites/playground/web/src/constants/index.ts
  • sites/playground/web/src/constants/playground-mode.ts
  • sites/playground/web/src/i18n/en.json
  • sites/playground/web/src/i18n/zh.json
  • sites/playground/web/src/main.ts
  • sites/playground/web/src/router/index.ts
  • sites/playground/web/src/views/BuilderView.vue
  • sites/playground/web/src/views/ChatView.vue
  • sites/playground/web/src/views/PlaygroundViewShell.vue
  • sites/playground/web/src/views/index.ts
  • sites/playground/web/src/views/usePlaygroundViewContext.ts

Comment on lines +91 to +95
<a :href="linkMap[LinkKey.Playground]" target="_blank" class="btn-link">
<tiny-button class="home-builder-content-button" size="medium" round ghost>
{{ t('ability.builder.tryNow') }}
<img :src="arrowRightIcon" alt="arrow-right" />
</tiny-button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant component and nearby context
sed -n '1,180p' sites/homepage/web/src/components/HomeBuilderContent.vue

echo
echo '---'
# Find link map definition and usages
rg -n "linkMap|LinkKey|Playground|target=\"_blank\"|rel=\"" sites/homepage/web/src/components sites/homepage/web/src -g '!**/node_modules/**'

Repository: opentiny/genui-sdk

Length of output: 10276


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the link map definition and print its values
rg -n "const linkMap|export const linkMap|LinkKey" sites/homepage/web/src -g '!**/node_modules/**'

echo
echo '---'
# Show any config or constants defining the playground URL
rg -n "playground|builder" sites/homepage/web/src -g '!**/node_modules/**'

Repository: opentiny/genui-sdk

Length of output: 8845


Add rel="noopener noreferrer" to the Playground CTA.
This external new-tab link uses target="_blank" without rel, leaving window.opener exposed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sites/homepage/web/src/components/HomeBuilderContent.vue` around lines 91 -
95, Update the Playground CTA anchor in HomeBuilderContent.vue to add
rel="noopener noreferrer" alongside target="_blank", preserving its existing
href, styling, and content.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C 4 'VITE_ENABLE_TEMPLATE|/builder|redirect' sites/playground/web/src

Repository: opentiny/genui-sdk

Length of output: 3805


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== HomeBuilderContent.vue ==\n'
sed -n '1,180p' sites/homepage/web/src/components/HomeBuilderContent.vue

printf '\n== playground constants / link map references ==\n'
rg -n -C 3 'linkMap|PlaygroundMode|Builder|Chat|VITE_ENABLE_TEMPLATE' sites/homepage/web/src -g '!**/node_modules/**'

printf '\n== playground router ==\n'
sed -n '1,220p' sites/playground/web/src/router/index.ts

printf '\n== playground mode constants ==\n'
sed -n '1,200p' sites/playground/web/src/constants.ts

Repository: opentiny/genui-sdk

Length of output: 24160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,180p' sites/homepage/web/src/components/HomeBuilderContent.vue

Repository: opentiny/genui-sdk

Length of output: 5439


🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -a 'constants*' sites/playground/web/src
printf '\n== PlaygroundMode references ==\n'
rg -n -C 2 'enum PlaygroundMode|PlaygroundMode' sites/playground/web/src

Repository: opentiny/genui-sdk

Length of output: 7464


Link this CTA to the Builder route. linkMap[LinkKey.Playground] points to the playground root, which redirects to /chat; use /builder here, and guard or hide the CTA when VITE_ENABLE_TEMPLATE is disabled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sites/homepage/web/src/components/HomeBuilderContent.vue` around lines 91 -
95, Update the CTA anchor in HomeBuilderContent to target the Builder route at
/builder instead of linkMap[LinkKey.Playground]. Guard or hide this CTA when the
VITE_ENABLE_TEMPLATE feature flag is disabled, using the component’s existing
configuration or feature-flag pattern.

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