feat: move revert action to message cards and improve article links
- Move the revert functionality from the journal input to individual message cards for better UX. - Implement `RevealLink` component for article reveals to allow navigation without losing URL parameters. - Add helper functions to format article paths and slugs into human-readable titles.
This commit is contained in:
@@ -20,12 +20,7 @@ import {
|
||||
Switch,
|
||||
Match,
|
||||
} from "solid-js";
|
||||
import {
|
||||
sendMessage,
|
||||
revertLatest,
|
||||
canRevert,
|
||||
useJournalStream,
|
||||
} from "../stores/journalStream";
|
||||
import { sendMessage, useJournalStream } from "../stores/journalStream";
|
||||
import {
|
||||
useJournalCompletions,
|
||||
ensureCompletions,
|
||||
@@ -123,10 +118,7 @@ export const JournalInput: Component = () => {
|
||||
textareaRef?.focus();
|
||||
}
|
||||
|
||||
function handleRevert() {
|
||||
revertLatest();
|
||||
}
|
||||
|
||||
// ---- Completions ----
|
||||
// ---- Scroll selected completion into view ----
|
||||
|
||||
createEffect(() => {
|
||||
@@ -313,8 +305,6 @@ export const JournalInput: Component = () => {
|
||||
onCleanup(() => document.removeEventListener("mousedown", handler));
|
||||
});
|
||||
|
||||
const showRevert = () => canRevert() && stream.myName === "gm";
|
||||
|
||||
// Completions placeholder — shown in the dropdown area when no matches
|
||||
function renderCompletionsDropdown() {
|
||||
const comps = currentCompletions();
|
||||
@@ -414,15 +404,6 @@ export const JournalInput: Component = () => {
|
||||
<p class="text-red-500 text-xs truncate max-w-[60%]">{error()}</p>
|
||||
</Show>
|
||||
<div class="flex items-center gap-1 ml-auto">
|
||||
<Show when={showRevert}>
|
||||
<button
|
||||
onClick={handleRevert}
|
||||
class="text-xs text-gray-400 hover:text-red-500 px-1.5 py-0.5"
|
||||
title="Revert last message"
|
||||
>
|
||||
↩
|
||||
</button>
|
||||
</Show>
|
||||
<button
|
||||
onClick={handleSend}
|
||||
disabled={sending() || !text().trim()}
|
||||
|
||||
Reference in New Issue
Block a user