feat: when a commit is undone, the commit message box will be pre-filled with the last message

This commit is contained in:
Kiril Videlov 2024-02-17 20:29:16 +01:00 committed by Kiril Videlov
parent 2a48b7f072
commit 029377be06

View File

@ -3,6 +3,7 @@
import Button from '$lib/components/Button.svelte'; import Button from '$lib/components/Button.svelte';
import Tag from '$lib/components/Tag.svelte'; import Tag from '$lib/components/Tag.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte'; import TimeAgo from '$lib/components/TimeAgo.svelte';
import { projectCurrentCommitMessage, projectLastCommitMessage } from '$lib/config/config';
import { draggable } from '$lib/dragging/draggable'; import { draggable } from '$lib/dragging/draggable';
import { draggableCommit, nonDraggable } from '$lib/dragging/draggables'; import { draggableCommit, nonDraggable } from '$lib/dragging/draggables';
import { openExternalUrl } from '$lib/utils/url'; import { openExternalUrl } from '$lib/utils/url';
@ -21,6 +22,8 @@
export let selectedFiles: Writable<(LocalFile | RemoteFile)[]>; export let selectedFiles: Writable<(LocalFile | RemoteFile)[]>;
const selectedOwnership = writable(Ownership.default()); const selectedOwnership = writable(Ownership.default());
const currentCommitMessage = projectCurrentCommitMessage(projectId);
const lastCommitMessage = projectLastCommitMessage(projectId);
let showFiles = false; let showFiles = false;
@ -55,6 +58,7 @@
border border
clickable clickable
on:click={(e) => { on:click={(e) => {
currentCommitMessage.set($lastCommitMessage);
e.stopPropagation(); e.stopPropagation();
resetHeadCommit(); resetHeadCommit();
}}>Undo</Tag }}>Undo</Tag