Remove "Current" tag and show restore button on all snapshots

Because snapshots are now created _before_ actions, the one on the top of the list is also undo-able
This commit is contained in:
Kiril Videlov 2024-05-23 22:48:18 +02:00
parent 3e066d4944
commit c1c07a4c5a
2 changed files with 1 additions and 15 deletions

View File

@ -124,7 +124,6 @@
{#if entry.details} {#if entry.details}
<SnapshotCard <SnapshotCard
{entry} {entry}
isCurrent={idx == 0}
on:restoreClick={() => { on:restoreClick={() => {
historyService.restoreSnapshot(project.id, entry.id); historyService.restoreSnapshot(project.id, entry.id);
// In some cases, restoring the snapshot doesnt update the UI correctly // In some cases, restoring the snapshot doesnt update the UI correctly

View File

@ -10,7 +10,6 @@
import type iconsJson from '$lib/icons/icons.json'; import type iconsJson from '$lib/icons/icons.json';
export let entry: Snapshot; export let entry: Snapshot;
export let isCurrent: boolean = false;
export let selectedFile: export let selectedFile:
| { | {
entryId: string; entryId: string;
@ -143,20 +142,12 @@
const operation = mapOperation(entry.details); const operation = mapOperation(entry.details);
function isRestorable() {
return !isCurrent && !isRestoreSnapshot;
}
function getPathOnly(path: string) { function getPathOnly(path: string) {
return path.split('/').slice(0, -1).join('/'); return path.split('/').slice(0, -1).join('/');
} }
</script> </script>
<div <div class="snapshot-card show-restore-on-hover" class:restored-snapshot={isRestoreSnapshot}>
class="snapshot-card"
class:restored-snapshot={isRestoreSnapshot}
class:show-restore-on-hover={isRestorable()}
>
<div class="snapshot-right-container"> <div class="snapshot-right-container">
<div class="restore-btn"> <div class="restore-btn">
<Tag <Tag
@ -183,10 +174,6 @@
<div class="snapshot-content"> <div class="snapshot-content">
<div class="snapshot-details"> <div class="snapshot-details">
{#if isCurrent}
<Tag style="pop" kind="soft">Current</Tag>
{/if}
<h4 class="snapshot-title text-base-body-13 text-semibold"> <h4 class="snapshot-title text-base-body-13 text-semibold">
<span>{operation.text}</span> <span>{operation.text}</span>
<span class="snapshot-sha text-base-body-12">{getShortSha(entry.id)}</span> <span class="snapshot-sha text-base-body-12">{getShortSha(entry.id)}</span>