add updated label to save state cards

This commit is contained in:
Georges-Antoine Assi committed 2025-03-30 16:53:06 -04:00
1 parent d68d018b20
commit 2f4e5e1669
6 files changed
+15 -7

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ function onCardClick(save: SaveSchema, event: MouseEvent) {
{{ formatBytes(save.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
{{ formatTimestamp(save.updated_at) }}
Updated: {{ formatTimestamp(save.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
+1 -1
View File
@@ -175,7 +175,7 @@ function onCardClick(state: StateSchema, event: MouseEvent) {
{{ formatBytes(state.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
{{ formatTimestamp(state.updated_at) }}
Updated: {{ formatTimestamp(state.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
@@ -100,7 +100,7 @@ function closeDialog() {
{{ formatBytes(save.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
{{ formatTimestamp(save.updated_at) }}
Updated: {{ formatTimestamp(save.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
@@ -100,7 +100,7 @@ function closeDialog() {
{{ formatBytes(state.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
{{ formatTimestamp(state.updated_at) }}
Updated: {{ formatTimestamp(state.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
@@ -4,7 +4,7 @@ import RomListItem from "@/components/common/Game/ListItem.vue";
import firmwareApi from "@/services/api/firmware";
import romApi from "@/services/api/rom";
import storeAuth from "@/stores/auth";
import type { DetailedRom } from "@/stores/roms";
import storeRoms, { type DetailedRom } from "@/stores/roms";
import { formatBytes, formatTimestamp, getSupportedEJSCores } from "@/utils";
import { ROUTES } from "@/plugins/router";
import Player from "@/views/Player/EmulatorJS/Player.vue";
@@ -24,6 +24,7 @@ const EMULATORJS_VERSION = "4.2.1";
const { t } = useI18n();
const route = useRoute();
const auth = storeAuth();
const romsStore = storeRoms();
const rom = ref<DetailedRom | null>(null);
const firmwareOptions = ref<FirmwareSchema[]>([]);
const biosRef = ref<FirmwareSchema | null>(null);
@@ -70,6 +71,7 @@ function onFullScreenChange() {
}
async function onlyQuit() {
if (rom.value) romsStore.update(rom.value);
window.history.back();
}
@@ -94,6 +96,7 @@ async function saveAndQuit() {
screenshotFile,
});
romsStore.update(rom.value);
window.history.back();
}
@@ -67,13 +67,18 @@ export async function saveSave({
}): Promise<SaveSchema | null> {
if (save) {
try {
const { data: updateSave } = await saveApi.updateSave({
const { data: updatedSave } = await saveApi.updateSave({
save: save,
saveFile: new File([saveFile], save.file_name, {
type: "application/octet-stream",
}),
});
return updateSave;
// Update the save in the rom object
const index = rom.user_saves.findIndex((s) => s.id === updatedSave.id);
rom.user_saves[index] = updatedSave;
return updatedSave;
} catch (error) {
console.error("Failed to update save", error);
return null;