feat(ui): add starters_layout setting for grouped landing page#2914
Open
nzjrs wants to merge 1 commit into
Open
feat(ui): add starters_layout setting for grouped landing page#2914nzjrs wants to merge 1 commit into
nzjrs wants to merge 1 commit into
Conversation
When starter_categories are defined, the landing page currently shows
each category as a toggle pill: only one group's starters render at a
time. This commit adds a new UISettings.starters_layout field with
values "tabs" (default, current behaviour) and "list".
In "list" mode every category renders simultaneously as a card with
its starters as rows inside, laid out in a responsive grid. Each card
carries a data-category="<slug>" attribute so custom_css can target
cards individually -- including arbitrary CSS Grid spans, e.g.
#starters [data-category="featured"] { grid-column: 1 / -1; }
The onSubmit/disabled bookkeeping previously inlined in Starter.tsx is
extracted into a shared useStarterSubmit hook so the new StarterRow
component does not duplicate the send-message logic.
WelcomeScreen.tsx wraps the logo and MessageComposer in #welcome-logo
and #welcome-composer divs so users can reorder children via plain
custom_css without forking the component, e.g.
#welcome-screen #starters { order: -1; }
Defaults preserve current behaviour: layout = "tabs", starters render
below the composer. Flat starters (config.starters with no categories)
are unaffected.
Adds a cypress test app/spec under cypress/e2e/starters_categories_list
covering the new layout.
Contributor
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/chat/StarterCategoryCard.tsx">
<violation number="1" location="frontend/src/components/chat/StarterCategoryCard.tsx:39">
P2: Using `starter.label` as the React key can collide when two starters in the same category share a label, causing reconciliation bugs.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| </CardHeader> | ||
| <CardContent className="p-0 pb-2 divide-y"> | ||
| {category.starters.map((starter) => ( | ||
| <StarterRow key={starter.label} starter={starter} /> |
Contributor
There was a problem hiding this comment.
P2: Using starter.label as the React key can collide when two starters in the same category share a label, causing reconciliation bugs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/chat/StarterCategoryCard.tsx, line 39:
<comment>Using `starter.label` as the React key can collide when two starters in the same category share a label, causing reconciliation bugs.</comment>
<file context>
@@ -0,0 +1,44 @@
+ </CardHeader>
+ <CardContent className="p-0 pb-2 divide-y">
+ {category.starters.map((starter) => (
+ <StarterRow key={starter.label} starter={starter} />
+ ))}
+ </CardContent>
</file context>
Suggested change
| <StarterRow key={starter.label} starter={starter} /> | |
| + <StarterRow key={`${starter.label}-${starter.message}`} starter={starter} /> |
Contributor
Author
|
I can't make sense of these e2e failures. Was this github unreliabiliyt? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lets users customise how the starters are shown with respect to the main chat box. For example, using only CSS, the same starters can be presented these two ways (ignore the privacy blur sorry)
When starter_categories are defined, the landing page currently shows each category as a toggle pill: only one group's starters render at a time. This commit adds a new
UISettings.starters_layoutfield with values "tabs" (default, current behaviour) and "list".In "list" mode every category renders simultaneously as a card with its starters as rows inside, laid out in a responsive grid. Each card carries a
data-category="<slug>"attribute so custom_css can target cards individually, including arbitrary CSS Grid spans, e.g.The onSubmit/disabled bookkeeping previously inlined in
Starter.tsxis extracted into a shareduseStarterSubmithook so the newStarterRowcomponent does not duplicate the send-message logic.WelcomeScreen.tsxwraps the logo andMessageComposerin#welcome-logoand#welcome-composerdivs so users can reorder children via plain custom_css without forking the component, e.g.Defaults preserve current behaviour: layout = "tabs", starters render below the composer. Flat starters (config.starters with no categories) are unaffected.
Adds a cypress test app/spec under cypress/e2e/starters_categories_list covering the new layout.
Summary by cubic
Add
UISettings.starters_layoutto control how grouped starters render on the landing page. New "list" layout shows all categories as cards in a responsive grid and supports fine-grained styling viadata-categoryattributes.New Features
starters_layout:tabs(default) orlist(all categories as cards with starter rows, each withdata-category="<slug>"; easy targeting viacustom_css). Backend config andlibs/react-clienttypes updated.#welcome-logoand#welcome-composerso layout order can be changed with CSS.Refactors
useStarterSubmitand reused inStarterand newStarterRow.StarterCategoryCardandStarterRow. Defaults preserved (tabslayout; flat starters unchanged).Written for commit e74871c. Summary will update on new commits. Review in cubic