Skip to content

Commit bcf7fbb

Browse files
Merge pull request anomalyco#409 from different-ai/task/ux-improvement-05
Add jump-to-latest for paused scroll
2 parents 67d17ea + fcf82ef commit bcf7fbb

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎packages/app/src/app/components/session/composer.tsx‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export default function Composer(props: ComposerProps) {
274274
const [history, setHistory] = createSignal({ prompt: [] as ComposerDraft[], shell: [] as ComposerDraft[] });
275275
const [variantMenuOpen, setVariantMenuOpen] = createSignal(false);
276276
const activeVariant = createMemo(() => props.modelVariant ?? "none");
277+
const attachmentsDisabled = createMemo(() => props.isRemoteWorkspace);
277278

278279
onMount(() => {
279280
queueMicrotask(() => focusEditorEnd());
@@ -1140,6 +1141,7 @@ export default function Composer(props: ComposerProps) {
11401141
multiple
11411142
accept={ACCEPTED_FILE_TYPES.join(",")}
11421143
class="hidden"
1144+
disabled={attachmentsDisabled()}
11431145
onChange={(event: Event) => {
11441146
const target = event.currentTarget as HTMLInputElement;
11451147
const files = Array.from(target.files ?? []);
@@ -1149,15 +1151,21 @@ export default function Composer(props: ComposerProps) {
11491151
/>
11501152
<button
11511153
type="button"
1152-
class="p-2 rounded-xl border border-gray-6 text-gray-10 hover:text-gray-12 hover:border-gray-7 transition-colors"
1154+
class={`p-2 rounded-xl border transition-colors ${
1155+
attachmentsDisabled()
1156+
? "border-gray-6 text-gray-7 cursor-not-allowed"
1157+
: "border-gray-6 text-gray-10 hover:text-gray-12 hover:border-gray-7"
1158+
}`}
11531159
onClick={() => {
1154-
if (props.isRemoteWorkspace) {
1155-
props.onToast("Attachments are unavailable in remote workspaces.");
1156-
return;
1157-
}
1160+
if (attachmentsDisabled()) return;
11581161
fileInputRef?.click();
11591162
}}
1160-
title="Attach files"
1163+
disabled={attachmentsDisabled()}
1164+
title={
1165+
attachmentsDisabled()
1166+
? "Attachments are unavailable in remote workspaces."
1167+
: "Attach files"
1168+
}
11611169
>
11621170
<Paperclip size={16} />
11631171
</button>

‎packages/app/src/app/pages/session.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,18 @@ export default function SessionView(props: SessionViewProps) {
13521352
}
13531353
/>
13541354

1355+
<Show when={!autoScrollEnabled() && props.messages.length > 0}>
1356+
<div class="sticky bottom-24 z-20 flex justify-center pointer-events-none px-4">
1357+
<button
1358+
type="button"
1359+
class="pointer-events-auto rounded-full border border-gray-6 bg-gray-1/90 px-4 py-2 text-xs text-gray-11 shadow-lg shadow-gray-12/5 backdrop-blur-md hover:bg-gray-2 transition-colors"
1360+
onClick={() => scrollToLatest("smooth")}
1361+
>
1362+
Jump to latest
1363+
</button>
1364+
</div>
1365+
</Show>
1366+
13551367
<div ref={(el) => (messagesEndEl = el)} />
13561368
</div>
13571369

0 commit comments

Comments
 (0)