ci: testing pipeline

This commit is contained in:
Hydra 2024-04-29 11:01:34 +01:00
parent 7e3f53a0d0
commit ae6484b7b1
No known key found for this signature in database
27 changed files with 1349 additions and 1399 deletions

View file

@ -9,9 +9,8 @@
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://steamcdn-a.akamaihd.net https://cdn.cloudflare.steamstatic.com https://cdn2.steamgriddb.com https://cdn.akamai.steamstatic.com;"
/>
</head>
<body>
<body style="background-color: #1c1c1">
<div id="root"></div>
<h1>hello</h1>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View file

@ -22,7 +22,7 @@ export function BottomPanel() {
}, []);
const status = useMemo(() => {
if (isDownloading) {
if (isDownloading && game) {
if (game.status === "downloading_metadata")
return t("downloading_metadata", { title: game.title });

View file

@ -62,12 +62,14 @@ export function Modal({
const onMouseDown = (e: MouseEvent) => {
if (!isTopMostModal()) return;
const clickedOutsideContent = !modalContentRef.current.contains(
e.target as Node
);
if (modalContentRef.current) {
const clickedOutsideContent = modalContentRef.current.contains(
e.target as Node
);
if (clickedOutsideContent) {
handleCloseClick();
if (clickedOutsideContent) {
handleCloseClick();
}
}
};

View file

@ -62,7 +62,7 @@ declare global {
openGameInstaller: (gameId: number) => Promise<boolean>;
openGame: (gameId: number, executablePath: string) => Promise<void>;
closeGame: (gameId: number) => Promise<boolean>;
removeGame: (gameId: number) => Promise<void>;
removeGameFromLibrary: (gameId: number) => Promise<void>;
deleteGameFolder: (gameId: number) => Promise<unknown>;
getGameByObjectID: (objectID: string) => Promise<Game | null>;
onPlaytime: (cb: (gameId: number) => void) => () => Electron.IpcRenderer;

View file

@ -14,7 +14,10 @@ export const userPreferencesSlice = createSlice({
name: "userPreferences",
initialState,
reducers: {
setUserPreferences: (state, action: PayloadAction<UserPreferences>) => {
setUserPreferences: (
state,
action: PayloadAction<UserPreferences | null>
) => {
state.value = action.payload;
},
},

View file

@ -58,17 +58,17 @@ export function useDownload() {
deleteGame(gameId);
});
const removeGame = (gameId: number) =>
window.electron.removeGame(gameId).then(() => {
const removeGameFromLibrary = (gameId: number) =>
window.electron.removeGameFromLibrary(gameId).then(() => {
updateLibrary();
});
const isVerifying = ["downloading_metadata", "checking_files"].includes(
lastPacket?.game.status
lastPacket?.game.status ?? ""
);
const getETA = () => {
if (isVerifying || !isFinite(lastPacket?.timeRemaining)) {
if (isVerifying || !isFinite(lastPacket?.timeRemaining ?? 0)) {
return "";
}
@ -124,7 +124,7 @@ export function useDownload() {
pauseDownload,
resumeDownload,
cancelDownload,
removeGame,
removeGameFromLibrary,
deleteGame,
isGameDeleting,
clearDownload: () => dispatch(clearDownload()),

View file

@ -33,6 +33,7 @@ export function Downloads() {
numSeeds,
pauseDownload,
resumeDownload,
removeGameFromLibrary,
cancelDownload,
deleteGame,
isGameDeleting,
@ -52,11 +53,6 @@ export function Downloads() {
updateLibrary();
});
const removeGame = (gameId: number) =>
window.electron.removeGame(gameId).then(() => {
updateLibrary();
});
const getFinalDownloadSize = (game: Game) => {
const isGameDownloading = isDownloading && gameDownloading?.id === game?.id;
@ -194,7 +190,7 @@ export function Downloads() {
</Button>
<Button
onClick={() => removeGame(game.id)}
onClick={() => removeGameFromLibrary(game.id)}
theme="outline"
disabled={deleting}
>

View file

@ -32,7 +32,7 @@ export function HeroPanelActions({
resumeDownload,
pauseDownload,
cancelDownload,
removeGame,
removeGameFromLibrary,
isGameDeleting,
} = useDownload();
@ -63,7 +63,7 @@ export function HeroPanelActions({
try {
if (game) {
await removeGame(game.id);
await removeGameFromLibrary(game.id);
} else {
const gameExecutablePath = await selectGameExecutable();
@ -187,7 +187,7 @@ export function HeroPanelActions({
{t("open_download_options")}
</Button>
<Button
onClick={() => removeGame(game.id).then(getGame)}
onClick={() => removeGameFromLibrary(game.id).then(getGame)}
theme="outline"
disabled={deleting}
>

View file

@ -25,7 +25,7 @@ export function SelectFolderModal({
}: SelectFolderModalProps) {
const { t } = useTranslation("game_details");
const [diskFreeSpace, setDiskFreeSpace] = useState<DiskSpace>(null);
const [diskFreeSpace, setDiskFreeSpace] = useState<DiskSpace | null>(null);
const [selectedPath, setSelectedPath] = useState("");
const [downloadStarting, setDownloadStarting] = useState(false);

View file

@ -24,7 +24,7 @@ export function SearchResults() {
const [searchResults, setSearchResults] = useState<CatalogueEntry[]>([]);
const [isLoading, setIsLoading] = useState(false);
const debouncedFunc = useRef<DebouncedFunc<() => void | null>>(null);
const debouncedFunc = useRef<DebouncedFunc<() => void> | null>(null);
const navigate = useNavigate();
@ -39,7 +39,7 @@ export function SearchResults() {
debouncedFunc.current = debounce(() => {
window.electron
.searchGames(searchParams.get("query"))
.searchGames(searchParams.get("query") ?? "")
.then((results) => {
setSearchResults(results);
})

View file

@ -23,10 +23,10 @@ export function Settings() {
setForm({
downloadsPath: userPreferences?.downloadsPath || path,
downloadNotificationsEnabled:
userPreferences?.downloadNotificationsEnabled,
userPreferences?.downloadNotificationsEnabled ?? false,
repackUpdatesNotificationsEnabled:
userPreferences?.repackUpdatesNotificationsEnabled,
telemetryEnabled: userPreferences?.telemetryEnabled,
userPreferences?.repackUpdatesNotificationsEnabled ?? false,
telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
});
});
}, []);