mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
feat: add mac as platform
This commit is contained in:
13
components/Icons/MacLogo.vue
Normal file
13
components/Icons/MacLogo.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xml:space="preserve"
|
||||||
|
viewBox="0 0 814 1000"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke="currentColor"
|
||||||
|
fill="currentColor"
|
||||||
|
d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
@ -7,13 +7,13 @@
|
|||||||
<ListboxButton
|
<ListboxButton
|
||||||
class="relative w-full cursor-default rounded-md bg-zinc-950 py-1.5 pl-3 pr-10 text-left text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-800 focus:outline-none focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6"
|
class="relative w-full cursor-default rounded-md bg-zinc-950 py-1.5 pl-3 pr-10 text-left text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-800 focus:outline-none focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6"
|
||||||
>
|
>
|
||||||
<span v-if="model && values[model]" class="flex items-center">
|
<span v-if="model" class="flex items-center">
|
||||||
<component
|
<component
|
||||||
:is="values[model].icon"
|
:is="PLATFORM_ICONS[model]"
|
||||||
alt=""
|
alt=""
|
||||||
class="h-5 w-5 flex-shrink-0 text-blue-600"
|
class="h-5 w-5 flex-shrink-0 text-blue-600"
|
||||||
/>
|
/>
|
||||||
<span class="ml-3 block truncate">{{ values[model].name }}</span>
|
<span class="ml-3 block truncate">{{ model }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>Please select a platform...</span>
|
<span v-else>Please select a platform...</span>
|
||||||
<span
|
<span
|
||||||
@ -33,7 +33,7 @@
|
|||||||
>
|
>
|
||||||
<ListboxOption
|
<ListboxOption
|
||||||
as="template"
|
as="template"
|
||||||
v-for="[value, options] in Object.entries(values)"
|
v-for="[name, value] in Object.entries(values)"
|
||||||
:key="value"
|
:key="value"
|
||||||
:value="value"
|
:value="value"
|
||||||
v-slot="{ active, selected }"
|
v-slot="{ active, selected }"
|
||||||
@ -46,14 +46,14 @@
|
|||||||
>
|
>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<component
|
<component
|
||||||
:is="options.icon"
|
:is="PLATFORM_ICONS[value]"
|
||||||
alt=""
|
alt=""
|
||||||
:class="[
|
:class="[
|
||||||
active ? 'text-zinc-100' : 'text-blue-600',
|
active ? 'text-zinc-100' : 'text-blue-600',
|
||||||
'h-5 w-5 flex-shrink-0',
|
'h-5 w-5 flex-shrink-0',
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
<span class="ml-3 block truncate">{{ options.name }}</span>
|
<span class="ml-3 block truncate">{{ name }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
@ -74,7 +74,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
import { IconsLinuxLogo, IconsMacLogo, IconsWindowsLogo } from "#components";
|
||||||
import {
|
import {
|
||||||
Listbox,
|
Listbox,
|
||||||
ListboxButton,
|
ListboxButton,
|
||||||
@ -85,16 +85,7 @@ import {
|
|||||||
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";
|
||||||
|
|
||||||
const model = defineModel<string>();
|
const model = defineModel<PlatformClient>();
|
||||||
|
|
||||||
const values: { [key: string]: { name: string; icon: Component } } = {
|
const values = Object.fromEntries(Object.entries(PlatformClient));
|
||||||
Linux: {
|
|
||||||
name: "Linux",
|
|
||||||
icon: IconsLinuxLogo,
|
|
||||||
},
|
|
||||||
Windows: {
|
|
||||||
name: "Windows",
|
|
||||||
icon: IconsWindowsLogo,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
import { IconsLinuxLogo, IconsWindowsLogo, IconsMacLogo } from "#components";
|
||||||
|
import { PlatformClient } from "./types";
|
||||||
|
|
||||||
export const PLATFORM_ICONS = {
|
export const PLATFORM_ICONS = {
|
||||||
[PlatformClient.Linux]: IconsLinuxLogo,
|
[PlatformClient.Linux]: IconsLinuxLogo,
|
||||||
[PlatformClient.Windows]: IconsWindowsLogo,
|
[PlatformClient.Windows]: IconsWindowsLogo,
|
||||||
|
[PlatformClient.macOS]: IconsMacLogo,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -15,4 +15,5 @@ export type QuickActionNav = {
|
|||||||
export enum PlatformClient {
|
export enum PlatformClient {
|
||||||
Windows = "Windows",
|
Windows = "Windows",
|
||||||
Linux = "Linux",
|
Linux = "Linux",
|
||||||
|
macOS = "macOS",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -320,7 +320,8 @@
|
|||||||
<div class="text-zinc-400">
|
<div class="text-zinc-400">
|
||||||
{{ item.delta ? "Upgrade mode" : "" }}
|
{{ item.delta ? "Upgrade mode" : "" }}
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-flex gap-x-2">
|
<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" />
|
<Bars3Icon class="cursor-move w-6 h-6 text-zinc-400 handle" />
|
||||||
<button @click="() => deleteVersion(item.versionName)">
|
<button @click="() => deleteVersion(item.versionName)">
|
||||||
<TrashIcon class="w-5 h-5 text-red-600" />
|
<TrashIcon class="w-5 h-5 text-red-600" />
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterEnum
|
||||||
|
ALTER TYPE "Platform" ADD VALUE 'macos';
|
||||||
@ -7,4 +7,5 @@ model ApplicationSettings {
|
|||||||
enum Platform {
|
enum Platform {
|
||||||
Windows @map("windows")
|
Windows @map("windows")
|
||||||
Linux @map("linux")
|
Linux @map("linux")
|
||||||
|
macOS @map("macos")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,6 +154,10 @@ class LibraryManager {
|
|||||||
// Pretty much the only one
|
// Pretty much the only one
|
||||||
".exe",
|
".exe",
|
||||||
],
|
],
|
||||||
|
macOS: [
|
||||||
|
// App files
|
||||||
|
".app",
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const options: Array<{
|
const options: Array<{
|
||||||
@ -302,10 +306,8 @@ class LibraryManager {
|
|||||||
nonce: `version-create-${gameId}-${versionName}`,
|
nonce: `version-create-${gameId}-${versionName}`,
|
||||||
title: `'${game.mName}' ('${versionName}') finished importing.`,
|
title: `'${game.mName}' ('${versionName}') finished importing.`,
|
||||||
description: `Drop finished importing version ${versionName} for ${game.mName}.`,
|
description: `Drop finished importing version ${versionName} for ${game.mName}.`,
|
||||||
actions: [
|
actions: [`View|/admin/library/${gameId}`],
|
||||||
`View|/admin/library/${gameId}`
|
});
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
progress(100);
|
progress(100);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -8,6 +8,10 @@ export function parsePlatform(platform: string) {
|
|||||||
case "windows":
|
case "windows":
|
||||||
case "Windows":
|
case "Windows":
|
||||||
return Platform.Windows;
|
return Platform.Windows;
|
||||||
|
case "macOS":
|
||||||
|
case "MacOS":
|
||||||
|
case "mac":
|
||||||
|
return Platform.macOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user