Better metadata editing division #79 (#82)

* feat: new dropdown-based editor switching

* feat: tab based switching

* feat: add icon

* fix: lint

* chore: i18n translations

oh boy was this a 'chore'
This commit is contained in:
DecDuck
2025-06-05 14:53:19 +10:00
committed by GitHub
parent 681efe95af
commit 9e929ddf98
21 changed files with 1144 additions and 1226 deletions

View File

@ -1,11 +1,8 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div>
<div
v-if="game && unimportedVersions !== undefined"
class="grow flex flex-col gap-y-8"
>
<div class="grow w-full h-full lg:pr-[30vw] px-6 py-4 flex flex-col">
<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
class="flex flex-col lg:flex-row lg:justify-between items-start lg:items-center gap-2"
>
@ -38,11 +35,10 @@
>
<div class="ml-4 mt-4">
<h3 class="text-base font-semibold text-zinc-100">
Image Carousel
{{ $t("library.admin.game.imageCarousel") }}
</h3>
<p class="mt-1 text-sm text-zinc-400 max-w-lg">
Customise what images and what order are shown on the store
page.
{{ $t("library.admin.game.imageCarouselDescription") }}
</p>
</div>
<div class="ml-4 mt-4 shrink-0">
@ -51,7 +47,7 @@
class="relative inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => (showAddCarouselModal = true)"
>
Add from image library
{{ $t("library.admin.game.addImageCarousel") }}
</button>
</div>
</div>
@ -60,7 +56,7 @@
v-if="game.mImageCarouselObjectIds.length == 0"
class="text-zinc-400 text-center py-8"
>
No images added to the carousel yet.
{{ $t("library.admin.game.imageCarouselEmpty") }}
</div>
<draggable
@ -80,7 +76,7 @@
class="inline-flex items-center gap-x-1.5 rounded-md bg-blue-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => removeImageFromCarousel(element)"
>
Remove image
{{ $t("library.admin.game.removeImageCarousel") }}
</button>
</div>
</div>
@ -98,13 +94,18 @@
>
<div>
<CheckIcon
v-if="descriptionSaving == 0"
v-if="descriptionSaving == DescriptionSavingState.NotLoading"
class="size-5 text-zinc-100"
/>
<div v-else-if="descriptionSaving == 1">
<div
v-else-if="descriptionSaving == DescriptionSavingState.Waiting"
>
<PencilIcon class="animate-pulse size-5 text-zinc-100" />
</div>
<div v-else-if="descriptionSaving == 2" role="status">
<div
v-else-if="descriptionSaving == DescriptionSavingState.Loading"
role="status"
>
<svg
aria-hidden="true"
class="w-5 h-5 text-transparent animate-spin fill-white"
@ -121,7 +122,7 @@
fill="currentFill"
/>
</svg>
<span class="sr-only">Loading...</span>
<span class="sr-only">{{ $t("common.srLoading") }}</span>
</div>
</div>
@ -174,36 +175,8 @@
</div>
</div>
<div
class="lg:overflow-y-auto lg:border-l lg:border-zinc-800 lg:fixed lg:inset-y-0 lg:z-50 lg:w-[30vw] flex flex-col lg:right-0 gap-y-8 px-6 py-4"
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"
>
<!-- toolbar -->
<div class="inline-flex justify-end items-stretch gap-x-4">
<!-- open in library button -->
<NuxtLink
:href="`/admin/library/${game.id}`"
type="button"
class="inline-flex w-fit items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm transition-all duration-200 hover:bg-zinc-700 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-600"
>
Open in Library
<ArrowTopRightOnSquareIcon
class="-mr-0.5 h-7 w-7 p-1"
aria-hidden="true"
/>
</NuxtLink>
<!-- open in store button -->
<NuxtLink
:href="`/store/${game.id}`"
type="button"
class="inline-flex w-fit items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm transition-all duration-200 hover:bg-zinc-700 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-600"
>
Open in Store
<ArrowTopRightOnSquareIcon
class="-mr-0.5 h-7 w-7 p-1"
aria-hidden="true"
/>
</NuxtLink>
</div>
<!-- image library -->
<div>
<div class="border-b border-zinc-800 pb-3">
@ -214,11 +187,10 @@
<h3
class="text-base font-semibold font-display leading-6 text-zinc-100"
>
Image library
{{ $t("library.admin.game.imageLibrary") }}
</h3>
<p class="mt-1 text-sm text-zinc-400 max-w-lg">
Please note all images uploaded are accessible to all users
through browser dev-tools.
{{ $t("library.admin.game.imageLibraryDescription") }}
</p>
</div>
<div class="flex-shrink-0">
@ -227,7 +199,7 @@
class="relative inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => (showUploadModal = true)"
>
Upload
{{ $t("upload") }}
</button>
</div>
</div>
@ -248,7 +220,7 @@
class="inline-flex items-center gap-x-1.5 rounded-md bg-blue-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => updateBannerImage(image)"
>
Set as banner
{{ $t("library.admin.game.setBanner") }}
</button>
<button
v-if="image !== game.mCoverObjectId"
@ -256,14 +228,14 @@
class="inline-flex items-center gap-x-1.5 rounded-md bg-blue-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => updateCoverImage(image)"
>
Set as cover
{{ $t("library.admin.game.setCover") }}
</button>
<button
type="button"
class="inline-flex items-center gap-x-1.5 rounded-md bg-red-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-red-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-red-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600"
@click="() => deleteImage(image)"
>
Delete image
{{ $t("library.admin.game.deleteImage") }}
</button>
</div>
<div
@ -271,17 +243,25 @@
image === game.mBannerObjectId ||
image === game.mCoverObjectId
"
class="absolute bottom-0 left-0 bg-zinc-950/75 text-zinc-100 text-sm font-semibold px-2 py-1 rounded-tr"
class="absolute bottom-0 left-0 flex flex-row gap-x-1 p-1"
>
current
{{
[
image === game.mBannerObjectId ? "banner" : undefined,
image === game.mCoverObjectId ? "cover" : undefined,
]
.filter((e) => e)
.join(" & ")
}}
<span
v-for="[key] of (
[
[
$t('library.admin.game.currentBanner'),
image === game.mBannerObjectId,
],
[
$t('library.admin.game.currentCover'),
image === game.mCoverObjectId,
],
] as const
).filter((e) => e[1])"
:key="key"
class="inline-flex items-center rounded-full bg-blue-900 px-2 py-1 text-xs font-medium text-blue-100"
>{{ key }}</span
>
</div>
</div>
</div>
@ -315,7 +295,7 @@
class="inline-flex items-center gap-x-1.5 rounded-md bg-blue-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => addImageToCarousel(image)"
>
Add
{{ $t("add") }}
</button>
</div>
</div>
@ -323,7 +303,7 @@
v-if="validAddCarouselImages.length == 0"
class="text-zinc-400 col-span-2"
>
No images to add.
{{ $t("library.admin.game.addCarouselNoImages") }}
</div>
</div>
</template>
@ -334,7 +314,7 @@
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-900 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-950 transition-all duration-200 hover:scale-105 hover:shadow-lg active:scale-95 sm:mt-0 sm:w-auto"
@click="showAddCarouselModal = false"
>
Close
{{ $t("close") }}
</button>
</template>
</ModalTemplate>
@ -355,7 +335,7 @@
class="inline-flex items-center gap-x-1.5 rounded-md bg-blue-600 px-1.5 py-0.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => insertImageAtCursor(image)"
>
Insert
{{ $t("insert") }}
</button>
</div>
</div>
@ -363,7 +343,7 @@
v-if="game.mImageLibraryObjectIds.length == 0"
class="text-zinc-400 col-span-2"
>
No images to add.
{{ $t("library.admin.game.addDescriptionNoImages") }}
</div>
</div>
</template>
@ -374,7 +354,7 @@
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-900 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-950 transition-all duration-200 hover:scale-105 hover:shadow-lg active:scale-95 sm:mt-0 sm:w-auto"
@click="showAddCarouselModal = false"
>
Cancel
{{ $t("cancel") }}
</button>
</template>
</ModalTemplate>
@ -389,7 +369,7 @@
type="button"
class="cursor-pointer relative inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
Upload
{{ $t("upload") }}
</span>
<input
id="file-upload"
@ -406,7 +386,7 @@
<label
for="name"
class="block text-sm/6 font-medium text-zinc-100"
>Game Name</label
>{{ $t("library.admin.game.editGameName") }}</label
>
<div class="mt-2">
<input
@ -422,7 +402,7 @@
<label
for="description"
class="block text-sm/6 font-medium text-zinc-100"
>Game Description</label
>{{ $t("library.admin.game.editGameDescription") }}</label
>
<div class="mt-2">
<input
@ -444,7 +424,7 @@
:class="['inline-flex w-full shadow-sm sm:ml-3 sm:w-auto']"
@click="() => coreMetadataUpdate_wrapper()"
>
Save
{{ $t("save") }}
</LoadingButton>
<button
ref="cancelButtonRef"
@ -452,7 +432,7 @@
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-900 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-950 transition-all duration-200 hover:scale-105 hover:shadow-lg active:scale-95 sm:mt-0 sm:w-auto"
@click="showEditCoreMetadata = false"
>
Cancel
{{ $t("cancel") }}
</button>
</template>
</ModalTemplate>
@ -463,12 +443,13 @@
import type { Game } from "~/prisma/client";
import { micromark } from "micromark";
import {
ArrowTopRightOnSquareIcon,
CheckIcon,
DocumentIcon,
PencilIcon,
PhotoIcon,
} from "@heroicons/vue/24/solid";
import type { SerializeObject } from "nitropack";
import type { H3Error } from "h3";
definePageMeta({
layout: "admin",
@ -480,13 +461,16 @@ const showAddImageDescriptionModal = ref(false);
const showEditCoreMetadata = ref(false);
const mobileShowFinalDescription = ref(true);
const route = useRoute();
const gameId = route.params.id.toString();
const { game: rawGame, unimportedVersions } = await $dropFetch(
`/api/v1/admin/game?id=${encodeURIComponent(gameId)}`,
);
const game = ref(rawGame);
const game = defineModel<SerializeObject<Game>>() as Ref<SerializeObject<Game>>;
if (!game.value)
throw createError({
statusCode: 500,
statusMessage: "Game not provided to editor component",
});
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));
@ -495,7 +479,6 @@ const coreMetadataLoading = ref(false);
function coreMetadataUploadFiles(e: InputEvent) {
if (coreMetadataIconUrl.value.startsWith("blob")) {
console.log("freed object URL");
URL.revokeObjectURL(coreMetadataIconUrl.value);
}
@ -506,9 +489,9 @@ function coreMetadataUploadFiles(e: InputEvent) {
createModal(
ModalType.Notification,
{
title: "Failed to upload file",
description: "Drop couldn't upload this file.",
buttonText: "Close",
title: t("errors.upload.title"),
description: t("errors.upload.description", [t("errors.unknown")]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -543,11 +526,11 @@ function coreMetadataUpdate_wrapper() {
createModal(
ModalType.Notification,
{
title: "Failed to update metadata",
description: `Drop failed to update the game's metadata: ${
e?.statusMessage || "An unknown error occurred. "
}`,
buttonText: "Close",
title: t("errors.game.metadata.title"),
description: t("errors.game.metadata.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -569,37 +552,42 @@ const descriptionEditor = ref<HTMLTextAreaElement | undefined>();
// 0 is not loading
// 1 is waiting for stop
// 2 is loading
const descriptionSaving = ref<number>(0);
enum DescriptionSavingState {
NotLoading,
Waiting,
Loading,
}
const descriptionSaving = ref<DescriptionSavingState>(
DescriptionSavingState.NotLoading,
);
let savingTimeout: undefined | NodeJS.Timeout;
type PatchGameBody = Partial<Game>;
watch(descriptionHTML, (_v) => {
console.log(game.value.mDescription);
descriptionSaving.value = 1;
descriptionSaving.value = DescriptionSavingState.Waiting;
if (savingTimeout) clearTimeout(savingTimeout);
savingTimeout = setTimeout(async () => {
try {
descriptionSaving.value = 2;
descriptionSaving.value = DescriptionSavingState.Loading;
await $dropFetch("/api/v1/admin/game", {
method: "PATCH",
body: {
id: gameId,
id: game.value.id,
mDescription: game.value.mDescription,
} satisfies PatchGameBody,
});
descriptionSaving.value = 0;
descriptionSaving.value = DescriptionSavingState.NotLoading;
} catch (e) {
createModal(
ModalType.Notification,
{
title: "Failed to update game description",
description: `Drop failed to update the game description: ${
// @ts-expect-error attempt to get statusMessage on error
e?.statusMessage ?? t("errors.unknown")
}`,
buttonText: "Close",
title: t("errors.game.description.title"),
description: t("errors.game.description.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -630,7 +618,7 @@ async function updateBannerImage(id: string) {
const { mBannerObjectId } = await $dropFetch("/api/v1/admin/game", {
method: "PATCH",
body: {
id: gameId,
id: game.value.id,
mBannerObjectId: id,
} satisfies PatchGameBody,
});
@ -639,12 +627,11 @@ async function updateBannerImage(id: string) {
createModal(
ModalType.Notification,
{
title: "There an error while updating the banner image",
description: `Drop encountered an error while updating the banner image: ${
// @ts-expect-error attempt to get statusMessage on error
e?.statusMessage ?? t("errors.unknown")
}`,
buttonText: "Close",
title: t("errors.game.banner.title"),
description: t("errors.game.banner.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -657,22 +644,20 @@ async function updateCoverImage(id: string) {
const { mCoverObjectId } = await $dropFetch("/api/v1/admin/game", {
method: "PATCH",
body: {
id: gameId,
id: game.value.id,
mCoverObjectId: id,
} satisfies PatchGameBody,
});
game.value.mCoverObjectId = mCoverObjectId;
coreMetadataIconUrl.value = useObject(mCoverObjectId);
} catch (e) {
createModal(
ModalType.Notification,
{
title: "There an error while updating the cover image",
description: `Drop encountered an error while updating the cover image: ${
// @ts-expect-error attempt to get statusMessage on error
e?.statusMessage ?? t("errors.unknown")
}`,
buttonText: "Close",
title: t("errors.game.cover.title"),
description: t("errors.game.cover.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -697,12 +682,11 @@ async function deleteImage(id: string) {
createModal(
ModalType.Notification,
{
title: "There an error while deleting the image",
description: `Drop encountered an error while deleting the image: ${
// @ts-expect-error attempt to get statusMessage on error
e?.statusMessage ?? t("errors.unknown")
}`,
buttonText: "Close",
title: t("errors.game.deleteImage.title"),
description: t("errors.game.deleteImage.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);
@ -732,7 +716,7 @@ async function updateImageCarousel() {
await $dropFetch("/api/v1/admin/game", {
method: "PATCH",
body: {
id: gameId,
id: game.value.id,
mImageCarouselObjectIds: game.value.mImageCarouselObjectIds,
} satisfies PatchGameBody,
});
@ -740,12 +724,11 @@ async function updateImageCarousel() {
createModal(
ModalType.Notification,
{
title: "There an error while updating the image carousel",
description: `Drop encountered an error while updating image carousel: ${
// @ts-expect-error attempt to get statusMessage on error
e?.statusMessage ?? t("errors.unknown")
}`,
buttonText: "Close",
title: t("errors.game.carousel.title"),
description: t("errors.game.carousel.description", [
(e as H3Error)?.statusMessage ?? t("errors.unknown"),
]),
buttonText: t("close"),
},
(e, c) => c(),
);

View File

@ -0,0 +1,177 @@
<!-- 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: GameVersion }">
<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 { Game, GameVersion } from "~/prisma/client";
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 = Game & { versions: GameVersion[] };
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>

View File

@ -25,6 +25,8 @@
"actions": "Actions",
"adminTitle": "Admin Dashboard | Drop",
"adminTitleTemplate": "{0} | Admin | Drop",
"title": "Drop",
"titleTemplate": "{0} | Drop",
"auth": {
"callback": {
"authClient": "Authorize client?",
@ -79,7 +81,9 @@
"noResults": "No results",
"servers": "Servers",
"tags": "Tags",
"today": "Today"
"today": "Today",
"divider": "{'|'}",
"srLoading": "Loading..."
},
"create": "Create",
"delete": "Delete",
@ -149,6 +153,36 @@
"desc": "Drop encountered an error while updating the version: {error}",
"title": "There an error while updating the version order"
}
},
"upload": {
"title": "Failed to upload file",
"description": "Drop couldn't upload the file: {0}"
},
"game": {
"metadata": {
"title": "Failed to update metadata",
"description": "Drop failed to update the game's metadata: {0}"
},
"description": {
"title": "Failed to update game description",
"description": "Drop failed to update the game description: {0}"
},
"banner": {
"title": "Failed to update the banner image",
"description": "Drop failed to update the banner image: {0}"
},
"cover": {
"title": "Failed to update the cover image",
"description": "Drop failed to update the cover image: {0}"
},
"deleteImage": {
"title": "Failed to delete the image",
"description": "Drop failed to delete the image: {0}"
},
"carousel": {
"title": "Failed to update image carousel",
"description": "Drop failed to update the image carousel: {0}"
}
}
},
"footer": {
@ -174,7 +208,6 @@
"header": {
"admin": {
"admin": "Admin",
"meta": "Meta",
"tasks": "Tasks",
"users": "Users"
},
@ -183,6 +216,79 @@
},
"highest": "highest",
"home": "Home",
"users": {
"admin": {
"description": "Manage the users on your Drop instance, and configure your authentication methods.",
"authLink": "Authentication {arrow}",
"displayNameHeader": "Display Name",
"usernameHeader": "Username",
"emailHeader": "Email",
"adminHeader": "Admin?",
"authoptionsHeader": "Auth Options",
"srEditLabel": "Edit",
"adminUserLabel": "Admin user",
"normalUserLabel": "Normal user",
"authentication": {
"title": "Authentication",
"description": "Drop supports a variety of \"authentication mechanisms\". As you enable or disable them, they are shown on the sign in screen for users to select from. Click the dot menu to configure the authentication mechanism.",
"enabledKey": "Enabled?",
"enabled": "Enabled",
"disabled": "Disabled",
"srOpenOptions": "Open options",
"configure": "Configure",
"simple": "Simple (username/password)",
"oidc": "OpenID Connect"
},
"simple": {
"title": "Simple authentication",
"description": "Simple authentication uses a system of 'invitations' to create users. You can create an invitation, and optionally specify a username or email for the user, and then it will generate a magic URL that can be used to create an account.",
"invitationTitle": "invitations",
"createInvitation": "Create invitation",
"noUsernameEnforced": "No username enforced.",
"noEmailEnforced": "No email enforced.",
"adminInvitation": "Admin invitation",
"userInvitation": "User invitation",
"expires": "Expires: {expiry}",
"neverExpires": "Never expires.",
"noInvitations": "No invitations.",
"inviteTitle": "Invite user to Drop",
"inviteDescription": "Drop will generate a URL that you can send to the person you want to invite. You can optionally specify a username or email for them to use.",
"inviteUsernameLabel": "Username (optional)",
"inviteUsernameFormat": "Must be 5 or more characters",
"inviteUsernamePlaceholder": "myUsername",
"inviteEmailLabel": "Email address (optional)",
"inviteEmailDescription": "Must be in the format user{'@'}example.com",
"inviteEmailPlaceholder": "me{'@'}example.com",
"inviteAdminSwitchLabel": "Admin invitation",
"inviteAdminSwitchDescription": "Create this user as an administrator",
"inviteExpiryLabel": "Expires",
"inviteButton": "Invite",
"invite3Days": "3 days",
"inviteWeek": "1 week",
"inviteMonth": "1 month",
"invite6Months": "6 months",
"inviteYear": "1 year",
"inviteNever": "Never"
}
}
},
"library": {
"addGames": "All Games",
"addToLib": "Add to Library",
@ -228,13 +334,36 @@
},
"metadataProvider": "Metadata provider",
"noGames": "No games imported",
"noVersions": "You have no versions of this game available.",
"noVersionsAdded": "no versions added",
"openInMetadata": "Open in Metadata",
"openLibrary": "Open with Library {arrow}",
"openMetadata": "Open with Metadata {arrow}",
"openEditor": "Open in Editor {arrow}",
"openStore": "Open in Store",
"shortDesc": "Short Description",
"version": {
"noVersions": "You have no versions of this game available.",
"noVersionsAdded": "no versions added",
"delta": "Upgrade mode"
},
"game": {
"imageCarousel": "Image Carousel",
"imageCarouselDescription": "Customise what images and what order are shown on the store page.",
"addImageCarousel": "Add from image library",
"imageCarouselEmpty": "No images added to the carousel yet.",
"removeImageCarousel": "Remove image",
"addCarouselNoImages": "No images to add.",
"imageLibrary": "Image library",
"imageLibraryDescription": "Please note all images uploaded are accessible to all users through browser dev-tools.",
"setBanner": "Set as banner",
"setCover": "Set as cover",
"deleteImage": "Delete image",
"currentBanner": "banner",
"currentCover": "cover",
"addDescriptionNoImages": "No images to add.",
"editGameName": "Game Name",
"editGameDescription": "Game Description"
},
"sources": {
"create": "Create source",
"createDesc": "Drop will use this source to access your game library, and make them available.",
@ -310,6 +439,8 @@
},
"options": "Options",
"save": "Save",
"add": "Add",
"insert": "Insert",
"security": "Security",
"settings": "Settings",
"store": {
@ -347,5 +478,10 @@
"settings": "Account settings"
}
},
"task": {
"successful": "Successful!",
"successfulDescription": "\"{0}\" completed successfully"
},
"todo": "Todo",
"welcome": "American, Welcome!"
}

View File

@ -162,7 +162,6 @@ import {
ServerStackIcon,
HomeIcon,
Cog6ToothIcon,
DocumentIcon,
UserGroupIcon,
RectangleStackIcon,
} from "@heroicons/vue/24/outline";
@ -181,12 +180,6 @@ const navigation: Array<NavigationItem & { icon: Component }> = [
prefix: "/admin/library",
icon: ServerStackIcon,
},
{
label: t("header.admin.meta"),
route: "/admin/metadata",
prefix: "/admin/metadata",
icon: DocumentIcon,
},
{
label: t("header.admin.users"),
route: "/admin/users",

View File

@ -15,14 +15,15 @@
const route = useRoute();
const noWrapper = !!route.query.noWrapper;
const { t } = useI18n();
useHead({
htmlAttrs: {
lang: "en",
},
link: [],
titleTemplate(title) {
if (title) return `${title} | Drop`;
return `Drop`;
return title ? t("titleTemplate", [title]) : t("title");
},
});
</script>

View File

@ -64,7 +64,8 @@
"autoprefixer": "^10.4.20",
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.1",
"h3": "^1.15.1",
"h3": "^1.15.3",
"nitropack": "^2.11.12",
"ofetch": "^1.4.1",
"postcss": "^8.4.47",
"prettier": "^3.5.3",

View File

@ -1,4 +1,8 @@
<template>
<!-- go away eslint -->
<div />
<!-- I don't want to localize this -->
<!--
<div>
<div v-if="user" class="mx-auto max-w-2xl lg:mx-0">
<h2
@ -15,7 +19,6 @@
</div>
<div v-if="user" class="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2">
<!-- Account Information Card -->
<div
class="overflow-hidden rounded-xl border border-zinc-800 bg-zinc-900 shadow-sm transition-all duration-200 hover:shadow-lg hover:shadow-zinc-900/50"
>
@ -51,7 +54,6 @@
</div>
</div>
<!-- Account Actions Card -->
<div
class="overflow-hidden rounded-xl border border-zinc-800 bg-zinc-900 shadow-sm transition-all duration-200 hover:shadow-lg hover:shadow-zinc-900/50"
>
@ -78,6 +80,7 @@
<div class="text-zinc-400">Loading account information...</div>
</div>
</div>
-->
</template>
<script setup lang="ts">
@ -88,7 +91,4 @@ definePageMeta({
useHead({
title: "Account",
});
// Fetch user data
const user = await $dropFetch("/api/v1/user");
</script>

View File

@ -1,170 +1,6 @@
<template>
<div v-if="false" class="grid gap-4 lg:grid-cols-3 lg:grid-rows-2">
<div class="relative lg:row-span-2">
<div
class="absolute inset-px rounded-lg bg-zinc-950 lg:rounded-l-[2rem]"
/>
<div
class="relative flex h-full flex-col overflow-hidden rounded-[calc(var(--radius-lg)+1px)] lg:rounded-l-[calc(2rem+1px)]"
>
<div class="px-8 pt-8 pb-3 sm:px-10 sm:py-10">
<p
class="mt-2 text-lg font-medium tracking-tight text-zinc-100 max-lg:text-center"
>
Library
</p>
<p class="mt-2 max-w-lg text-sm/6 text-zinc-400 max-lg:text-center">
Manage your Drop library, and import new games. Your library is the
list of all games currently configured on this instance.
</p>
<p class="mt-3 text-sm">
<NuxtLink
href="/admin/library"
class="whitespace-nowrap font-medium text-blue-400 hover:text-blue-500"
>
Check it out
<span aria-hidden="true"> &rarr;</span>
</NuxtLink>
</p>
<div v-if="toImport" class="mt-2 rounded-md bg-blue-600/10 p-4">
<div class="flex">
<div class="flex-shrink-0">
<InformationCircleIcon
class="h-5 w-5 text-blue-400"
aria-hidden="true"
/>
</div>
<div class="ml-3 flex-1 md:flex md:justify-between">
<p class="text-sm text-blue-400">
Drop has detected you have new games to import.
</p>
<p class="mt-3 text-sm md:ml-6 md:mt-0">
<NuxtLink
href="/admin/library/import"
class="whitespace-nowrap font-medium text-blue-400 hover:text-blue-500"
>
Import
<span aria-hidden="true"> &rarr;</span>
</NuxtLink>
</p>
</div>
</div>
</div>
</div>
</div>
<div
class="pointer-events-none absolute inset-px rounded-lg ring-1 shadow-sm ring-black/5 lg:rounded-l-[2rem]"
/>
</div>
<div class="relative max-lg:row-start-1">
<div
class="absolute inset-px rounded-lg bg-zinc-950 max-lg:rounded-t-[2rem]"
/>
<div
class="relative flex h-full flex-col overflow-hidden rounded-[calc(var(--radius-lg)+1px)] max-lg:rounded-t-[calc(2rem+1px)]"
>
<div class="px-8 py-8 sm:px-10 sm:py-10">
<p
class="mt-2 text-lg font-medium tracking-tight text-zinc-100 max-lg:text-center"
>
Users
</p>
<p class="mt-2 max-w-lg text-sm/6 text-zinc-400 max-lg:text-center">
Your users are people who can access your Drop instance, download
games from it, and configure API keys for it.
</p>
<p class="mt-3 text-sm">
<NuxtLink
href="/admin/users"
class="whitespace-nowrap font-medium text-blue-400 hover:text-blue-500"
>
Check it out
<span aria-hidden="true"> &rarr;</span>
</NuxtLink>
</p>
</div>
</div>
<div
class="pointer-events-none absolute inset-px rounded-lg ring-1 shadow-sm ring-black/5 max-lg:rounded-t-[2rem]"
/>
</div>
<div class="relative max-lg:row-start-3 lg:col-start-2 lg:row-start-2">
<div class="absolute inset-px rounded-lg bg-white" />
<div
class="relative flex h-full flex-col overflow-hidden rounded-[calc(var(--radius-lg)+1px)]"
>
<div class="px-8 pt-8 sm:px-10 sm:pt-10">
<p
class="mt-2 text-lg font-medium tracking-tight text-gray-950 max-lg:text-center"
>
Security
</p>
<p class="mt-2 max-w-lg text-sm/6 text-gray-600 max-lg:text-center">
Morbi viverra dui mi arcu sed. Tellus semper adipiscing suspendisse
semper morbi.
</p>
</div>
<div class="@container flex flex-1 items-center max-lg:py-6 lg:pb-2">
<img
class="h-[min(152px,40cqw)] object-cover"
src="https://tailwindcss.com/plus-assets/img/component-images/bento-03-security.png"
alt=""
/>
</div>
</div>
<div
class="pointer-events-none absolute inset-px rounded-lg ring-1 shadow-sm ring-black/5"
/>
</div>
<div class="relative lg:row-span-2">
<div
class="absolute inset-px rounded-lg bg-white max-lg:rounded-b-[2rem] lg:rounded-r-[2rem]"
/>
<div
class="relative flex h-full flex-col overflow-hidden rounded-[calc(var(--radius-lg)+1px)] max-lg:rounded-b-[calc(2rem+1px)] lg:rounded-r-[calc(2rem+1px)]"
>
<div class="px-8 pt-8 pb-3 sm:px-10 sm:pt-10 sm:pb-0">
<p
class="mt-2 text-lg font-medium tracking-tight text-gray-950 max-lg:text-center"
>
Powerful APIs
</p>
<p class="mt-2 max-w-lg text-sm/6 text-gray-600 max-lg:text-center">
Sit quis amet rutrum tellus ullamcorper ultricies libero dolor eget
sem sodales gravida.
</p>
</div>
<div class="relative min-h-[30rem] w-full grow">
<div
class="absolute top-10 right-0 bottom-0 left-10 overflow-hidden rounded-tl-xl bg-gray-900 shadow-2xl"
>
<div class="flex bg-gray-800/40 ring-1 ring-white/5">
<div class="-mb-px flex text-sm/6 font-medium text-gray-400">
<div
class="border-r border-b border-r-white/10 border-b-white/20 bg-white/5 px-4 py-2 text-white"
>
NotificationSetting.jsx
</div>
<div class="border-r border-gray-600/10 px-4 py-2">App.jsx</div>
</div>
</div>
<div class="px-6 pt-6 pb-14">
<!-- Your code example -->
</div>
</div>
</div>
</div>
<div
class="pointer-events-none absolute inset-px rounded-lg ring-1 shadow-sm ring-black/5 max-lg:rounded-b-[2rem] lg:rounded-r-[2rem]"
/>
</div>
</div>
</template>
<template><div /></template>
<script setup lang="ts">
import { InformationCircleIcon } from "@heroicons/vue/24/solid";
definePageMeta({
layout: "admin",
});
@ -172,7 +8,4 @@ definePageMeta({
useHead({
title: "Home",
});
const libraryState = await $dropFetch("/api/v1/admin/library");
const toImport = Object.entries(libraryState.unimportedGames).length > 0;
</script>

View File

@ -1,163 +1,132 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div>
<div
class="pt-8 lg:pt-0 lg:pl-20 fixed inset-0 flex flex-col overflow-auto bg-zinc-900"
>
<div
v-if="game && unimportedVersions !== undefined"
class="grow flex flex-col gap-y-8"
class="bg-zinc-950 w-full flex flex-col sm:flex-row items-center gap-2 justify-between pr-2"
>
<div class="grow w-full h-full lg:pr-[30vw] px-6 py-4 flex flex-col">
<div
v-if="game.versions.length === 0"
class="flex flex-col items-center justify-center h-full text-zinc-400"
>
<InformationCircleIcon class="w-12 h-12 mb-2 text-zinc-400" />
<div class="font-semibold text-lg">No versions yet</div>
<div class="text-sm mt-1">
Import your first version to get started!
</div>
</div>
</div>
<div
class="lg:overflow-y-auto lg:border-l lg:border-zinc-800 lg:fixed lg:inset-y-0 lg:z-50 lg:w-[30vw] flex flex-col lg:right-0 gap-y-8 px-6 py-4"
>
<!-- toolbar -->
<div class="inline-flex justify-end items-stretch gap-x-4">
<!-- open in library button -->
<NuxtLink
:href="`/admin/metadata/games/${game.id}`"
type="button"
class="inline-flex w-fit items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm transition-all duration-200 hover:bg-zinc-700 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
{{ $t("library.admin.openInMetadata") }}
<ArrowTopRightOnSquareIcon
class="-mr-0.5 h-7 w-7 p-1"
aria-hidden="true"
/>
</NuxtLink>
<!-- open in store button -->
<NuxtLink
:href="`/store/${game.id}`"
type="button"
class="inline-flex w-fit items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm transition-all duration-200 hover:bg-zinc-700 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
{{ $t("library.admin.openStore") }}
<ArrowTopRightOnSquareIcon
class="-mr-0.5 h-7 w-7 p-1"
aria-hidden="true"
/>
</NuxtLink>
</div>
<!--start-->
<div>
<Listbox v-if="false" v-model="currentMode" as="div">
<div class="relative mt-2">
<ListboxButton
class="min-w-[10vw] w-full cursor-default inline-flex items-center gap-x-2 rounded-md bg-zinc-900 py-1.5 pr-2 pl-3 text-left text-zinc-200 outline-1 -outline-offset-1 outline-zinc-700 focus:outline-2 focus:-outline-offset-2 focus:outline-blue-600 sm:text-sm/6"
>
<span class="col-start-1 row-start-1 truncate">{{
currentMode
}}</span>
<!-- 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"
<PencilIcon class="ml-auto size-5" />
<ChevronUpDownIcon
class="text-gray-500 size-5"
aria-hidden="true"
/>
</ListboxButton>
<transition
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-zinc-900 py-1 text-base shadow-lg ring-1 ring-white/5 focus:outline-hidden sm:text-sm"
>
<h3
class="text-base font-semibold font-display leading-6 text-zinc-100"
<ListboxOption
v-for="[value] in Object.entries(components)"
v-slot="{ active, selected }"
:key="value"
as="template"
:value="value"
>
{{ $t("library.admin.versionPriority") }}
<!-- import games button -->
<NuxtLink
v-if="unimportedVersions !== undefined"
:href="
unimportedVersions.length > 0
? `/admin/library/${game.id}/import`
: ''
"
type="button"
<li
: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',
active
? 'bg-blue-600 text-white outline-hidden'
: 'text-zinc-100',
'relative cursor-default py-2 pr-9 pl-3 select-none',
]"
>
{{
unimportedVersions.length > 0
? $t("library.admin.import.version.import")
: $t("library.admin.import.version.noVersions")
}}
</NuxtLink>
</h3>
</div>
</div>
<span
:class="[
selected ? 'font-semibold' : 'font-normal',
'block truncate',
]"
>{{ value }}</span
>
<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()"
<span
v-if="selected"
class="text-white absolute inset-y-0 right-0 flex items-center pr-4"
>
<PencilIcon class="size-5" aria-hidden="true" />
</span>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
<div class="pt-4 inline-flex gap-x-2">
<div
v-for="[value, { icon }] in Object.entries(components)"
:key="value"
>
<button
:class="[
'inline-flex items-center gap-x-1 py-2 px-3 rounded-t-md font-semibold text-sm',
value == currentMode
? 'bg-zinc-900 text-zinc-100'
: 'bg-transparent text-zinc-500',
]"
@click="() => (currentMode = value as GameEditorMode)"
>
<template #item="{ element: item }: { element: GameVersion }">
<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.import.version.updateMode")
: ""
}}
</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.noVersionsAdded") }}
</div>
<div class="mt-2 text-center w-full text-sm text-zinc-600">
{{ $t("highest") }}
</div>
<component :is="icon" class="size-4" />
{{ value }}
</button>
</div>
</div>
</div>
<div>
<!-- open in store button -->
<NuxtLink
:href="`/store/${game.id}`"
type="button"
class="inline-flex w-fit items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm hover:bg-zinc-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
{{ $t("library.admin.openStore") }}
<ArrowTopRightOnSquareIcon
class="-mr-0.5 h-7 w-7 p-1"
aria-hidden="true"
/>
</NuxtLink>
</div>
</div>
<component
:is="components[currentMode].editor"
v-model="game"
:unimported-versions="unimportedVersions"
/>
</div>
</template>
<script setup lang="ts">
import type { GameVersion } from "~/prisma/client";
import {
Listbox,
ListboxButton,
ListboxOption,
ListboxOptions,
} from "@headlessui/vue";
import { ChevronUpDownIcon } from "@heroicons/vue/16/solid";
import { GameEditorMetadata, GameEditorVersion } from "#components";
import {
ArrowTopRightOnSquareIcon,
Bars3Icon,
TrashIcon,
InformationCircleIcon,
} from "@heroicons/vue/24/solid";
definePageMeta({
layout: "admin",
});
const { t } = useI18n();
// TODO implement UI for this
DocumentIcon,
PencilIcon,
ServerStackIcon,
} from "@heroicons/vue/24/outline";
import type { Component } from "vue";
const route = useRoute();
const gameId = route.params.id.toString();
@ -166,58 +135,29 @@ const { game: rawGame, unimportedVersions } = await $dropFetch(
);
const game = ref(rawGame);
async function updateVersionOrder() {
try {
const newVersions = await $dropFetch("/api/v1/admin/game/version", {
method: "PATCH",
body: {
id: gameId,
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", {
// @ts-expect-error attempt to get statusMessage on error
error: e?.statusMessage ?? t("errors.unknown"),
}),
buttonText: t("close"),
},
(e, c) => c(),
);
}
definePageMeta({
layout: "admin",
});
useHead({
// To do a title with the game name in it, we need some sort of watch
title: "Game Editor",
});
enum GameEditorMode {
Metadata = "Metadata",
Versions = "Versions",
}
async function deleteVersion(versionName: string) {
try {
await $dropFetch("/api/v1/admin/game/version", {
method: "DELETE",
body: {
id: gameId,
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", {
// @ts-expect-error attempt to get statusMessage on error
error: e?.statusMessage ?? t("errors.unknown"),
}),
buttonText: t("close"),
},
(e, c) => c(),
);
}
}
const components: {
[key in GameEditorMode]: { editor: Component; icon: Component };
} = {
[GameEditorMode.Metadata]: { editor: GameEditorMetadata, icon: DocumentIcon },
[GameEditorMode.Versions]: {
editor: GameEditorVersion,
icon: ServerStackIcon,
},
};
const currentMode = ref<GameEditorMode>(GameEditorMode.Metadata);
</script>

View File

@ -98,19 +98,13 @@
<div class="mt-4 flex flex-col gap-y-1">
<NuxtLink
:href="`/admin/library/${game.id}`"
class="w-fit rounded-md bg-blue-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm transition-all duration-200 hover:bg-blue-500 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
class="w-fit rounded-md bg-zinc-800 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-zinc-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
<i18n-t keypath="library.admin.openLibrary" tag="span">
<template #arrow>
<span aria-hidden="true">{{ $t("chars.arrow") }}</span>
</template>
</i18n-t>
</NuxtLink>
<NuxtLink
:href="`/admin/metadata/games/${game.id}`"
class="w-fit rounded-md bg-zinc-800 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm transition-all duration-200 hover:bg-zinc-700 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-600"
>
<i18n-t keypath="library.admin.openMetadata" tag="span">
<i18n-t
keypath="library.admin.openEditor"
tag="span"
scope="global"
>
<template #arrow>
<span aria-hidden="true">{{ $t("chars.arrow") }}</span>
</template>
@ -169,7 +163,7 @@
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-yellow-600">
{{ $t("library.admin.noVersions") }}
{{ $t("library.admin.version.noVersions") }}
</h3>
</div>
</div>

View File

@ -1,122 +0,0 @@
<template>
<div class="space-y-4">
<div class="mx-auto max-w-2xl lg:mx-0">
<h2
class="mt-2 text-xl font-semibold tracking-tight text-zinc-100 sm:text-3xl"
>
Metadata Library
</h2>
<p
class="mt-2 text-pretty text-sm font-medium text-gray-500 sm:text-md/8"
>
<span class="text-zinc-100 font-bold"
>To import or delete games, visit the Library tab.</span
>
Here, you can edit and update your game's metadata.
</p>
</div>
<div class="mt-2 grid grid-cols-1">
<input
id="search"
v-model="searchQuery"
type="text"
name="search"
class="col-start-1 row-start-1 block w-full rounded-md bg-zinc-900 py-1.5 pl-10 pr-3 text-base text-zinc-100 outline outline-1 -outline-offset-1 outline-zinc-700 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-blue-600 sm:pl-9 sm:text-sm/6"
placeholder="Search library..."
/>
<MagnifyingGlassIcon
class="pointer-events-none col-start-1 row-start-1 ml-3 size-5 self-center text-zinc-400 sm:size-4"
aria-hidden="true"
/>
</div>
<ul
role="list"
class="grid grid-cols-1 gap-6 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4"
>
<li
v-for="game in filteredLibraryGames"
:key="game.id"
class="col-span-1 flex flex-col justify-center divide-y divide-zinc-700 rounded-lg bg-zinc-950/20 text-left shadow"
>
<div class="flex flex-1 flex-row p-4 gap-x-4">
<img
class="h-16 w-16 flex-shrink-0 rounded-md"
:src="useObject(game.mIconObjectId)"
alt=""
/>
<div class="flex flex-col">
<h3 class="text-sm font-medium text-zinc-100 font-display">
{{ game.mName }}
<span
class="ml-2 inline-flex items-center rounded-full bg-blue-600/10 px-2 py-1 text-xs font-medium text-blue-600 ring-1 ring-inset ring-blue-600/20"
>{{ game.metadataSource }}</span
>
</h3>
<dl class="mt-1 flex flex-col justify-between">
<dt class="sr-only">Short Description</dt>
<dd class="text-sm text-zinc-400">
{{ game.mShortDescription }}
</dd>
<dt class="sr-only">Metadata provider</dt>
</dl>
<div class="mt-4 flex flex-col gap-y-1">
<NuxtLink
:href="`/admin/metadata/games/${game.id}`"
class="w-fit rounded-md bg-blue-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
Open with Metadata &rarr;
</NuxtLink>
<NuxtLink
:href="`/admin/library/${game.id}`"
class="w-fit rounded-md bg-zinc-800 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-zinc-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
Open with Library &rarr;
</NuxtLink>
</div>
</div>
</div>
</li>
<p
v-if="filteredLibraryGames.length == 0 && libraryGames.length != 0"
class="text-zinc-600 text-sm font-display font-bold uppercase text-center col-span-4"
>
No results
</p>
<p
v-if="filteredLibraryGames.length == 0 && libraryGames.length == 0"
class="text-zinc-600 text-sm font-display font-bold uppercase text-center col-span-4"
>
No games imported
</p>
</ul>
</div>
</template>
<script setup lang="ts">
import { MagnifyingGlassIcon } from "@heroicons/vue/24/outline";
definePageMeta({
layout: "admin",
});
useHead({
title: "Game Library | Metadata",
});
const searchQuery = ref("");
const libraryState = await $dropFetch("/api/v1/admin/library");
const libraryGames = ref(libraryState.games.map((e) => e.game));
const filteredLibraryGames = computed(() =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore excessively deep ts
libraryGames.value.filter((e) => {
if (!searchQuery.value) return true;
const searchQueryLower = searchQuery.value.toLowerCase();
if (e.mName.toLowerCase().includes(searchQueryLower)) return true;
if (e.mShortDescription.toLowerCase().includes(searchQueryLower))
return true;
return false;
}),
);
</script>

View File

@ -1,60 +0,0 @@
<template>
<div class="space-y-4">
<div class="mx-auto max-w-2xl lg:mx-0">
<h2
class="mt-2 text-xl font-semibold tracking-tight text-zinc-100 sm:text-3xl"
>
Metadata
</h2>
<p
class="mt-2 text-pretty text-sm font-medium text-gray-500 sm:text-md/8"
>
Manage the metadata of your library, and update relationships between
them. Users will be able to search through this metadata to find the
games they want.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-5 gap-8">
<NuxtLink
to="/admin/metadata/games"
class="transition group aspect-[3/2] flex flex-col justify-center items-center rounded-lg bg-zinc-950 hover:bg-zinc-950/50 shadow"
>
<RectangleStackIcon
class="mb-2 h-12 w-12 text-zinc-500 group-hover:text-blue-500 transition-all duration-200"
/>
<span
class="transition-all text-4xl font-bold text-zinc-400 group-hover:text-zinc-100 uppercase tracking-widest"
>Games</span
>
</NuxtLink>
<NuxtLink
to="/admin/metadata/companies"
class="transition group aspect-[3/2] flex flex-col justify-center items-center rounded-lg bg-zinc-950 hover:bg-zinc-950/50 shadow"
>
<BuildingOffice2Icon
class="mb-2 h-12 w-12 text-zinc-500 group-hover:text-blue-500 transition-all duration-200"
/>
<span
class="transition-all text-4xl font-bold text-zinc-400 group-hover:text-zinc-100 uppercase tracking-widest"
>Companies</span
>
</NuxtLink>
</div>
</div>
</template>
<script setup lang="ts">
import {
RectangleStackIcon,
BuildingOffice2Icon,
} from "@heroicons/vue/24/solid";
definePageMeta({
layout: "admin",
});
useHead({
title: "Metadata",
});
</script>

View File

@ -1,5 +1,5 @@
<template>
<div class="text-gray-100">Todo page</div>
<div class="text-gray-100">{{ $t("todo") }}</div>
</template>
<script lang="ts" setup>
useHead({

View File

@ -7,11 +7,11 @@
<CheckCircleIcon class="h-12 w-12 text-green-600" aria-hidden="true" />
<div class="mt-3 text-center sm:mt-5">
<h1 class="text-3xl font-semibold font-display leading-6 text-zinc-100">
Successful!
{{ $t("task.successful") }}
</h1>
<div class="mt-4">
<p class="text-sm text-zinc-400 max-w-md">
"{{ task.name }}" completed successfully.
{{ $t("task.successfulDescription", [task.name]) }}
</p>
</div>
</div>
@ -74,7 +74,7 @@
fill="currentFill"
/>
</svg>
<span class="sr-only">Loading...</span>
<span class="sr-only">{{ $t("common.srLoading") }}</span>
</div>
</template>

View File

@ -1,5 +1,5 @@
<template>
<div class="text-gray-100">Todo page</div>
<div class="text-gray-100">{{ $t("todo") }}</div>
</template>
<script lang="ts" setup>
useHead({

View File

@ -4,14 +4,12 @@
<h2
class="mt-2 text-xl font-semibold tracking-tight text-zinc-100 sm:text-3xl"
>
Authentication
{{ $t("users.admin.authentication.title") }}
</h2>
<p
class="mt-2 text-pretty text-sm font-medium text-zinc-400 sm:text-md/8"
>
Drop supports a variety of "authentication mechanisms". As you enable or
disable them, they are shown on the sign in screen for users to select
from. Click the dot menu to configure the authentication mechanism.
{{ $t("users.admin.authentication.description") }}
</p>
</div>
<ul
@ -40,7 +38,9 @@
<MenuButton
class="-m-2.5 block p-2.5 text-zinc-400 hover:text-zinc-300 transition-colors duration-200"
>
<span class="sr-only">Open options</span>
<span class="sr-only">{{
$t("users.admin.authentication.srOpenOptions")
}}</span>
<EllipsisHorizontalIcon class="h-5 w-5" aria-hidden="true" />
</MenuButton>
<transition
@ -61,9 +61,8 @@
active ? 'bg-zinc-800 outline-none' : '',
'block px-3 py-1 text-sm/6 text-zinc-100 transition-colors duration-200',
]"
>Configure<span class="sr-only"
>, {{ authMech.name }}</span
></NuxtLink
>{{ $t("users.admin.authentication.configure")
}}<span class="sr-only">{{ authMech.name }}</span></NuxtLink
>
</MenuItem>
</MenuItems>
@ -72,7 +71,9 @@
</div>
<dl class="-my-3 divide-y divide-zinc-700 px-6 py-4 text-sm/6">
<div class="flex justify-between gap-x-4 py-3">
<dt class="text-zinc-400">Enabled</dt>
<dt class="text-zinc-400">
{{ $t("users.admin.authentication.enabledKey") }}
</dt>
<dd class="flex items-center">
<span
:class="[
@ -84,7 +85,11 @@
>
<CheckIcon v-if="authMech.enabled" class="w-4 h-4 mr-1" />
<XMarkIcon v-else class="w-4 h-4 mr-1" />
{{ authMech.enabled ? "Enabled" : "Disabled" }}
{{
authMech.enabled
? $t("users.admin.authentication.enabled")
: $t("users.admin.authentication.disabled")
}}
</span>
</dd>
</div>
@ -122,6 +127,8 @@ definePageMeta({
layout: "admin",
});
const { t } = useI18n();
const enabledMechanisms = await $dropFetch("/api/v1/admin/auth");
const authenticationMechanisms: Array<{
@ -133,13 +140,13 @@ const authenticationMechanisms: Array<{
settings?: { [key: string]: string | undefined } | undefined | boolean;
}> = [
{
name: "Simple (username/password)",
name: t("users.admin.authentication.simple"),
mec: "Simple" as AuthMec,
icon: IconsSimpleAuthenticationLogo,
route: "/admin/users/auth/simple",
},
{
name: "OpenID Connect",
name: t("users.admin.authentication.oidc"),
mec: "OpenID" as AuthMec,
icon: IconsSSOLogo,
},

View File

@ -4,15 +4,12 @@
<h2
class="mt-2 text-xl font-semibold tracking-tight text-zinc-100 sm:text-3xl"
>
Simple authentication
{{ $t("users.admin.simple.title") }}
</h2>
<p
class="mt-2 text-pretty text-sm font-medium text-zinc-400 sm:text-md/8"
>
Simple authentication uses a system of 'invitations' to create users.
You can create an invitation, and optionally specify a username or email
for the user, and then it will generate a magic URL that can be used to
create an account.
{{ $t("users.admin.simple.description") }}
</p>
</div>
@ -22,7 +19,9 @@
class="-mt-2 flex flex-wrap items-center justify-between sm:flex-nowrap"
>
<div class="mt-2">
<h3 class="text-base font-semibold text-zinc-100">Invitations</h3>
<h3 class="text-base font-semibold text-zinc-100">
{{ $t("users.admin.simple.invitationTitle") }}
</h3>
</div>
<div class="ml-4 mt-2 shrink-0">
<button
@ -30,7 +29,7 @@
class="relative inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm transition-all duration-200 hover:bg-blue-500 hover:scale-105 hover:shadow-lg hover:shadow-blue-500/25 active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
@click="() => (createModalOpen = true)"
>
Create invitation
{{ $t("users.admin.simple.createInvitation") }}
</button>
</div>
</div>
@ -54,9 +53,14 @@
</div>
<p class="mt-1 flex text-xs/5 text-gray-500">
{{ invitation.username ?? "No username enforced." }}
|
{{ invitation.email ?? "No email enforced." }}
{{
invitation.username ??
$t("users.admin.simple.noUsernameEnforced")
}}
{{ $t("common.divider") }}
{{
invitation.email ?? $t("users.admin.simple.noEmailEnforced")
}}
</p>
</div>
</div>
@ -64,14 +68,29 @@
<div class="hidden sm:flex sm:flex-col sm:items-end">
<p class="text-sm/6 text-zinc-100">
{{
invitation.isAdmin ? "Admin invitation" : "User invitation"
invitation.isAdmin
? $t("users.admin.simple.adminInvitation")
: $t("users.admin.simple.userInvitation")
}}
</p>
<p class="mt-1 text-xs/5 text-gray-500">
Expires:
<time :datetime="invitation.expires">{{
new Date(invitation.expires).toLocaleString()
}}</time>
<p class="mt-1 text-sm text-gray-500">
<!-- forever is relative, right? -->
<i18n-t
v-if="
new Date(invitation.expires).getTime() - Date.now() <
3.156e12 // 100 years
"
keypath="users.admin.simple.expires"
tag="span"
scope="global"
>
<template #expiry>
<RelativeTime :date="invitation.expires" />
</template>
</i18n-t>
<span v-else>
{{ $t("users.admin.simple.neverExpires") }}
</span>
</p>
</div>
<button @click="() => deleteInvitation(invitation.id)">
@ -85,7 +104,7 @@
</ul>
<div v-if="invitations.length == 0" class="py-4 text-zinc-400 text-sm">
No invitations.
{{ $t("users.admin.simple.noInvitations") }}
</div>
</div>
@ -128,13 +147,11 @@
<DialogTitle
as="h3"
class="text-base font-semibold text-zinc-100"
>Invite user to Drop
>{{ $t("users.admin.simple.inviteTitle") }}
</DialogTitle>
<div class="mt-2">
<p class="text-sm text-zinc-400">
Drop will generate a URL that you can send to the
person you want to invite. You can optionally specify
a username or email for them to use.
{{ $t("users.admin.simple.inviteDescription") }}
</p>
</div>
</div>
@ -145,7 +162,9 @@
<label
for="username"
class="block text-sm font-medium leading-6 text-zinc-100"
>Username (optional)</label
>{{
$t("users.admin.simple.inviteUsernameLabel")
}}</label
>
<p
:class="[
@ -153,7 +172,7 @@
'block text-xs font-medium leading-6',
]"
>
Must be 5 or more characters
{{ $t("users.admin.simple.inviteUsernameFormat") }}
</p>
<div class="mt-2">
<input
@ -162,7 +181,9 @@
name="invite-username"
type="text"
autocomplete="username"
placeholder="myUsername"
:placeholder="
$t('users.admin.simple.inviteUsernamePlaceholder')
"
class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
/>
</div>
@ -172,7 +193,7 @@
<label
for="email"
class="block text-sm font-medium leading-6 text-zinc-100"
>Email address (optional)</label
>{{ $t("users.admin.simple.inviteEmailLabel") }}</label
>
<p
:class="[
@ -180,7 +201,7 @@
'block text-xs font-medium leading-6',
]"
>
Must be in the format user@example.com
{{ $t("users.admin.simple.inviteEmailDescription") }}
</p>
<div class="mt-2">
<input
@ -189,7 +210,9 @@
name="invite-email"
type="email"
autocomplete="email"
placeholder="me@example.com"
:placeholder="
$t('users.admin.simple.inviteEmailPlaceholder')
"
class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
/>
</div>
@ -205,13 +228,18 @@
as="span"
class="text-sm/6 font-medium text-zinc-100"
passive
>Admin invitation
>{{
$t("users.admin.simple.inviteAdminSwitchLabel")
}}
</SwitchLabel>
<SwitchDescription
as="span"
class="text-sm text-zinc-400"
>Create this user as an
administrator</SwitchDescription
>{{
$t(
"users.admin.simple.inviteAdminSwitchDescription",
)
}}</SwitchDescription
>
</span>
<Switch
@ -236,7 +264,9 @@
<Listbox v-model="expiryKey" as="div">
<ListboxLabel
class="block text-sm/6 font-medium text-zinc-100"
>Expires in</ListboxLabel
>{{
$t("users.admin.simple.inviteExpiryLabel")
}}</ListboxLabel
>
<div class="relative mt-2">
<ListboxButton
@ -331,7 +361,7 @@
type="submit"
class="w-full sm:w-fit"
>
Invite
{{ $t("users.admin.simple.inviteButton") }}
</LoadingButton>
<button
ref="cancelButtonRef"
@ -339,7 +369,7 @@
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
@click="createModalOpen = false"
>
Cancel
{{ $t("cancel") }}
</button>
</div>
</form>
@ -374,6 +404,8 @@ import type { SerializeObject } from "nitropack";
import type { DurationLike } from "luxon";
import { DateTime } from "luxon";
const { t } = useI18n();
definePageMeta({
layout: "admin",
});
@ -431,23 +463,23 @@ const isAdmin = ref(false);
// Label to parameters to moment.js .add()
const expiry: Record<string, DurationLike> = {
"3 days": {
[t("users.admin.simple.invite3Days")]: {
days: 3,
},
"7 days": {
[t("users.admin.simple.inviteWeek")]: {
days: 7,
},
"1 month": {
[t("users.admin.simple.inviteMonth")]: {
month: 1,
},
"6 months": {
[t("users.admin.simple.invite6Months")]: {
months: 6,
},
"1 year": {
[t("users.admin.simple.inviteYear")]: {
year: 1,
},
Never: {
year: 3000,
[t("users.admin.simple.inviteNever")]: {
year: 5000,
}, // Never is relative, right?
};
const expiryKey = ref<keyof typeof expiry>(Object.keys(expiry)[0]); // Cast to any because we just know it's okay
@ -485,7 +517,7 @@ function invite_wrapper() {
invitationUrls.value?.push(generateInvitationUrl(invitation.id));
})
.catch((response) => {
const message = response.statusMessage || "An unknown error occurred";
const message = response.statusMessage || t("errors.unknown");
error.value = message;
})
.finally(() => {

View File

@ -6,8 +6,7 @@
{{ $t("header.admin.users") }}
</h1>
<p class="mt-2 text-sm text-zinc-400">
Manage the users on your Drop instance, and configure your
authentication methods.
{{ $t("users.admin.description") }}
</p>
</div>
<div class="mt-4 sm:ml-16 sm:mt-0 sm:flex-none">
@ -15,7 +14,11 @@
to="/admin/users/auth"
class="block rounded-md bg-blue-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm transition-all duration-200 hover:bg-blue-500 hover:scale-105 hover:shadow-lg active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
Authentication &rarr;
<i18n-t keypath="users.admin.authLink" tag="span" scope="global">
<template #arrow>
<span aria-hidden="true">{{ $t("chars.arrow") }}</span>
</template>
</i18n-t>
</NuxtLink>
</div>
</div>
@ -32,34 +35,36 @@
scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-zinc-100 sm:pl-6"
>
Display Name
{{ $t("users.admin.displayNameHeader") }}
</th>
<th
scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-zinc-100"
>
Username
{{ $t("users.admin.usernameHeader") }}
</th>
<th
scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-zinc-100"
>
Email
{{ $t("users.admin.emailHeader") }}
</th>
<th
scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-zinc-100"
>
Admin?
{{ $t("users.admin.adminHeader") }}
</th>
<th
scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-zinc-100"
>
Auth Options
{{ $t("users.admin.authoptionsHeader") }}
</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
<span class="sr-only">Edit</span>
<span class="sr-only">
{{ $t("users.admin.srEditLabel") }}
</span>
</th>
</tr>
</thead>
@ -89,7 +94,11 @@
: 'bg-zinc-400/10 text-zinc-400 ring-zinc-400/20',
]"
>
{{ user.admin ? "Admin User" : "Normal user" }}
{{
user.admin
? $t("users.admin.adminUserLabel")
: $t("users.admin.normalUserLabel")
}}
</span>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-zinc-400">

View File

@ -1,5 +1,5 @@
<template>
<div class="text-gray-100">Todo page</div>
<div class="text-gray-100">{{ $t("todo") }}</div>
</template>
<script lang="ts" setup>
useHead({

View File

@ -1,5 +1,6 @@
import aclManager from "~/server/internal/acls";
import prisma from "~/server/internal/db/database";
import taskHandler from "~/server/internal/tasks";
export default defineEventHandler(async (h3) => {
const allowed = await aclManager.allowSystemACL(h3, [
@ -7,7 +8,7 @@ export default defineEventHandler(async (h3) => {
]);
if (!allowed) throw createError({ statusCode: 403 });
await runTask("cleanup:invitations");
await taskHandler.runTaskGroupByName("cleanup:invitations");
const invitations = await prisma.invitation.findMany({});
return invitations;

895
yarn.lock

File diff suppressed because it is too large Load Diff