mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-15 20:52:01 +03:00
feat(app): add a timeline width setting (#58308)
This commit is contained in:
committed by
GitHub
Unverified
parent
11133d178b
commit
6aaa989e6a
@@ -907,6 +907,11 @@ export const dict = {
|
||||
"settings.timeline.row.backgroundActivity.left": "Left",
|
||||
"settings.timeline.row.backgroundActivity.center": "Center",
|
||||
"settings.timeline.row.backgroundActivity.right": "Right",
|
||||
"settings.timeline.row.width.title": "Timeline width",
|
||||
"settings.timeline.row.width.description": "Narrower lines are easier to scan. Wider lines show more at once",
|
||||
"settings.timeline.row.width.focused": "Focused",
|
||||
"settings.timeline.row.width.comfortable": "Comfortable",
|
||||
"settings.timeline.row.width.wide": "Wide",
|
||||
"settings.timeline.detail": "Timeline detail",
|
||||
"settings.timeline.description": "Choose how much detail appears in the session timeline.",
|
||||
"settings.timeline.summary": "{{preset}}:",
|
||||
|
||||
@@ -9,6 +9,7 @@ import { ExtensionSettingsSections } from "@/runtime/extension/settings-page-vie
|
||||
import {
|
||||
type BackgroundActivity,
|
||||
type FollowUpBehavior,
|
||||
type TimelineWidth,
|
||||
type WorkspaceDefaultDestination,
|
||||
useSettings,
|
||||
} from "@/settings/model"
|
||||
@@ -167,6 +168,35 @@ const BackgroundActivitySetting = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const TimelineWidthSetting = () => {
|
||||
const language = useLanguage()
|
||||
const settings = useSettings()
|
||||
const options = createMemo((): { value: TimelineWidth; label: string }[] => [
|
||||
{ value: "focused", label: language.t("settings.timeline.row.width.focused") },
|
||||
{ value: "comfortable", label: language.t("settings.timeline.row.width.comfortable") },
|
||||
{ value: "wide", label: language.t("settings.timeline.row.width.wide") },
|
||||
])
|
||||
|
||||
return (
|
||||
<SettingsRow
|
||||
title={language.t("settings.timeline.row.width.title")}
|
||||
description={language.t("settings.timeline.row.width.description")}
|
||||
>
|
||||
<Select
|
||||
data-action="settings-timeline-width"
|
||||
aria-label={language.t("settings.timeline.row.width.title")}
|
||||
options={options()}
|
||||
current={options().find((option) => option.value === settings.general.timelineWidth())}
|
||||
value={(option) => option.value}
|
||||
label={(option) => option.label}
|
||||
placement="bottom-end"
|
||||
gutter={6}
|
||||
onSelect={(option) => option && settings.general.setTimelineWidth(option.value)}
|
||||
/>
|
||||
</SettingsRow>
|
||||
)
|
||||
}
|
||||
|
||||
const LanguageSetting = () => {
|
||||
const language = useLanguage()
|
||||
|
||||
@@ -295,6 +325,7 @@ export const SettingsGeneral: Component = () => {
|
||||
onChange={settings.general.setTimelineDetail}
|
||||
/>
|
||||
</div>
|
||||
<TimelineWidthSetting />
|
||||
<BackgroundActivitySetting />
|
||||
<SettingsRow
|
||||
title={language.t("settings.timeline.row.turnDiffs.title")}
|
||||
|
||||
@@ -94,6 +94,7 @@ describe("settings schema", () => {
|
||||
showCustomAgents: false,
|
||||
showTurnDiffs: false,
|
||||
backgroundActivity: "left",
|
||||
timelineWidth: "comfortable",
|
||||
generatedUI: true,
|
||||
newIcons: false,
|
||||
mobileTitlebarPosition: "top",
|
||||
@@ -132,6 +133,7 @@ describe("settings schema", () => {
|
||||
reasoningMode: 3,
|
||||
followUpBehavior: "invalid",
|
||||
backgroundActivity: "invalid",
|
||||
timelineWidth: "invalid",
|
||||
},
|
||||
appearance: { fontSize: "large", mono: "Custom Mono", tabLayout: "vertical", showProjectName: true },
|
||||
permissions: { autoApprove: true, autoApproveProjects: { on: true, off: false, bad: "yes" } },
|
||||
@@ -147,6 +149,7 @@ describe("settings schema", () => {
|
||||
timelineDetail: timelinePresets[2].value,
|
||||
followUpBehavior: "steer",
|
||||
backgroundActivity: "left",
|
||||
timelineWidth: "comfortable",
|
||||
})
|
||||
expect(settings.appearance).toEqual({
|
||||
fontSize: 14,
|
||||
|
||||
@@ -19,6 +19,8 @@ export type FollowUpBehavior = Settings["general"]["followUpBehavior"]
|
||||
|
||||
export type BackgroundActivity = Settings["general"]["backgroundActivity"]
|
||||
|
||||
export type TimelineWidth = Settings["general"]["timelineWidth"]
|
||||
|
||||
export type TabLayout = Settings["appearance"]["tabLayout"]
|
||||
|
||||
export type ReduceMotion = Settings["appearance"]["reduceMotion"]
|
||||
@@ -124,6 +126,7 @@ const generalSchema = Persistence.struct({
|
||||
showCustomAgents: Schema.Boolean,
|
||||
showTurnDiffs: Schema.Boolean,
|
||||
backgroundActivity: Schema.Literals(["off", "left", "center", "right"]),
|
||||
timelineWidth: Schema.Literals(["focused", "comfortable", "wide"]),
|
||||
// Lets agents render generated UI in the timeline; an experiment users can turn off.
|
||||
generatedUI: Schema.Boolean,
|
||||
// The "New icons" design experiment, off until it ships.
|
||||
@@ -294,6 +297,7 @@ export const defaultSettings: Settings = {
|
||||
showCustomAgents: false,
|
||||
showTurnDiffs: false,
|
||||
backgroundActivity: "left",
|
||||
timelineWidth: "comfortable",
|
||||
generatedUI: true,
|
||||
newIcons: false,
|
||||
mobileTitlebarPosition: "top",
|
||||
@@ -354,6 +358,14 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
|
||||
document.documentElement.dataset.motion = reduce ? "reduce" : "full"
|
||||
})
|
||||
|
||||
const timelineWidth = withFallback(() => store.general?.timelineWidth, defaultSettings.general.timelineWidth)
|
||||
|
||||
// The session column's width token keys off this attribute, so every surface sharing it follows the setting.
|
||||
createEffect(() => {
|
||||
if (typeof document === "undefined") return
|
||||
document.documentElement.dataset.timelineWidth = timelineWidth()
|
||||
})
|
||||
|
||||
const autoApproveDefault = withFallback(
|
||||
() => store.permissions?.autoApprove,
|
||||
defaultSettings.permissions.autoApprove,
|
||||
@@ -388,6 +400,10 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
|
||||
setBackgroundActivity(value: BackgroundActivity) {
|
||||
setStore("general", "backgroundActivity", value)
|
||||
},
|
||||
timelineWidth,
|
||||
setTimelineWidth(value: TimelineWidth) {
|
||||
setStore("general", "timelineWidth", value)
|
||||
},
|
||||
generatedUI: withFallback(() => store.general?.generatedUI, defaultSettings.general.generatedUI),
|
||||
setGeneratedUI(value: boolean) {
|
||||
setStore("general", "generatedUI", value)
|
||||
|
||||
@@ -76,6 +76,14 @@ export const clientSettings: Entry<SettingsRootTab>[] = [
|
||||
section: "settings.timeline.title",
|
||||
keywords: "capsule panel subagent shell background activity position alignment hidden left center right",
|
||||
},
|
||||
{
|
||||
tab: "general",
|
||||
label: "settings.timeline.row.width.title",
|
||||
description: "settings.timeline.row.width.description",
|
||||
target: "settings-timeline-width",
|
||||
section: "settings.timeline.title",
|
||||
keywords: "column line length measure narrow focused comfortable wide readability",
|
||||
},
|
||||
{
|
||||
tab: "general",
|
||||
label: "settings.timeline.row.turnDiffs.title",
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
--container-6xl: 72rem;
|
||||
--container-7xl: 80rem;
|
||||
/* Shared by the session timeline, composer dock, and drop target so their edges stay aligned.
|
||||
The composer dock's 12px gutter leaves the design's 720px composer. */
|
||||
The composer dock's 12px gutter leaves the design's 720px composer. The timeline width setting
|
||||
overrides it below. */
|
||||
--container-session: 744px;
|
||||
|
||||
--font-sans: var(--font-family-sans);
|
||||
@@ -100,3 +101,13 @@
|
||||
}
|
||||
|
||||
@import "./colors.css";
|
||||
|
||||
/* With Inter at 14px, after the timeline's 24px side padding, these give about 66 characters per line
|
||||
(the classic optimum for scanning prose); the 744px default gives about 105 and 1000px about 144. */
|
||||
:root[data-timeline-width="focused"] {
|
||||
--container-session: 488px;
|
||||
}
|
||||
|
||||
:root[data-timeline-width="wide"] {
|
||||
--container-session: 1000px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user