add refinement to history

This commit is contained in:
Julian Freeman
2026-03-27 17:45:35 -04:00
parent 9d3b509657
commit c719b50285
2 changed files with 22 additions and 3 deletions

View File

@@ -178,10 +178,11 @@ export const useSettingsStore = defineStore('settings', () => {
const addHistory = (item: Omit<HistoryItem, 'id' | 'timestamp'>) => {
const now = new Date();
const timestamp = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
const id = crypto.randomUUID();
history.value.unshift({
...item,
id: crypto.randomUUID(),
id,
timestamp
});
@@ -189,6 +190,15 @@ export const useSettingsStore = defineStore('settings', () => {
if (history.value.length > 100) {
history.value = history.value.slice(0, 100);
}
return id;
};
const updateHistoryItem = (id: string, updates: Partial<HistoryItem>) => {
const index = history.value.findIndex(h => h.id === id);
if (index !== -1) {
history.value[index] = { ...history.value[index], ...updates };
}
};
return {
@@ -210,6 +220,7 @@ export const useSettingsStore = defineStore('settings', () => {
logs,
history,
addLog,
addHistory
addHistory,
updateHistoryItem
};
});