|
22 | 22 | > |
23 | 23 | </p> |
24 | 24 |
|
25 | | - <Listbox |
26 | | - v-if="props.protonEnabled" |
27 | | - as="div" |
28 | | - v-model="model.overrideProtonPath" |
29 | | - class="mt-6" |
30 | | - > |
31 | | - <ListboxLabel class="block text-sm/6 font-medium text-white" |
32 | | - >Proton override</ListboxLabel |
33 | | - > |
34 | | - <div class="relative mt-2"> |
35 | | - <ListboxButton |
36 | | - class="grid w-full cursor-default grid-cols-1 rounded-md bg-white/5 py-1.5 pr-2 pl-3 text-left text-white outline-1 -outline-offset-1 outline-white/10 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-blue-500 sm:text-sm/6" |
37 | | - > |
38 | | - <span |
39 | | - v-if="currentProtonPath" |
40 | | - class="col-start-1 row-start-1 truncate pr-6" |
41 | | - >{{ currentProtonPath.name }} ({{ currentProtonPath.path }})</span |
42 | | - > |
43 | | - <span |
44 | | - v-else |
45 | | - class="col-start-1 row-start-1 truncate pr-6 italic text-zinc-400" |
46 | | - >No override configured</span |
47 | | - > |
48 | | - <ChevronUpDownIcon |
49 | | - class="col-start-1 row-start-1 size-5 self-center justify-self-end text-zinc-400 sm:size-4" |
50 | | - aria-hidden="true" |
51 | | - /> |
52 | | - </ListboxButton> |
53 | | - |
54 | | - <transition |
55 | | - leave-active-class="transition ease-in duration-100" |
56 | | - leave-from-class="" |
57 | | - leave-to-class="opacity-0" |
58 | | - > |
59 | | - <ListboxOptions |
60 | | - class="absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-zinc-800 py-1 text-base outline-1 -outline-offset-1 outline-white/10 sm:text-sm" |
61 | | - > |
62 | | - <ListboxOption |
63 | | - as="template" |
64 | | - :value="undefined" |
65 | | - v-slot="{ active, selected }" |
66 | | - > |
67 | | - <li |
68 | | - :class="[ |
69 | | - active |
70 | | - ? 'bg-blue-500 text-white outline-hidden' |
71 | | - : 'text-white', |
72 | | - 'relative cursor-default py-2 pr-9 pl-3 select-none', |
73 | | - ]" |
74 | | - > |
75 | | - <span |
76 | | - :class="[ |
77 | | - selected ? 'font-semibold' : 'font-normal', |
78 | | - 'block truncate italic', |
79 | | - ]" |
80 | | - >Use global default</span |
81 | | - > |
82 | | - |
83 | | - <span |
84 | | - v-if="selected" |
85 | | - :class="[ |
86 | | - active ? 'text-white' : 'text-blue-400', |
87 | | - 'absolute inset-y-0 right-0 flex items-center pr-4', |
88 | | - ]" |
89 | | - > |
90 | | - <CheckIcon class="size-5" aria-hidden="true" /> |
91 | | - </span> |
92 | | - </li> |
93 | | - </ListboxOption> |
94 | | - <h1 class="text-white text-sm font-semibold bg-zinc-900 py-2 px-2"> |
95 | | - Auto-discovered |
96 | | - </h1> |
97 | | - <ListboxOption |
98 | | - as="template" |
99 | | - v-if="protonPaths.autodiscovered.length > 0" |
100 | | - v-for="proton in protonPaths.autodiscovered" |
101 | | - :key="proton.path" |
102 | | - :value="proton.path" |
103 | | - v-slot="{ active, selected }" |
104 | | - > |
105 | | - <li |
106 | | - :class="[ |
107 | | - active |
108 | | - ? 'bg-blue-500 text-white outline-hidden' |
109 | | - : 'text-white', |
110 | | - 'relative cursor-default py-2 pr-9 pl-3 select-none', |
111 | | - ]" |
112 | | - > |
113 | | - <span |
114 | | - :class="[ |
115 | | - selected ? 'font-semibold' : 'font-normal', |
116 | | - 'block truncate', |
117 | | - ]" |
118 | | - >{{ proton.name }} ({{ proton.path }})</span |
119 | | - > |
120 | | - |
121 | | - <span |
122 | | - v-if="selected" |
123 | | - :class="[ |
124 | | - active ? 'text-white' : 'text-blue-400', |
125 | | - 'absolute inset-y-0 right-0 flex items-center pr-4', |
126 | | - ]" |
127 | | - > |
128 | | - <CheckIcon class="size-5" aria-hidden="true" /> |
129 | | - </span> |
130 | | - </li> |
131 | | - </ListboxOption> |
132 | | - <li v-else class="italic text-zinc-400 py-2 pr-9 pl-3"> |
133 | | - No auto-discovered layers. |
134 | | - </li> |
135 | | - <h1 class="text-white text-sm font-semibold bg-zinc-900 py-2 px-2"> |
136 | | - Manually added |
137 | | - </h1> |
138 | | - <ListboxOption |
139 | | - as="template" |
140 | | - v-if="protonPaths.custom.length > 0" |
141 | | - v-for="proton in protonPaths.custom" |
142 | | - :key="proton.path" |
143 | | - :value="proton.path" |
144 | | - v-slot="{ active, selected }" |
145 | | - > |
146 | | - <li |
147 | | - :class="[ |
148 | | - active |
149 | | - ? 'bg-blue-500 text-white outline-hidden' |
150 | | - : 'text-white', |
151 | | - 'relative cursor-default py-2 pr-9 pl-3 select-none', |
152 | | - ]" |
153 | | - > |
154 | | - <span |
155 | | - :class="[ |
156 | | - selected ? 'font-semibold' : 'font-normal', |
157 | | - 'block truncate', |
158 | | - ]" |
159 | | - >{{ proton.name }} ({{ proton.path }})</span |
160 | | - > |
161 | | - |
162 | | - <span |
163 | | - v-if="selected" |
164 | | - :class="[ |
165 | | - active ? 'text-white' : 'text-blue-400', |
166 | | - 'absolute inset-y-0 right-0 flex items-center pr-4', |
167 | | - ]" |
168 | | - > |
169 | | - <CheckIcon class="size-5" aria-hidden="true" /> |
170 | | - </span> |
171 | | - </li> |
172 | | - </ListboxOption> |
173 | | - <li v-else class="italic text-zinc-400 py-2 pr-9 pl-3"> |
174 | | - No manually added layers. |
175 | | - </li> |
176 | | - </ListboxOptions> |
177 | | - </transition> |
178 | | - </div> |
179 | | - <p class="mt-2 text-sm text-zinc-400" id="launch-description"> |
180 | | - Override the Proton layer used to launch this game. You can add or |
181 | | - remove your custom Proton layer paths in |
182 | | - <PageWidget to="/settings/compat"> |
183 | | - <WrenchIcon class="size-3" /> |
184 | | - Settings </PageWidget |
185 | | - >. |
186 | | - </p> |
187 | | - </Listbox> |
| 25 | + <ProtonSelector v-model="model" v-if="$props.protonEnabled" /> |
188 | 26 | </div> |
189 | 27 | </template> |
190 | 28 |
|
191 | 29 | <script setup lang="ts"> |
192 | | -import { invoke } from "@tauri-apps/api/core"; |
193 | | -import type { ProtonPath } from "~/composables/game"; |
194 | | -import { |
195 | | - Listbox, |
196 | | - ListboxButton, |
197 | | - ListboxLabel, |
198 | | - ListboxOption, |
199 | | - ListboxOptions, |
200 | | -} from "@headlessui/vue"; |
201 | | -import { ChevronUpDownIcon } from "@heroicons/vue/16/solid"; |
202 | | -import { CheckIcon } from "@heroicons/vue/20/solid"; |
203 | | -import { WrenchIcon } from "@heroicons/vue/24/solid"; |
204 | 30 | import type { GameVersion } from "~/types"; |
| 31 | +import ProtonSelector from "./ProtonSelector.vue"; |
205 | 32 |
|
206 | 33 | const model = defineModel<GameVersion["userConfiguration"]>({ required: true }); |
207 | 34 |
|
208 | 35 | const props = defineProps<{ |
209 | 36 | protonEnabled: boolean; |
210 | 37 | }>(); |
211 | | -
|
212 | | -const protonPaths = await invoke<{ |
213 | | - autodiscovered: ProtonPath[]; |
214 | | - custom: ProtonPath[]; |
215 | | - default?: string; |
216 | | -}>("fetch_proton_paths"); |
217 | | -const currentProtonPath = computed( |
218 | | - () => |
219 | | - protonPaths.autodiscovered.find( |
220 | | - (v) => v.path == model.value.overrideProtonPath, |
221 | | - ) ?? |
222 | | - protonPaths.custom.find((v) => v.path == model.value.overrideProtonPath), |
223 | | -); |
224 | 38 | </script> |
0 commit comments