feat: removing sentry

This commit is contained in:
Chubby Granny Chaser 2024-05-14 16:54:14 +01:00
parent 59b1f2d5a5
commit dc7591ee28
77 changed files with 161 additions and 7545 deletions

View file

@ -17,7 +17,6 @@ import {
setSearch,
clearSearch,
setUserPreferences,
setRepackersFriendlyNames,
toggleDraggingDisabled,
} from "@renderer/features";
import { GameStatusHelper } from "@shared";
@ -45,14 +44,11 @@ export function App({ children }: AppProps) {
);
useEffect(() => {
Promise.all([
window.electron.getUserPreferences(),
window.electron.getRepackersFriendlyNames(),
updateLibrary(),
]).then(([preferences, repackersFriendlyNames]) => {
dispatch(setUserPreferences(preferences));
dispatch(setRepackersFriendlyNames(repackersFriendlyNames));
});
Promise.all([window.electron.getUserPreferences(), updateLibrary()]).then(
([preferences]) => {
dispatch(setUserPreferences(preferences));
}
);
}, [navigate, location.pathname, dispatch, updateLibrary]);
useEffect(() => {

View file

@ -5,7 +5,6 @@ import SteamLogo from "@renderer/assets/steam-logo.svg?react";
import EpicGamesLogo from "@renderer/assets/epic-games-logo.svg?react";
import * as styles from "./game-card.css";
import { useAppSelector } from "@renderer/hooks";
import { useTranslation } from "react-i18next";
export interface GameCardProps
@ -24,10 +23,6 @@ const shopIcon = {
export function GameCard({ game, ...props }: GameCardProps) {
const { t } = useTranslation("game_card");
const repackersFriendlyNames = useAppSelector(
(state) => state.repackersFriendlyNames.value
);
const uniqueRepackers = Array.from(
new Set(game.repacks.map(({ repacker }) => repacker))
);
@ -47,7 +42,7 @@ export function GameCard({ game, ...props }: GameCardProps) {
<ul className={styles.downloadOptions}>
{uniqueRepackers.map((repacker) => (
<li key={repacker} className={styles.downloadOption}>
<span>{repackersFriendlyNames[repacker]}</span>
<span>{repacker}</span>
</li>
))}
</ul>

View file

@ -122,36 +122,3 @@ export const section = style({
flexDirection: "column",
paddingBottom: `${SPACING_UNIT}px`,
});
export const sidebarFooter = style({
marginTop: "auto",
padding: `${SPACING_UNIT * 2}px`,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
});
export const footerSocialsContainer = style({
display: "flex",
alignItems: "center",
gap: `${SPACING_UNIT * 1.5}px`,
});
export const footerSocialsItem = style({
color: vars.color.bodyText,
backgroundColor: vars.color.darkBackground,
width: "16px",
height: "16px",
display: "flex",
alignItems: "center",
transition: "all ease 0.2s",
cursor: "pointer",
":hover": {
opacity: "0.75",
},
});
export const footerText = style({
color: vars.color.bodyText,
fontSize: "12px",
});

View file

@ -9,10 +9,6 @@ import { useDownload, useLibrary } from "@renderer/hooks";
import { routes } from "./routes";
import { MarkGithubIcon } from "@primer/octicons-react";
import TelegramLogo from "@renderer/assets/telegram-icon.svg?react";
import XLogo from "@renderer/assets/x-icon.svg?react";
import * as styles from "./sidebar.css";
import { GameStatus, GameStatusHelper } from "@shared";
import { buildGameDetailsPath } from "@renderer/helpers";
@ -35,24 +31,6 @@ export function Sidebar() {
initialSidebarWidth ? Number(initialSidebarWidth) : SIDEBAR_INITIAL_WIDTH
);
const socials = [
{
url: "https://t.me/hydralauncher",
icon: <TelegramLogo />,
label: t("telegram"),
},
{
url: "https://twitter.com/hydralauncher",
icon: <XLogo />,
label: t("x"),
},
{
url: "https://github.com/hydralauncher/hydra",
icon: <MarkGithubIcon size={16} />,
label: t("github"),
},
];
const location = useLocation();
const { game: gameDownloading, progress } = useDownload();
@ -233,26 +211,6 @@ export function Sidebar() {
className={styles.handle}
onMouseDown={handleMouseDown}
/>
<footer className={styles.sidebarFooter}>
<div className={styles.footerText}>{t("follow_us")}</div>
<span className={styles.footerSocialsContainer}>
{socials.map((item) => {
return (
<button
key={item.url}
className={styles.footerSocialsItem}
onClick={() => window.electron.openExternal(item.url)}
title={item.label}
aria-label={item.label}
>
{item.icon}
</button>
);
})}
</span>
</footer>
</aside>
);
}

View file

@ -62,7 +62,6 @@ declare global {
executablePath: string | null
) => Promise<void>;
getLibrary: () => Promise<Game[]>;
getRepackersFriendlyNames: () => Promise<Record<string, string>>;
openGameInstaller: (gameId: number) => Promise<boolean>;
openGame: (gameId: number, executablePath: string) => Promise<void>;
closeGame: (gameId: number) => Promise<boolean>;

View file

@ -2,7 +2,7 @@ import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
import type { TorrentProgress } from "@types";
interface DownloadState {
export interface DownloadState {
lastPacket: TorrentProgress | null;
gameId: number | null;
gamesWithDeletionInProgress: number[];

View file

@ -1,5 +1,4 @@
export * from "./search-slice";
export * from "./repackers-friendly-names-slice";
export * from "./library-slice";
export * from "./use-preferences-slice";
export * from "./download-slice";

View file

@ -3,7 +3,7 @@ import type { PayloadAction } from "@reduxjs/toolkit";
import type { Game } from "@types";
interface LibraryState {
export interface LibraryState {
value: Game[];
}

View file

@ -1,26 +0,0 @@
import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
interface RepackersFriendlyNamesState {
value: Record<string, string>;
}
const initialState: RepackersFriendlyNamesState = {
value: {},
};
export const repackersFriendlyNamesSlice = createSlice({
name: "repackersFriendlyNames",
initialState,
reducers: {
setRepackersFriendlyNames: (
state,
action: PayloadAction<RepackersFriendlyNamesState["value"]>
) => {
state.value = action.payload;
},
},
});
export const { setRepackersFriendlyNames } =
repackersFriendlyNamesSlice.actions;

View file

@ -1,7 +1,7 @@
import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
interface SearchState {
export interface SearchState {
value: string;
}

View file

@ -2,7 +2,7 @@ import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
import type { UserPreferences } from "@types";
interface UserPreferencesState {
export interface UserPreferencesState {
value: UserPreferences | null;
}

View file

@ -1,7 +1,7 @@
import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
interface WindowState {
export interface WindowState {
draggingDisabled: boolean;
headerTitle: string;
}

View file

@ -6,9 +6,6 @@ import { Provider } from "react-redux";
import LanguageDetector from "i18next-browser-languagedetector";
import { HashRouter, Route, Routes } from "react-router-dom";
import { init } from "@sentry/electron/renderer";
import { init as reactInit } from "@sentry/react";
import "@fontsource/fira-mono/400.css";
import "@fontsource/fira-mono/500.css";
import "@fontsource/fira-mono/700.css";
@ -31,21 +28,6 @@ import { store } from "./store";
import * as resources from "@locales";
if (import.meta.env.RENDERER_VITE_SENTRY_DSN) {
init(
{
dsn: import.meta.env.RENDERER_VITE_SENTRY_DSN,
beforeSend: async (event) => {
const userPreferences = await window.electron.getUserPreferences();
if (userPreferences?.telemetryEnabled) return event;
return null;
},
},
reactInit
);
}
i18n
.use(LanguageDetector)
.use(initReactI18next)

View file

@ -1,60 +1,15 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
import { ShareAndroidIcon } from "@primer/octicons-react";
import { Button } from "@renderer/components";
import type { ShopDetails } from "@types";
import * as styles from "./game-details.css";
const OPEN_HYDRA_URL = "https://open.hydralauncher.site";
export interface DescriptionHeaderProps {
gameDetails: ShopDetails;
}
export function DescriptionHeader({ gameDetails }: DescriptionHeaderProps) {
const [clipboardLocked, setClipboardLocked] = useState(false);
const { t, i18n } = useTranslation("game_details");
const { objectID, shop } = useParams();
useEffect(() => {
if (!gameDetails) return setClipboardLocked(true);
setClipboardLocked(false);
}, [gameDetails]);
const handleCopyToClipboard = () => {
if (gameDetails) {
setClipboardLocked(true);
const searchParams = new URLSearchParams({
p: btoa(
JSON.stringify([
objectID,
shop,
encodeURIComponent(gameDetails.name),
i18n.language,
])
),
});
navigator.clipboard.writeText(
OPEN_HYDRA_URL + `/?${searchParams.toString()}`
);
const zero = performance.now();
requestAnimationFrame(function holdLock(time) {
if (time - zero <= 3000) {
requestAnimationFrame(holdLock);
} else {
setClipboardLocked(false);
}
});
}
};
const { t } = useTranslation("game_details");
return (
<div className={styles.descriptionHeader}>
@ -66,21 +21,6 @@ export function DescriptionHeader({ gameDetails }: DescriptionHeaderProps) {
</p>
<p>{t("publisher", { publisher: gameDetails.publishers[0] })}</p>
</section>
<Button
theme="outline"
onClick={handleCopyToClipboard}
disabled={clipboardLocked || !gameDetails}
>
{clipboardLocked ? (
t("copied_link_to_clipboard")
) : (
<>
<ShareAndroidIcon />
{t("copy_link_to_clipboard")}
</>
)}
</Button>
</div>
);
}

View file

@ -47,10 +47,19 @@ export function HeroPanelActions({
const { t } = useTranslation("game_details");
const getDownloadsPath = async () => {
const userPreferences = await window.electron.getUserPreferences();
if (userPreferences?.downloadsPath) return userPreferences.downloadsPath;
return window.electron.getDefaultDownloadsPath();
};
const selectGameExecutable = async () => {
const downloadsPath = await getDownloadsPath();
return window.electron
.showOpenDialog({
properties: ["openFile"],
defaultPath: downloadsPath,
filters: [
{
name: "Game executable",

View file

@ -6,7 +6,6 @@ import type { GameRepack } from "@types";
import * as styles from "./repacks-modal.css";
import { useAppSelector } from "@renderer/hooks";
import { SPACING_UNIT } from "../../theme.css";
import { format } from "date-fns";
import { SelectFolderModal } from "./select-folder-modal";
@ -28,10 +27,6 @@ export function RepacksModal({
const [repack, setRepack] = useState<GameRepack | null>(null);
const [showSelectFolderModal, setShowSelectFolderModal] = useState(false);
const repackersFriendlyNames = useAppSelector(
(state) => state.repackersFriendlyNames.value
);
const { t } = useTranslation("game_details");
useEffect(() => {
@ -87,7 +82,7 @@ export function RepacksModal({
>
<p style={{ color: "#DADBE1" }}>{repack.title}</p>
<p style={{ fontSize: "12px" }}>
{repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "}
{repack.fileSize} - {repack.repacker} -{" "}
{repack.uploadDate
? format(repack.uploadDate, "dd/MM/yyyy")
: ""}

View file

@ -19,7 +19,6 @@ export function SettingsGeneral({
downloadsPath: "",
downloadNotificationsEnabled: false,
repackUpdatesNotificationsEnabled: false,
telemetryEnabled: false,
});
useEffect(() => {
@ -28,7 +27,6 @@ export function SettingsGeneral({
downloadsPath,
downloadNotificationsEnabled,
repackUpdatesNotificationsEnabled,
telemetryEnabled,
} = userPreferences;
window.electron.getDefaultDownloadsPath().then((defaultDownloadsPath) => {
@ -37,7 +35,6 @@ export function SettingsGeneral({
downloadsPath: downloadsPath ?? defaultDownloadsPath,
downloadNotificationsEnabled,
repackUpdatesNotificationsEnabled,
telemetryEnabled,
}));
});
}
@ -104,18 +101,6 @@ export function SettingsGeneral({
})
}
/>
<h3>{t("telemetry")}</h3>
<CheckboxField
label={t("telemetry_description")}
checked={form.telemetryEnabled}
onChange={() =>
handleChange({
telemetryEnabled: !form.telemetryEnabled,
})
}
/>
</>
);
}

View file

@ -3,7 +3,6 @@ import {
downloadSlice,
windowSlice,
librarySlice,
repackersFriendlyNamesSlice,
searchSlice,
userPreferencesSlice,
} from "@renderer/features";
@ -11,7 +10,6 @@ import {
export const store = configureStore({
reducer: {
search: searchSlice.reducer,
repackersFriendlyNames: repackersFriendlyNamesSlice.reducer,
window: windowSlice.reducer,
library: librarySlice.reducer,
userPreferences: userPreferencesSlice.reducer,

View file

@ -1,10 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
interface ImportMetaEnv {
readonly RENDERER_VITE_SENTRY_DSN: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}