feat(ui): revert single changes in settings and workflow review
This commit is contained in:
1 parent
f10199f0b6
commit
55deeaa88c
11 files changed
+203
-98
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { Undo2 } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { formatValue, type Change } from "@/lib/changes";
|
||||
|
||||
/** One row per changed leaf, each revertable on its own, so a reviewer keeps
|
||||
* the changes they want and drops the rest before saving. */
|
||||
defineProps<{ changes: Change[]; label?: (path: string) => string }>();
|
||||
defineEmits<{ revert: [change: Change] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul class="divide-y divide-border font-mono text-xs">
|
||||
<li v-for="change in changes" :key="change.path" class="group flex items-start gap-2 px-3 py-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="mb-1 font-sans font-medium">{{ label ? label(change.path) : change.path }}</p>
|
||||
<p class="whitespace-pre-wrap break-words text-danger"><span class="font-sans">Before: </span>{{ formatValue(change.before) }}</p>
|
||||
<p class="whitespace-pre-wrap break-words text-ok"><span class="font-sans">After: </span>{{ formatValue(change.after) }}</p>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon-sm" :aria-label="`Revert ${label ? label(change.path) : change.path}`" title="Revert" @click="$emit('revert', change)">
|
||||
<Undo2 />
|
||||
</Button>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
Reference in new issue
Block a user