diff options
| author | Shoubhit Dash <[email protected]> | 2026-03-17 19:54:20 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-17 19:54:20 +0530 |
| commit | ba2297656877f26c50d28977b0e7164868d6868c (patch) | |
| tree | 5bd14a7421723275d84617ff9f91ff0d20895926 /packages/ui/src/components | |
| parent | 0afeaea21fdd85716f843b7688e0fdab712e52bb (diff) | |
| download | opencode-ba2297656877f26c50d28977b0e7164868d6868c.tar.gz opencode-ba2297656877f26c50d28977b0e7164868d6868c.zip | |
fix: inline review comment submit and layout (#17948)
Diffstat (limited to 'packages/ui/src/components')
| -rw-r--r-- | packages/ui/src/components/line-comment-styles.ts | 27 | ||||
| -rw-r--r-- | packages/ui/src/components/line-comment.tsx | 16 |
2 files changed, 36 insertions, 7 deletions
diff --git a/packages/ui/src/components/line-comment-styles.ts b/packages/ui/src/components/line-comment-styles.ts index d5be67554..8fd02f088 100644 --- a/packages/ui/src/components/line-comment-styles.ts +++ b/packages/ui/src/components/line-comment-styles.ts @@ -15,6 +15,7 @@ export const lineCommentStyles = ` right: auto; display: flex; width: 100%; + min-width: 0; align-items: flex-start; } @@ -64,6 +65,7 @@ export const lineCommentStyles = ` z-index: var(--line-comment-popover-z, 40); min-width: 200px; max-width: none; + box-sizing: border-box; border-radius: 8px; background: var(--surface-raised-stronger-non-alpha); box-shadow: var(--shadow-xxs-border); @@ -75,9 +77,10 @@ export const lineCommentStyles = ` top: auto; right: auto; margin-left: 8px; - flex: 0 1 600px; - width: min(100%, 600px); - max-width: min(100%, 600px); + flex: 1 1 0%; + width: auto; + max-width: 100%; + min-width: 0; } [data-component="line-comment"][data-inline] [data-slot="line-comment-popover"][data-inline-body] { @@ -96,23 +99,27 @@ export const lineCommentStyles = ` } [data-component="line-comment"][data-inline][data-variant="editor"] [data-slot="line-comment-popover"] { - flex-basis: 600px; + width: 100%; } [data-component="line-comment"] [data-slot="line-comment-content"] { display: flex; flex-direction: column; gap: 6px; + width: 100%; + min-width: 0; } [data-component="line-comment"] [data-slot="line-comment-head"] { display: flex; align-items: flex-start; gap: 8px; + min-width: 0; } [data-component="line-comment"] [data-slot="line-comment-text"] { flex: 1; + min-width: 0; font-family: var(--font-family-sans); font-size: var(--font-size-base); font-weight: var(--font-weight-regular); @@ -120,6 +127,7 @@ export const lineCommentStyles = ` letter-spacing: var(--letter-spacing-normal); color: var(--text-strong); white-space: pre-wrap; + overflow-wrap: anywhere; } [data-component="line-comment"] [data-slot="line-comment-tools"] { @@ -127,6 +135,7 @@ export const lineCommentStyles = ` display: flex; align-items: center; justify-content: flex-end; + min-width: 0; } [data-component="line-comment"] [data-slot="line-comment-label"], @@ -137,17 +146,22 @@ export const lineCommentStyles = ` line-height: var(--line-height-large); letter-spacing: var(--letter-spacing-normal); color: var(--text-weak); - white-space: nowrap; + min-width: 0; + white-space: normal; + overflow-wrap: anywhere; } [data-component="line-comment"] [data-slot="line-comment-editor"] { display: flex; flex-direction: column; gap: 8px; + width: 100%; + min-width: 0; } [data-component="line-comment"] [data-slot="line-comment-textarea"] { width: 100%; + box-sizing: border-box; resize: vertical; padding: 8px; border-radius: var(--radius-md); @@ -167,11 +181,14 @@ export const lineCommentStyles = ` [data-component="line-comment"] [data-slot="line-comment-actions"] { display: flex; align-items: center; + flex-wrap: wrap; gap: 8px; padding-left: 8px; + min-width: 0; } [data-component="line-comment"] [data-slot="line-comment-editor-label"] { + flex: 1 1 220px; margin-right: auto; } diff --git a/packages/ui/src/components/line-comment.tsx b/packages/ui/src/components/line-comment.tsx index ff5d1df00..bc47ad940 100644 --- a/packages/ui/src/components/line-comment.tsx +++ b/packages/ui/src/components/line-comment.tsx @@ -206,6 +206,16 @@ export const LineCommentEditor = (props: LineCommentEditorProps) => { const [text, setText] = createSignal(split.value) const focus = () => refs.textarea?.focus() + const hold: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent> = (e) => { + e.preventDefault() + e.stopPropagation() + } + const click = + (fn: VoidFunction): JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent> => + (e) => { + e.stopPropagation() + fn() + } createEffect(() => { setText(split.value) @@ -268,7 +278,8 @@ export const LineCommentEditor = (props: LineCommentEditorProps) => { type="button" data-slot="line-comment-action" data-variant="ghost" - on:click={split.onCancel as any} + on:mousedown={hold as any} + on:click={click(split.onCancel) as any} > {split.cancelLabel ?? i18n.t("ui.common.cancel")} </button> @@ -277,7 +288,8 @@ export const LineCommentEditor = (props: LineCommentEditorProps) => { data-slot="line-comment-action" data-variant="primary" disabled={text().trim().length === 0} - on:click={submit as any} + on:mousedown={hold as any} + on:click={click(submit) as any} > {split.submitLabel ?? i18n.t("ui.lineComment.submit")} </button> |
