Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"username": "drop"
}
],
"typescript.experimental.useTsgo": false,
"typescript.experimental.useTsgo": true,
// prioritize ArkType's "type" for autoimports
"typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"]
}
2 changes: 1 addition & 1 deletion components/ExecutorWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="flex space-x-4 rounded-md bg-zinc-900/50 px-6 outline -outline-offset-1 outline-white/10 w-fit text-xs font-bold text-zinc-100"
>
<div class="inline-flex gap-x-2 items-center">
<img :src="executor.gameIcon" class="size-6" />
<img :src="useObject(executor.gameIcon)" class="size-6" />
<span>{{ executor.gameName }}</span>
</div>
<div class="flex items-center">
Expand Down
9 changes: 3 additions & 6 deletions components/GameEditor/VersionConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
:executor="{
launchId: props.config.launchId,
gameName: props.config.executor.gameVersion.game.mName,
gameIcon: useObject(
props.config.executor.gameVersion.game.mIconObjectId,
),
versionName:
props.config.executor.gameVersion.displayName ??
props.config.executor.gameVersion.versionPath,
gameIcon: props.config.executor.gameVersion.game.mIconObjectId,
versionName: (props.config.executor.gameVersion.displayName ??
props.config.executor.gameVersion.versionPath)!,
launchName: props.config.executor.name,
platform: props.config.executor.platform,
}"
Expand Down
8 changes: 6 additions & 2 deletions components/GameSearchResultWidget.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="flex flex-row items-center gap-x-2">
<img :src="game.icon" class="w-12 h-12 rounded-sm object-cover" />
<img
:src="rawIcon ? game.icon : useObject(game.icon)"
class="w-12 h-12 rounded-sm object-cover"
/>
<div class="flex flex-col items-left">
<h1 class="font-semibold font-display text-lg text-zinc-100">
{{ game.name }}
Expand All @@ -18,7 +21,8 @@
<script setup lang="ts">
import type { GameMetadataSearchResult } from "~/server/internal/metadata/types";

const { game } = defineProps<{
const { game, rawIcon = true } = defineProps<{
game: Omit<GameMetadataSearchResult, "year"> & { sourceName?: string };
rawIcon?: boolean;
}>();
</script>
65 changes: 60 additions & 5 deletions components/ImportVersionLaunchRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
:is="PLATFORM_ICONS[guess.platform]"
class="size-5"
/>
<img
v-if="guess.type === 'executor'"
:src="useObject(guess.icon)"
class="size-5"
/>
</span>

<span
Expand Down Expand Up @@ -119,7 +124,7 @@
<span
:class="['block truncate', selected && 'font-semibold']"
>
{{ launchProcessQuery }}
'{{ launchProcessQuery }}'
</span>

<span
Expand All @@ -137,6 +142,28 @@
</div>
</Combobox>
</div>
<div
v-if="props.type && props.type === 'Executor'"
class="ml-1 mt-2 rounded-lg bg-blue-900/10 p-1 outline outline-blue-900"
>
<div class="flex items-center">
<div class="shrink-0">
<InformationCircleIcon
class="size-5 text-blue-500"
aria-hidden="true"
/>
</div>
<div class="ml-2 inline-flex items-center">
<p class="text-sm text-blue-200">
<span
class="font-mono bg-zinc-950 text-zinc-100 py-1 px-0.5 rounded-xl"
>{executor}</span
>
is replaced with the game's launch command for executors.
</p>
</div>
</div>
</div>
</div>
<SelectorPlatform
:model-value="launchConfiguration.platform"
Expand All @@ -145,7 +172,7 @@
>
{{ $t("library.admin.import.version.platform") }}
</SelectorPlatform>
<div>
<div v-if="props.type && props.type === 'Game' && props.allowExecutor">
<h1 class="block text-sm font-medium leading-6 text-zinc-100">
Executor
</h1>
Expand All @@ -170,6 +197,15 @@
</button>
</div>
</div>
<div v-if="props.type && props.type === 'Executor'">
<p class="block text-sm font-medium leading-6 text-zinc-100">
Auto-suggest extensions
</p>
<SelectorFileExtension
v-model="launchConfiguration.suggestions!"
class="mt-2"
/>
</div>
<ModalSelectLaunch
v-model="selectLaunchOpen"
class="-mt-2"
Expand All @@ -190,9 +226,10 @@ import {
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { InformationCircleIcon, TrashIcon } from "@heroicons/vue/24/outline";
import type { ExecutorLaunchObject } from "~/composables/frontend";
import type { Platform } from "~/prisma/client/enums";
import type { GameType, Platform } from "~/prisma/client/enums";

import type { ImportVersion } from "~/server/api/v1/admin/import/version/index.post";
import type { VersionGuess } from "~/server/internal/library";

const launchProcessQuery = ref("");

Expand Down Expand Up @@ -227,10 +264,15 @@ function updatePlatform(v: Platform | undefined) {
}

const props = defineProps<{
versionGuesses: Array<{ platform: Platform; filename: string }> | undefined;
versionGuesses: Array<VersionGuess> | undefined;
needsName: boolean;
allowExecutor?: boolean;
type?: GameType;
}>();

if (props.type && props.type === "Executor")
launchConfiguration.value.suggestions ??= [];

const selectLaunchOpen = ref(false);

const launchFilteredVersionGuesses = computed(() =>
Expand All @@ -246,7 +288,20 @@ function updateLaunchCommand(command: string) {
(v) => v.filename == command,
);
if (autosetGuess) {
launchConfiguration.value.platform = autosetGuess.platform;
if (autosetGuess.type === "platform") {
launchConfiguration.value.platform = autosetGuess.platform;
} else if (autosetGuess.type === "executor") {
console.log(autosetGuess.executorId);
executor.value = {
launchId: autosetGuess.executorId,
gameName: autosetGuess.gameName,
gameIcon: autosetGuess.icon,
versionName: autosetGuess.launchName,
launchName: autosetGuess.launchName,
platform: autosetGuess.platform,
} satisfies ExecutorLaunchObject;
launchConfiguration.value.platform = autosetGuess.platform;
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion components/Modal/AddCompanyGame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ async function addGame() {
}

async function search(query: string) {
return await $dropFetch("/api/v1/admin/search/game", { query: { q: query } });
return await $dropFetch("/api/v1/admin/search/game?type=Game", {
query: { q: query },
});
}
</script>
44 changes: 22 additions & 22 deletions components/Modal/SelectLaunch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<template #default>
<div>
<h1 as="h3" class="text-lg font-medium leading-6 text-white">
Pick a launch option
Select a launch option
</h1>
<p class="mt-1 text-zinc-400 text-sm">
Select a launch option as an executor for your new launch option.
Expand All @@ -28,14 +28,14 @@
</div>
</div>
<div class="mt-2 space-y-4">
<div
class="inline-flex items-center w-full gap-x-2 text-zinc-100 font-bold"
>
Game:
<div>
<h1 class="block text-sm font-medium leading-6 text-zinc-100">
Search for an executor
</h1>
<SelectorGame
:search="search"
:model-value="game"
class="w-full"
class="w-full mt-2"
@update:model-value="(value) => updateGame(value)"
/>
</div>
Expand All @@ -45,40 +45,38 @@
>
No versions imported.
</div>
<div
v-else-if="versions !== undefined"
class="inline-flex items-center w-full gap-x-2 text-zinc-100 font-bold"
>
Version:
<div v-else-if="versions !== undefined">
<h1 class="block text-sm font-medium leading-6 text-zinc-100">
Select a version
</h1>
<SelectorCombox
:search="
(v) =>
Object.values(versions!)
.filter((k) =>
(k.displayName || k.versionPath)
(k.displayName || k.versionPath)!
.toLowerCase()
.includes(v.toLowerCase()),
)
.map((v) => ({
id: v.versionId,
name: v.displayName ?? v.versionPath,
name: (v.displayName ?? v.versionPath)!,
}))
"
:display="(v) => v.name"
:model-value="version"
class="w-full"
class="w-full mt-2"
@update:model-value="updateVersion"
>
<template #default="{ value }">
{{ value.name }}
</template>
</SelectorCombox>
</div>
<div
v-if="versions && version"
class="inline-flex items-center w-full gap-x-2 text-zinc-100 font-bold"
>
Launch:
<div v-if="versions && version">
<h1 class="block text-sm font-medium leading-6 text-zinc-100">
Select a launch command
</h1>
<SelectorCombox
:search="
(v) =>
Expand All @@ -99,7 +97,7 @@
"
:display="(v) => v.name"
:model-value="launchId"
class="w-full"
class="w-full mt-2"
@update:model-value="(v) => (launchId = v)"
>
<template #default="{ value }">
Expand Down Expand Up @@ -169,7 +167,7 @@ const versions = ref<
platform: Platform;
}[];
versionId: string;
versionPath: string;
versionPath: string | null;
};
}
| undefined
Expand All @@ -180,7 +178,9 @@ const emit = defineEmits<{
}>();

async function search(query: string) {
return await $dropFetch("/api/v1/admin/search/game", { query: { q: query } });
return await $dropFetch("/api/v1/admin/search/game", {
query: { q: query, type: "Executor" },
});
}

function updateGame(value: GameMetadataSearchResult | undefined) {
Expand Down
Loading
Loading