@@ -11,7 +11,7 @@ definePageMeta({
1111 <form @submit.prevent =" updateSettings" class =" grid gap-4" >
1212 <div
1313 class =" flex flex-row items-center justify-between rounded-lg border p-4 cursor-pointer"
14- @click =" toggleMatchmaking "
14+ @click =" toggleMatchmakingType(e_match_types_enum.all) "
1515 >
1616 <div class =" space-y-0.5" >
1717 <h4 class =" text-base font-medium" >
@@ -27,6 +27,28 @@ definePageMeta({
2727 />
2828 </div >
2929
30+ <div v-if =" matchMakingAllowed" class =" space-y-2" >
31+ <div class =" grid grid-cols-3 gap-4" >
32+ <template v-for =" match_type in [' competitive' , ' wingman' , ' duel' ]" >
33+ <div
34+ class =" flex flex-row items-center justify-between rounded-lg border p-4 cursor-pointer"
35+ @click =" toggleMatchmakingType(match_type)"
36+ >
37+ <div class =" space-y-0.5" >
38+ <h4 class =" text-base font-medium capitalize" >{{ match_type }}</h4 >
39+ </div >
40+ <Switch
41+ :model-value =" isMatchmakingTypeEnabled(match_type)"
42+ @update:model-value =" toggleMatchmakingType(match_type)"
43+ />
44+ </div >
45+ </template >
46+ </div >
47+ <p class =" text-sm text-muted-foreground" >
48+ {{ $t(`pages.settings.application.matchmaking_type_description`) }}
49+ </p >
50+ </div >
51+
3052 <FormField v-slot =" { componentField }" name =" auto_cancel_duration" >
3153 <FormItem >
3254 <FormLabel class =" text-lg font-semibold" >{{
@@ -258,6 +280,36 @@ export default {
258280 }),
259281 });
260282 },
283+ isMatchmakingTypeEnabled(match_type : e_match_types_enum ) {
284+ const matchmakingTypeSetting = this .settings .find (
285+ (setting : { name: string ; value: string | null }) =>
286+ setting .name === ` public.matchmaking_${match_type } ` ,
287+ );
288+ return matchmakingTypeSetting ?.value !== " false" ;
289+ },
290+ async toggleMatchmakingType(match_type : e_match_types_enum ) {
291+ await (this as any ).$apollo .mutate ({
292+ mutation: generateMutation ({
293+ insert_settings_one: [
294+ {
295+ object: {
296+ name: ` public.matchmaking_${match_type } ` ,
297+ value: this .isMatchmakingTypeEnabled (match_type )
298+ ? " false"
299+ : " true" ,
300+ },
301+ on_conflict: {
302+ constraint: settings_constraint .settings_pkey ,
303+ update_columns: [settings_update_column .value ],
304+ },
305+ },
306+ {
307+ __typename: true ,
308+ },
309+ ],
310+ }),
311+ });
312+ },
261313 async toggleDefaultModels() {
262314 await (this as any ).$apollo .mutate ({
263315 mutation: generateMutation ({
0 commit comments