mirror of
https://github.com/different-ai/openwork
synced 2026-04-25 17:15:34 +02:00
Merge pull request #409 from different-ai/task/ux-improvement-05
Add jump-to-latest for paused scroll
This commit is contained in:
@@ -274,6 +274,7 @@ export default function Composer(props: ComposerProps) {
|
||||
const [history, setHistory] = createSignal({ prompt: [] as ComposerDraft[], shell: [] as ComposerDraft[] });
|
||||
const [variantMenuOpen, setVariantMenuOpen] = createSignal(false);
|
||||
const activeVariant = createMemo(() => props.modelVariant ?? "none");
|
||||
const attachmentsDisabled = createMemo(() => props.isRemoteWorkspace);
|
||||
|
||||
onMount(() => {
|
||||
queueMicrotask(() => focusEditorEnd());
|
||||
@@ -1140,6 +1141,7 @@ export default function Composer(props: ComposerProps) {
|
||||
multiple
|
||||
accept={ACCEPTED_FILE_TYPES.join(",")}
|
||||
class="hidden"
|
||||
disabled={attachmentsDisabled()}
|
||||
onChange={(event: Event) => {
|
||||
const target = event.currentTarget as HTMLInputElement;
|
||||
const files = Array.from(target.files ?? []);
|
||||
@@ -1149,15 +1151,21 @@ export default function Composer(props: ComposerProps) {
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="p-2 rounded-xl border border-gray-6 text-gray-10 hover:text-gray-12 hover:border-gray-7 transition-colors"
|
||||
class={`p-2 rounded-xl border transition-colors ${
|
||||
attachmentsDisabled()
|
||||
? "border-gray-6 text-gray-7 cursor-not-allowed"
|
||||
: "border-gray-6 text-gray-10 hover:text-gray-12 hover:border-gray-7"
|
||||
}`}
|
||||
onClick={() => {
|
||||
if (props.isRemoteWorkspace) {
|
||||
props.onToast("Attachments are unavailable in remote workspaces.");
|
||||
return;
|
||||
}
|
||||
if (attachmentsDisabled()) return;
|
||||
fileInputRef?.click();
|
||||
}}
|
||||
title="Attach files"
|
||||
disabled={attachmentsDisabled()}
|
||||
title={
|
||||
attachmentsDisabled()
|
||||
? "Attachments are unavailable in remote workspaces."
|
||||
: "Attach files"
|
||||
}
|
||||
>
|
||||
<Paperclip size={16} />
|
||||
</button>
|
||||
|
||||
@@ -1352,6 +1352,18 @@ export default function SessionView(props: SessionViewProps) {
|
||||
}
|
||||
/>
|
||||
|
||||
<Show when={!autoScrollEnabled() && props.messages.length > 0}>
|
||||
<div class="sticky bottom-24 z-20 flex justify-center pointer-events-none px-4">
|
||||
<button
|
||||
type="button"
|
||||
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"
|
||||
onClick={() => scrollToLatest("smooth")}
|
||||
>
|
||||
Jump to latest
|
||||
</button>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
<div ref={(el) => (messagesEndEl = el)} />
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user