feat First implementation of plugins system
feat: Added PCSX2 integration feat: Revamped UI a bit made it look better on light mode
This commit is contained in:
parent
d85268fad7
commit
a78e75335f
95 changed files with 2639 additions and 1259 deletions
21
src/mainview/scripts/queries/plugins.ts
Normal file
21
src/mainview/scripts/queries/plugins.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { mutationOptions, queryOptions } from "@tanstack/react-query";
|
||||
import { pluginsApi } from "../clientApi";
|
||||
|
||||
export const getAllPluginsQuery = queryOptions({
|
||||
queryKey: ['plugins', 'all'], queryFn: async () =>
|
||||
{
|
||||
const { data, error } = await pluginsApi.plugins.get();
|
||||
if (error) throw error;
|
||||
return data;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
export const enablePluginMutation = mutationOptions({
|
||||
mutationKey: ['plugin', 'enable'],
|
||||
mutationFn: async (vars: { id: string, enabled: boolean; }) =>
|
||||
{
|
||||
const { error } = await pluginsApi.plugins({ id: vars.id }).post({ enabled: vars.enabled });
|
||||
if (error) throw error;
|
||||
}
|
||||
});
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { DefaultRommStaleTime, FrontEndId, GameListFilterType, RommLoginDataSchema, RPC_URL } from "@/shared/constants";
|
||||
import { DefaultRommStaleTime, GameListFilterType, RommLoginDataSchema } from "@/shared/constants";
|
||||
import { rommApi, settingsApi } from "../clientApi";
|
||||
import { mutationOptions, queryOptions } from "@tanstack/react-query";
|
||||
import z from "zod";
|
||||
|
|
@ -45,7 +45,7 @@ export const rommLoginMutation = mutationOptions({
|
|||
});
|
||||
export const rommUserQuery = () => queryOptions({
|
||||
...getCurrentUserApiUsersMeGetOptions(),
|
||||
queryKey: ['romm', 'auth', "login"],
|
||||
queryKey: ['romm', 'auth', "login"] as any,
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ export const customEmulatorAddMutation = mutationOptions({
|
|||
const { data, error } = await settingsApi.api.settings.emulators.custom({ id }).put({ value: '' });
|
||||
if (error) throw error;
|
||||
return data;
|
||||
},
|
||||
onSuccess: (d, v, r, ctx) => ctx.client.invalidateQueries({ queryKey: ['custom-emulators'] })
|
||||
}
|
||||
});
|
||||
export const customEmulatorDeleteMutation = (id: string) => mutationOptions({
|
||||
mutationKey: ["emulator", id, 'delete'],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { infiniteQueryOptions, mutationOptions, queryOptions } from "@tanstack/react-query";
|
||||
import { rommApi, storeApi } from "../clientApi";
|
||||
import { FrontEndGameType } from "@/shared/constants";
|
||||
|
||||
|
||||
export const storeEmulatorsQuery = queryOptions({
|
||||
|
|
@ -71,4 +70,19 @@ export const installEmulatorMutation = (id: string) => mutationOptions({
|
|||
if (error) throw error;
|
||||
return data;
|
||||
}
|
||||
});
|
||||
export const downloadBiosMutation = (id: string) => mutationOptions({
|
||||
mutationKey: ["download", 'bios', id],
|
||||
mutationFn: async () =>
|
||||
{
|
||||
const { error } = await storeApi.api.store.download.bios({ id }).post();
|
||||
if (error) throw error;
|
||||
}
|
||||
});
|
||||
export const deleteBiosMutation = mutationOptions({
|
||||
mutationKey: ["delete", "bios"], mutationFn: async (id: string) =>
|
||||
{
|
||||
const { error } = await storeApi.api.store.bios({ id }).delete();
|
||||
if (error) throw error;
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue