mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Begun implementing collection history system
This commit is contained in:
1 parent
75deded209
commit
e8d2c66e06
19 files changed
+744
-54
No files matched your search
@@ -7,7 +7,7 @@ interface Props {
|
||||
}
|
||||
|
||||
// Bottom-of-sidebar save control. Shows unsaved-changes state and writes to the
|
||||
// NML (backup-first). On-disk saving is gated server-side by KONDUKTOR_ALLOW_WRITE.
|
||||
// NML; every save is recorded in the collection's version history.
|
||||
export function SaveBar({ onError }: Props) {
|
||||
const qc = useQueryClient()
|
||||
const [justSaved, setJustSaved] = useState<string | null>(null)
|
||||
@@ -17,9 +17,9 @@ export function SaveBar({ onError }: Props) {
|
||||
mutationFn: api.save,
|
||||
onSuccess: (res) => {
|
||||
qc.invalidateQueries({ queryKey: ['state'] })
|
||||
if (res.saved && res.backup) {
|
||||
const name = res.backup.split('/').pop()
|
||||
setJustSaved(`Saved · backup ${name}`)
|
||||
qc.invalidateQueries({ queryKey: ['history'] })
|
||||
if (res.saved && res.commit) {
|
||||
setJustSaved(`Saved · version ${res.commit.slice(0, 8)}`)
|
||||
setTimeout(() => setJustSaved(null), 6000)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user