mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
* chore: update prisma to 6.11 more prisma future proofing due to experimental features * chore: update dependencies twemoji - new unicode update argon2 - bux fixes vue3-carousel - improve mobile experiance vue-tsc - more stable * fix: incorrect prisma version in docker Also remove default value for BUILD_DROP_VERSION, that is now handled in nuxt config * fix: no logging in prod * chore: optimize docker builds even more * fix: revert adoption of prisma driverAdapters see: https://github.com/prisma/prisma/issues/27486 * chore: optimize dockerignore some more * Fix `pino-pretty` not being included in build (#135) * Remove `pino` from frontend * Fix for downloads and removing of library source (#136) * fix: downloads and removing library source * fix: linting * Fix max file size of 4GB (update droplet) (#137) * Fix manual metadata import (#138) * chore(deps): bump vue-i18n from 10.0.7 to 10.0.8 (#140) Bumps [vue-i18n](https://github.com/intlify/vue-i18n/tree/HEAD/packages/vue-i18n) from 10.0.7 to 10.0.8. - [Release notes](https://github.com/intlify/vue-i18n/releases) - [Changelog](https://github.com/intlify/vue-i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/intlify/vue-i18n/commits/v10.0.8/packages/vue-i18n) --- updated-dependencies: - dependency-name: vue-i18n dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump @intlify/core from 10.0.7 to 10.0.8 (#139) --- updated-dependencies: - dependency-name: "@intlify/core" dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Small fixes (#141) * fix: save task as Json rather than string * fix: pull objects before creating game in database * fix: strips relative dirs from version information * fix: #132 * fix: lint * fix: news object ids and small tweaks * fix: notification styling errors * fix: lint * fix: build issues by regenerating lockfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: DecDuck <declanahofmeyr@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
180 lines
5.8 KiB
Vue
180 lines
5.8 KiB
Vue
<!-- eslint-disable vue/no-v-html -->
|
|
<template>
|
|
<div v-if="game">
|
|
<div class="grow flex flex-row gap-y-8">
|
|
<div class="grow w-full h-full px-6 py-4 flex flex-col"></div>
|
|
<div
|
|
class="lg:overflow-y-auto lg:border-l lg:border-zinc-800 lg:block lg:inset-y-0 lg:z-50 lg:w-[30vw] flex flex-col gap-y-8 px-6 py-4"
|
|
>
|
|
<!-- version manager -->
|
|
<div>
|
|
<!-- version priority -->
|
|
<div>
|
|
<div class="border-b border-zinc-800 pb-3">
|
|
<div
|
|
class="flex flex-wrap items-center justify-between sm:flex-nowrap"
|
|
>
|
|
<h3
|
|
class="text-base font-semibold font-display leading-6 text-zinc-100"
|
|
>
|
|
{{ $t("library.admin.versionPriority") }}
|
|
|
|
<!-- import games button -->
|
|
|
|
<NuxtLink
|
|
v-if="unimportedVersions !== undefined"
|
|
:href="
|
|
unimportedVersions.length > 0
|
|
? `/admin/library/${game.id}/import`
|
|
: ''
|
|
"
|
|
type="button"
|
|
:class="[
|
|
unimportedVersions.length > 0
|
|
? 'bg-blue-600 hover:bg-blue-700'
|
|
: 'bg-blue-800/50',
|
|
'inline-flex w-fit items-center gap-x-2 rounded-md px-3 py-1 text-sm font-semibold font-display text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600',
|
|
]"
|
|
>
|
|
{{
|
|
unimportedVersions.length > 0
|
|
? $t("library.admin.import.version.import")
|
|
: $t("library.admin.import.version.noVersions")
|
|
}}
|
|
</NuxtLink>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4 text-center w-full text-sm text-zinc-600">
|
|
{{ $t("lowest") }}
|
|
</div>
|
|
<draggable
|
|
:list="game.versions"
|
|
handle=".handle"
|
|
class="mt-2 space-y-4"
|
|
@update="() => updateVersionOrder()"
|
|
>
|
|
<template
|
|
#item="{ element: item }: { element: GameVersionModel }"
|
|
>
|
|
<div
|
|
class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between"
|
|
>
|
|
<div class="text-zinc-100 font-semibold">
|
|
{{ item.versionName }}
|
|
</div>
|
|
<div class="text-zinc-400">
|
|
{{ item.delta ? $t("library.admin.version.delta") : "" }}
|
|
</div>
|
|
<div class="inline-flex items-center gap-x-2">
|
|
<component
|
|
:is="PLATFORM_ICONS[item.platform]"
|
|
class="size-6 text-blue-600"
|
|
/>
|
|
<Bars3Icon
|
|
class="cursor-move w-6 h-6 text-zinc-400 handle"
|
|
/>
|
|
<button @click="() => deleteVersion(item.versionName)">
|
|
<TrashIcon class="w-5 h-5 text-red-600" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</draggable>
|
|
<div
|
|
v-if="game.versions.length == 0"
|
|
class="text-center font-bold text-zinc-400 my-3"
|
|
>
|
|
{{ $t("library.admin.version.noVersionsAdded") }}
|
|
</div>
|
|
<div class="mt-2 text-center w-full text-sm text-zinc-600">
|
|
{{ $t("highest") }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { GameModel, GameVersionModel } from "~/prisma/client/models";
|
|
import { Bars3Icon, TrashIcon } from "@heroicons/vue/24/solid";
|
|
import type { SerializeObject } from "nitropack";
|
|
import type { H3Error } from "h3";
|
|
|
|
definePageMeta({
|
|
layout: "admin",
|
|
});
|
|
|
|
// TODO implement UI for this page
|
|
|
|
defineProps<{ unimportedVersions: string[] }>();
|
|
|
|
const { t } = useI18n();
|
|
|
|
type GameAndVersions = GameModel & { versions: GameVersionModel[] };
|
|
const game = defineModel<SerializeObject<GameAndVersions>>() as Ref<
|
|
SerializeObject<GameAndVersions>
|
|
>;
|
|
if (!game.value)
|
|
throw createError({
|
|
statusCode: 500,
|
|
statusMessage: "Game not provided to editor component",
|
|
});
|
|
|
|
async function updateVersionOrder() {
|
|
try {
|
|
const newVersions = await $dropFetch("/api/v1/admin/game/version", {
|
|
method: "PATCH",
|
|
body: {
|
|
id: game.value.id,
|
|
versions: game.value.versions.map((e) => e.versionName),
|
|
},
|
|
});
|
|
game.value.versions = newVersions;
|
|
} catch (e) {
|
|
createModal(
|
|
ModalType.Notification,
|
|
{
|
|
title: t("errors.version.order.title"),
|
|
description: t("errors.version.order.desc", {
|
|
error: (e as H3Error)?.statusMessage ?? t("errors.unknown"),
|
|
}),
|
|
buttonText: t("close"),
|
|
},
|
|
(e, c) => c(),
|
|
);
|
|
}
|
|
}
|
|
|
|
async function deleteVersion(versionName: string) {
|
|
try {
|
|
await $dropFetch("/api/v1/admin/game/version", {
|
|
method: "DELETE",
|
|
body: {
|
|
id: game.value.id,
|
|
versionName: versionName,
|
|
},
|
|
});
|
|
game.value.versions.splice(
|
|
game.value.versions.findIndex((e) => e.versionName === versionName),
|
|
1,
|
|
);
|
|
} catch (e) {
|
|
createModal(
|
|
ModalType.Notification,
|
|
{
|
|
title: t("errors.version.delete.title"),
|
|
description: t("errors.version.delete.desc", {
|
|
error: (e as H3Error)?.statusMessage ?? t("errors.unknown"),
|
|
}),
|
|
buttonText: t("close"),
|
|
},
|
|
(e, c) => c(),
|
|
);
|
|
}
|
|
}
|
|
</script>
|