fix: Fixed tests
feat: Added RClone integration feat: Implemented plugin settings feat: Updated minimal store version test: Fixed tests feat: Moved store and igdb and es-de to their own plugins
This commit is contained in:
parent
444d8c4c27
commit
c09fbd3dc8
115 changed files with 4139 additions and 1502 deletions
|
|
@ -12,7 +12,7 @@ export default function ActionButton (data: {
|
|||
square?: boolean,
|
||||
onFocus?: () => void;
|
||||
tooltip?: string,
|
||||
tooltip_type?: 'accent' | 'error';
|
||||
tooltipType?: 'accent' | 'error';
|
||||
disabled?: boolean;
|
||||
} & InteractParams)
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ export default function ActionButton (data: {
|
|||
ref={ref}
|
||||
onClick={e => data.onAction?.({ event: e.nativeEvent, focusKey })}
|
||||
data-tooltip={data.tooltip}
|
||||
data-tooltip-type={data.tooltip_type}
|
||||
data-tooltip-type={data.tooltipType}
|
||||
className={twMerge("header-icon flex flex-col gap-2 md:px-5 md:py-4 rounded-3xl md:text-2xl justify-center items-center cursor-pointer disabled:opacity-30 active:bg-base-100 active:transition-none active:text-base-content",
|
||||
"hover:ring-7 hover:ring-primary", styles[data.type], classNames({ "rounded-full sm:size-14 md:size-21 hover:bg-base-content hover:text-base-300 hover:ring-7 hover:ring-primary": !data.square }), data.className)}>
|
||||
{data.icon}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { deleteGameMutation, fixSourceMutation, gameInvalidationQuery, validateSourceQuery } from "@/mainview/scripts/queries/romm";
|
||||
import { deleteGameMutation, fixSourceMutation, gameInvalidationQuery, updateSourceMutation, validateSourceQuery } from "@/mainview/scripts/queries/romm";
|
||||
import { FocusContext, setFocus, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { ContextList, DialogEntry, useContextDialog } from "../ContextDialog";
|
||||
import { getErrorMessage } from "react-error-boundary";
|
||||
import toast from "react-hot-toast";
|
||||
import { Hammer, Settings, Trash, Trophy } from "lucide-react";
|
||||
import { Hammer, RefreshCcw, Settings, Trash, Trophy } from "lucide-react";
|
||||
import MainActions from "./MainActions";
|
||||
import ActionButton from "./ActionButton";
|
||||
import { useLocalStorage } from "usehooks-ts";
|
||||
|
|
@ -34,7 +34,8 @@ export default function ActionButtons (data: { game?: FrontEndGameTypeDetailed,
|
|||
const [, setDetailsSection] = useLocalStorage('details-section', 'screenshots');
|
||||
|
||||
const fixMutation = useMutation({
|
||||
...fixSourceMutation, onSuccess (data, variables, onMutateResult, context)
|
||||
...fixSourceMutation,
|
||||
onSuccess (data, variables, onMutateResult, context)
|
||||
{
|
||||
if (onMutateResult) toast.success("Updated Source");
|
||||
context.client.invalidateQueries(gameInvalidationQuery(variables.id, variables.source)).then(() => router.history.back());
|
||||
|
|
@ -44,6 +45,18 @@ export default function ActionButtons (data: { game?: FrontEndGameTypeDetailed,
|
|||
toast.error(getErrorMessage(error) ?? "Error While Trying To Fix");
|
||||
}
|
||||
});
|
||||
const updateMutation = useMutation({
|
||||
...updateSourceMutation,
|
||||
onSuccess (data, variables, onMutateResult, context)
|
||||
{
|
||||
if (onMutateResult) toast.success("Updated Source");
|
||||
context.client.invalidateQueries(gameInvalidationQuery(variables.id, variables.source));
|
||||
},
|
||||
onError (error)
|
||||
{
|
||||
toast.error(getErrorMessage(error) ?? "Error While Trying To Update");
|
||||
}
|
||||
});
|
||||
const { data: validation } = useQuery(validateSourceQuery(data.source, data.id));
|
||||
const { ref, focusKey, hasFocusedChild } = useFocusable({ focusKey: 'actions', forceFocus: true, trackChildren: true, preferredChildFocusKey: 'mainAction' });
|
||||
const router = useRouter();
|
||||
|
|
@ -62,7 +75,7 @@ export default function ActionButtons (data: { game?: FrontEndGameTypeDetailed,
|
|||
useBlocker({
|
||||
shouldBlockFn: () =>
|
||||
{
|
||||
return deleteMutation.isPending || fixMutation.isPending;
|
||||
return deleteMutation.isPending || fixMutation.isPending || updateMutation.isPending;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -85,15 +98,34 @@ export default function ActionButtons (data: { game?: FrontEndGameTypeDetailed,
|
|||
{
|
||||
contextOptions.push({
|
||||
id: "fix_source",
|
||||
action (ctx)
|
||||
async action (ctx)
|
||||
{
|
||||
if (data.game)
|
||||
fixMutation.mutate({ source: data.game.id.source, id: data.game.id.id });
|
||||
if (!data.game) return;
|
||||
await fixMutation.mutateAsync({ source: data.game.id.source, id: data.game.id.id });
|
||||
ctx.close();
|
||||
router.navigate({ replace: true });
|
||||
},
|
||||
icon: fixMutation.isPending ? <span className="loading loading-spinner loading-lg"></span> : <Hammer />,
|
||||
content: "Try Fix Source",
|
||||
type: "warning"
|
||||
});
|
||||
} else if (data.game?.id.source === 'local')
|
||||
{
|
||||
contextOptions.push({
|
||||
id: 'update_source',
|
||||
async action (ctx)
|
||||
{
|
||||
if (data.game)
|
||||
{
|
||||
await updateMutation.mutateAsync({ source: data.game.id.source, id: data.game.id.id });
|
||||
ctx.close();
|
||||
router.navigate({ replace: true });
|
||||
}
|
||||
},
|
||||
icon: updateMutation.isPending ? <span className="loading loading-spinner loading-lg"></span> : <RefreshCcw />,
|
||||
content: "Update Metadata",
|
||||
type: "primary"
|
||||
});
|
||||
}
|
||||
|
||||
const { setOpen, dialog: settingsDialog } = useContextDialog("settings-context", { content: <ContextList disableCloseButton={deleteMutation.isPending} options={contextOptions} />, canClose: !deleteMutation.isPending });
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default function Details (data: {
|
|||
const platformCoverImg = data.game?.path_platform_cover ? new URL(`${RPC_URL(__HOST__)}${data.game?.path_platform_cover}`) : undefined;
|
||||
if (platformCoverImg)
|
||||
platformCoverImg.searchParams.set("width", "64");
|
||||
const gameCoverImg = data.game?.path_cover ? `${RPC_URL(__HOST__)}${data.game?.path_cover}` : undefined;
|
||||
const gameCoverImg = data.game?.path_covers ? `${RPC_URL(__HOST__)}${data.game?.path_covers[0]}` : undefined;
|
||||
|
||||
let fileSizeIcon: JSX.Element | undefined;
|
||||
if (!data.game)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ export default function MainActions (data: { game?: FrontEndGameTypeDetailed, so
|
|||
{
|
||||
const errorMessage = getErrorMessage(e.data.error);
|
||||
if (!errorMessage) return;
|
||||
toast.error(errorMessage);
|
||||
setError(errorMessage);
|
||||
}
|
||||
});
|
||||
|
|
@ -137,7 +136,7 @@ export default function MainActions (data: { game?: FrontEndGameTypeDetailed, so
|
|||
mainButton = <ActionButton
|
||||
key="error"
|
||||
tooltip={error}
|
||||
tooltip-type="error"
|
||||
tooltipType="error"
|
||||
type='error'
|
||||
onAction={() =>
|
||||
{
|
||||
|
|
@ -169,7 +168,7 @@ export default function MainActions (data: { game?: FrontEndGameTypeDetailed, so
|
|||
{
|
||||
case 'present':
|
||||
case 'install':
|
||||
installMut.mutate();
|
||||
installMut.mutate({});
|
||||
break;
|
||||
}
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue