Repository navigation
studio: make the chat column width adjustable, scaled to the space available - #10960
shimmyshimmer wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51a0205349
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /** Code/pre font size in px. null = inherit each element's own size. */ | ||
| codeFontSize: number | null; | ||
| /** Cap on the chat column in px, not a fixed width. null = app default (1600). */ | ||
| chatWidth: number | null; |
There was a problem hiding this comment.
Persist chat width in the personalization backend
For signed-in users, this field is sent with every personalization save, but PersonalizationCustomization in studio/backend/routes/settings.py uses extra = "ignore" and does not declare chatWidth, so the PUT silently drops it. On the next startup, usePersonalizationSync sees customizationSaved as true and replaces the local customization with the remote payload; sanitization then turns the missing width into null, resetting the user's choice to 1600 px. Add a matching bounded backend field and a save/load round-trip test.
Useful? React with 👍 / 👎.
|
Reworked the control in 21c61c2, and rewrote the description above to match. The first pass had the setting as an absolute px cap, which is a poor knob. Once the window is narrower than the cap, the window wins and different settings render identically: at 1000px available, both 1600 and 2000 gave 1000. On a laptop most of the range would have done nothing visible. It is now a percentage that interpolates between the default column and the space actually available, so every step differs wherever there is room to give. At 1000px available, 125/150/175/200 give 826/884/942/1000. The default also moves back to the 48rem column Studio already had. 100% is byte-identical to today, so this no longer changes anything for anyone who does not go looking for it. That also drops the earlier concern about a wide default hurting line length: the wide reading measure is now opt-in. |
The column was pinned at 48rem (768px), so a wide window left the messages and the composer stranded in the middle with most of the area unused. Raise the cap to 1600px and route every surface that bounds the column through one document-level variable, --studio-chat-width. Those surfaces are already w-full under a max-width, so they keep tracking the window and simply stop at the new cap instead of becoming a fixed slab. The page composer in chat-page.tsx is a sibling of ThreadPrimitive.Root, so the inline --thread-max-width on that root never reached it. A variable on :root does. Add a Chat width control to Appearance settings, following the uiFontSize pattern: chatWidth on the customization, CHAT_WIDTH_RANGE of 640 to 2400 defaulting to 1600, the shared sanitizeSize clamp, and the existing px number input. The default lives in index.css and the store clears the variable at that value, so a stock document carries no inline override.
A px cap is the wrong knob. Once the window is the binding constraint, two different settings render identically: at a 1000px window both 1600 and 2000 produced 1000, so the control looked broken. Make the setting a percentage that interpolates between the default column and the width actually available: --studio-chat-width: calc(48rem + (100% - 48rem) * var(--studio-chat-fill)) Every step now differs at every window size. At a 1000px window 125/150/175/200 give 826/884/942/1000, and at 1200px they give 876/984/1092/1200. Restore the default to the previous 48rem column: 100% is unchanged from before this branch, and only a deliberate change widens anything. The store still clears the variable at the default, so stock carries no inline override. CHAT_WIDTH_RANGE becomes 100 to 200 percent, and the shared number input takes a unit so this row reads % where the font sizes read px.
21c61c2 to
aeff55e
Compare
|
Rebased onto current main, which had moved on by ten commits since this branch was cut. One conflict, in Re-verified on the new base:
On the earlier CI run, Backend CI was already red on main at the time ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aeff55e4a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // in index.css queries. It sits outside the surface so those rules can | ||
| // trim the surface's own padding. | ||
| <div className="unsloth-composer-shell relative mx-auto min-w-0 w-full max-w-[46rem]"> | ||
| <div className="unsloth-composer-shell relative mx-auto min-w-0 w-full max-w-[calc(var(--studio-chat-width,48rem)-2rem)]"> |
There was a problem hiding this comment.
Interpolate the composer width only once
For settings between 100% and 200%, this expression resolves its 100% against a parent that has already been capped using the same interpolated width (for example, the dock wrapper at line 2148 and the compare wrapper in chat-page.tsx). With 1200 px available and a 150% setting, the outer wrapper becomes roughly 984 px, but this nested calculation makes the composer roughly 844 px instead of the intended 952 px after its 2rem inset, leaving it substantially narrower than the messages and making the slider's response quadratic. Calculate the interpolation against the pane only once, then derive the composer inset from that result.
Useful? React with 👍 / 👎.
|
Closing in favour of #10958, which is the same feature and was opened first. That PR is further along: it syncs the setting to the server, handles comparison panes, and was verified in a browser at five viewport widths. None of that is true of this one. The two also cannot coexist. Both add a property named The one idea worth keeping from here is going to #10958 separately: its Wide preset is a fixed 72rem, which collapses onto Full once the pane is under about 1150px, so at 1000px both render 1000 and two of the three presets stop differing. |
The chat column is pinned at
48rem(768px). On a wide window the messages and the composer sit stranded in the middle while most of the area goes unused.This makes the width adjustable. The default is unchanged: 100% is exactly the 48rem column Studio has today, so a fresh install looks the same as before this branch and only a deliberate change widens anything.
The setting scales with the space available
An absolute cap is the wrong knob here. Once the window is the binding constraint, two different settings render identically: at a 1000px window both 1600px and 2000px produce 1000px, so the control looks broken to anyone not on a large display.
Instead the percentage interpolates between the default column and the width actually available:
Measured from the live DOM of a build of this branch, probing a
w-fullelement under the same utility:Every step is distinct at every size that has room to give. At 700px the window is genuinely narrower than the base column, so no setting can change it, which is the correct outcome rather than a saturating one.
Plumbing
One document-level variable, consumed by every surface that bounds the column:
--thread-max-widthon the thread root48remvar(--studio-chat-width, 48rem)thread.tsxmax-w-[46rem]2rem, holding the old insetchat-page.tsxmax-w-[48rem]Messages already derive from
--thread-max-width, so they follow with no change.The page composer is a sibling of
ThreadPrimitive.Root, so the inline--thread-max-widthon that root never reached it and it carried its own hardcoded48rem. A variable on:rootreaches both.Setting
Appearance gets a Chat width row, following the
uiFontSizepattern rather than introducing anything new:chatWidth: number | nullonAppearanceCustomization, in percentCHAT_WIDTH_RANGEof 100 to 200, default 100sanitizeSizeclamp, which already rejects non-finite values and clamps out of range%where the font sizes readpxThe default lives in
index.css, and the store clears the variable when the value equals the default, so a stock document carries no inline override. That keeps the store's documented invariant that a default customization leaves the document byte-identical to stock.Checks
npm run typecheckclean (tsc -bplus the test project),npm run buildpassedchat-width-settingtestsnpm run i18n:check:strictpassing. All 12 locales were at zero missing keys, so the label and description are translated in every one, not onlyenNot yet verified
The width behaviour above is measured, but I have not driven the Appearance row itself in a browser. The control is wired the same way as the existing font size rows, so the risk is low, but it is untested end to end.