From 289034d0c8f83c889741ae1a7744ddf0e1d279d4 Mon Sep 17 00:00:00 2001 From: laylafogiel-hash Date: Fri, 7 Nov 2025 00:27:37 +0200 Subject: [PATCH] Add manual release date editor (#262) * add manual release date editor * watch() releaseDate instead of relying on coreMetadata updates * make linter happy --------- Co-authored-by: udifogiel --- components/GameEditor/Metadata.vue | 44 ++++++++++++++++++++++++++++++ i18n/locales/en_us.json | 1 + 2 files changed, 45 insertions(+) diff --git a/components/GameEditor/Metadata.vue b/components/GameEditor/Metadata.vue index 5dfa85f..3ac48ab 100644 --- a/components/GameEditor/Metadata.vue +++ b/components/GameEditor/Metadata.vue @@ -29,6 +29,23 @@
+
+ +
+ +
+
@@ -491,11 +508,38 @@ watch( { deep: true }, ); +const releaseDate = ref( + game.value.mReleased + ? new Date(game.value.mReleased).toISOString().substring(0, 10) + : "", +); + +watch(releaseDate, async (newDate) => { + const body: PatchGameBody = {}; + + if (newDate) { + const parsed = new Date(newDate); + if (!isNaN(parsed.getTime())) { + body.mReleased = parsed; + } + } + + await $dropFetch(`/api/v1/admin/game/:id`, { + method: "PATCH", + params: { + id: game.value.id, + }, + body, + failTitle: "Failed to update release date", + }); +}); + const { t } = useI18n(); // I don't know why I split these fields off. const coreMetadataName = ref(game.value.mName); const coreMetadataDescription = ref(game.value.mShortDescription); + const coreMetadataIconUrl = ref(useObject(game.value.mIconObjectId)); const coreMetadataIconFileUpload = ref(); const coreMetadataLoading = ref(false); diff --git a/i18n/locales/en_us.json b/i18n/locales/en_us.json index 8fecfd5..260e867 100644 --- a/i18n/locales/en_us.json +++ b/i18n/locales/en_us.json @@ -292,6 +292,7 @@ "deleteImage": "Delete image", "editGameDescription": "Game Description", "editGameName": "Game Name", + "editReleaseDate": "Release Date", "imageCarousel": "Image Carousel", "imageCarouselDescription": "Customise what images and what order are shown on the store page.", "imageCarouselEmpty": "No images added to the carousel yet.",