Files
archie/ui/src/settings/DraftHint.vue
T

23 lines
771 B
Vue

<script setup lang="ts">
import { computed } from "vue";
import { useSettingsStore } from "@/stores/settings";
import { formatValue } from "@/lib/changes";
/**
* The previous value of an edited field, inline at the control: "was 1m0s".
*
* It reads the same per-kind diff the save bar and the route guard read, so
* the hint, the review drawer and the dirty count can never disagree about
* whether a field changed.
*/
const props = defineProps<{ kind: string; path: string }>();
const store = useSettingsStore();
const change = computed(() => store.changeFor(props.kind, props.path));
</script>
<template>
<span v-if="change" class="text-xs whitespace-nowrap text-fg-subtle">was <s class="font-mono">{{ formatValue(change.before) }}</s>
</span>
</template>