mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
fix: moved icons and created PlatformClient so we can use the enum on the frontend
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
||||||
import {
|
import {
|
||||||
Listbox,
|
Listbox,
|
||||||
ListboxButton,
|
ListboxButton,
|
||||||
@@ -83,19 +84,17 @@ import {
|
|||||||
} from "@headlessui/vue";
|
} from "@headlessui/vue";
|
||||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||||
import type { Component } from "vue";
|
import type { Component } from "vue";
|
||||||
import LinuxLogo from "./icons/LinuxLogo.vue";
|
|
||||||
import WindowsLogo from "./icons/WindowsLogo.vue";
|
|
||||||
|
|
||||||
const model = defineModel<string>();
|
const model = defineModel<string>();
|
||||||
|
|
||||||
const values: { [key: string]: { name: string; icon: Component } } = {
|
const values: { [key: string]: { name: string; icon: Component } } = {
|
||||||
Linux: {
|
Linux: {
|
||||||
name: "Linux",
|
name: "Linux",
|
||||||
icon: LinuxLogo,
|
icon: IconsLinuxLogo,
|
||||||
},
|
},
|
||||||
Windows: {
|
Windows: {
|
||||||
name: "Windows",
|
name: "Windows",
|
||||||
icon: WindowsLogo,
|
icon: IconsWindowsLogo,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -63,8 +63,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import GithubLogo from './icons/GithubLogo.vue';
|
import { IconsDiscordLogo, IconsGithubLogo } from '#components';
|
||||||
import DiscordLogo from './icons/DiscordLogo.vue';
|
|
||||||
|
|
||||||
const navigation = {
|
const navigation = {
|
||||||
games: [
|
games: [
|
||||||
@@ -92,12 +91,12 @@ const navigation = {
|
|||||||
{
|
{
|
||||||
name: 'GitHub',
|
name: 'GitHub',
|
||||||
href: 'https://github.com/Drop-OSS',
|
href: 'https://github.com/Drop-OSS',
|
||||||
icon: GithubLogo,
|
icon: IconsGithubLogo,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Discord",
|
name: "Discord",
|
||||||
href: "https://discord.gg/NHx46XKJWA",
|
href: "https://discord.gg/NHx46XKJWA",
|
||||||
icon: DiscordLogo
|
icon: IconsDiscordLogo
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
13
composables/types.d.ts
vendored
13
composables/types.d.ts
vendored
@@ -1,13 +0,0 @@
|
|||||||
import type { Component } from "vue"
|
|
||||||
|
|
||||||
export type NavigationItem = {
|
|
||||||
prefix: string,
|
|
||||||
route: string,
|
|
||||||
label: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QuickActionNav = {
|
|
||||||
icon: Component,
|
|
||||||
notifications?: Ref<number>,
|
|
||||||
action: () => Promise<void>,
|
|
||||||
}
|
|
||||||
18
composables/types.ts
Normal file
18
composables/types.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import type { Component } from "vue";
|
||||||
|
|
||||||
|
export type NavigationItem = {
|
||||||
|
prefix: string;
|
||||||
|
route: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QuickActionNav = {
|
||||||
|
icon: Component;
|
||||||
|
notifications?: Ref<number>;
|
||||||
|
action: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum PlatformClient {
|
||||||
|
Windows = "Windows",
|
||||||
|
Linux = "Linux",
|
||||||
|
}
|
||||||
@@ -97,11 +97,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { IconsSimpleAuthenticationLogo } from "#components";
|
||||||
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
||||||
import { EllipsisHorizontalIcon } from "@heroicons/vue/20/solid";
|
import { EllipsisHorizontalIcon } from "@heroicons/vue/20/solid";
|
||||||
import { CheckIcon, XMarkIcon } from "@heroicons/vue/24/solid";
|
import { CheckIcon, XMarkIcon } from "@heroicons/vue/24/solid";
|
||||||
import type { Component } from "vue";
|
import type { Component } from "vue";
|
||||||
import SimpleAuthenticationLogo from "~/components/icons/SimpleAuthenticationLogo.vue";
|
|
||||||
|
|
||||||
const authenticationMechanisms: Array<{
|
const authenticationMechanisms: Array<{
|
||||||
name: string;
|
name: string;
|
||||||
@@ -113,7 +113,7 @@ const authenticationMechanisms: Array<{
|
|||||||
{
|
{
|
||||||
name: "Simple (username/password)",
|
name: "Simple (username/password)",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
icon: SimpleAuthenticationLogo,
|
icon: IconsSimpleAuthenticationLogo,
|
||||||
route: "/admin/auth/simple",
|
route: "/admin/auth/simple",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -70,13 +70,10 @@
|
|||||||
<td
|
<td
|
||||||
class="whitespace-nowrap inline-flex gap-x-4 px-3 py-4 text-sm text-zinc-400"
|
class="whitespace-nowrap inline-flex gap-x-4 px-3 py-4 text-sm text-zinc-400"
|
||||||
>
|
>
|
||||||
<IconsWindowsLogo
|
<component
|
||||||
|
v-for="platform in platforms"
|
||||||
|
:is="icons[platform]"
|
||||||
class="text-blue-600 w-6 h-6"
|
class="text-blue-600 w-6 h-6"
|
||||||
v-if="platforms.includes(Platform.Windows)"
|
|
||||||
/>
|
|
||||||
<IconsLinuxLogo
|
|
||||||
class="text-blue-600 w-6 h-6"
|
|
||||||
v-if="platforms.includes(Platform.Linux)"
|
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="platforms.length == 0"
|
v-if="platforms.length == 0"
|
||||||
@@ -162,12 +159,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
||||||
import { PlusIcon } from "@heroicons/vue/20/solid";
|
import { PlusIcon } from "@heroicons/vue/20/solid";
|
||||||
import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline";
|
import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline";
|
||||||
import { StarIcon } from "@heroicons/vue/24/solid";
|
import { StarIcon } from "@heroicons/vue/24/solid";
|
||||||
import { Platform, type Game, type GameVersion } from "@prisma/client";
|
import { type Game, type GameVersion } from "@prisma/client";
|
||||||
import { micromark } from "micromark";
|
import { micromark } from "micromark";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { PlatformClient } from "~/composables/types";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const gameId = route.params.id.toString();
|
const gameId = route.params.id.toString();
|
||||||
@@ -205,7 +204,7 @@ const descriptionHTML = micromark(game.mDescription);
|
|||||||
|
|
||||||
const showReadMore = previewHTML != descriptionHTML;
|
const showReadMore = previewHTML != descriptionHTML;
|
||||||
const platforms = game.versions
|
const platforms = game.versions
|
||||||
.map((e) => e.platform)
|
.map((e) => e.platform as PlatformClient)
|
||||||
.flat()
|
.flat()
|
||||||
.filter((e, i, u) => u.indexOf(e) === i);
|
.filter((e, i, u) => u.indexOf(e) === i);
|
||||||
|
|
||||||
@@ -213,6 +212,10 @@ const rating = Math.round(game.mReviewRating * 5);
|
|||||||
const ratingArray = Array(5)
|
const ratingArray = Array(5)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map((_, i) => i + 1 <= rating);
|
.map((_, i) => i + 1 <= rating);
|
||||||
|
const icons = {
|
||||||
|
[PlatformClient.Linux]: IconsLinuxLogo,
|
||||||
|
[PlatformClient.Windows]: IconsWindowsLogo,
|
||||||
|
};
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: game.mName,
|
title: game.mName,
|
||||||
|
|||||||
Reference in New Issue
Block a user