Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
691 changes: 346 additions & 345 deletions .yarn/releases/yarn-4.6.0.cjs → .yarn/releases/yarn-4.8.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.6.0.cjs
yarnPath: .yarn/releases/yarn-4.8.1.cjs
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,30 @@
"preview": "vite preview"
},
"dependencies": {
"@mantine/core": "^7.16.1",
"@mantine/dropzone": "^7.16.1",
"@mantine/hooks": "^7.16.1",
"@mantine/notifications": "^7.16.1",
"@tabler/icons-react": "^3.28.1",
"@mantine/core": "^7.17.3",
"@mantine/dropzone": "^7.17.3",
"@mantine/hooks": "^7.17.3",
"@mantine/notifications": "^7.17.3",
"@tabler/icons-react": "^3.31.0",
"compressorjs": "^1.2.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-ga4": "^2.1.0",
"react-router-dom": "^7.1.3"
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.4.1"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@eslint/compat": "^1.2.7",
"@eslint/js": "^9.23.0",
"@types/react": "^19.0.12",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.18.0",
"eslint": "^9.23.0",
"eslint-plugin-react": "^7.37.4",
"globals": "^15.14.0",
"postcss": "^8.5.1",
"globals": "^16.0.0",
"postcss": "^8.5.3",
"postcss-preset-mantine": "^1.17.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.4.2",
"vite": "^6.0.9"
"prettier": "^3.5.3",
"vite": "^6.2.3"
},
"packageManager": "yarn@4.6.0"
"packageManager": "yarn@4.8.1"
}
56 changes: 4 additions & 52 deletions src/components/App/index.jsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,28 @@
import React, { useEffect, useContext, Suspense, lazy, useState } from "react";
import React, { useEffect, useContext, Suspense, lazy } from "react";
import HeaderBar from "../HeaderBar";
import { Center, Loader, useMantineColorScheme } from "@mantine/core";
import { AppShell } from "@mantine/core";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Footer from "../Footer/index.jsx";
import { MainContext } from "../../context/MainContextProvider";
import ReactGA from "react-ga4";
import { setAllowCookies } from "../../reducer/MainReducer/Actions/index.js";
import CookieNotice from "../CookieNotice/index.jsx";

const Home = lazy(() => import("../../routes/Home"));
const About = lazy(() => import("../../routes/About"));
const NotFound = lazy(() => import("../../routes/NotFound"));

const App = () => {
const [state, d1] = useContext(MainContext);
const [state] = useContext(MainContext);
const { setColorScheme } = useMantineColorScheme();

const { themeType, allowCookies, hasSetCookies } = state;

const [cookieBannerOpen, setCookieBannerOpen] = useState(!hasSetCookies);

/**
* Close the cookie banner
*/
const closeCookieBanner = () => {
setCookieBannerOpen(false);
};

/**
* Accept cookies
*/
const acceptCookies = () => {
d1(setAllowCookies(true));
setCookieBannerOpen(false);
};

/**
* Decline cookies
*/
const declineCookies = () => {
d1(setAllowCookies(false));
setCookieBannerOpen(false);
};
const { themeType } = state;

useEffect(() => {
setColorScheme(themeType);
}, []);

useEffect(() => {
if (allowCookies) {
ReactGA.initialize("G-YQZGPHN1BH");
window["ga-disable-G-YQZGPHN1BH"] = false;
} else {
window["ga-disable-G-YQZGPHN1BH"] = true;
}
}, [allowCookies]);

return (
<BrowserRouter>
<AppShell
header={{ height: 60 }}
footer={{ height: 115 }}
padding="md"
>
<AppShell header={{ height: 60 }} footer={{ height: 115 }} padding="md">
<AppShell.Header>
<HeaderBar />
</AppShell.Header>
Expand All @@ -82,13 +41,6 @@ const App = () => {
</Routes>
</Suspense>
</AppShell.Main>
{cookieBannerOpen ? (
<CookieNotice
onAccept={acceptCookies}
onDecline={declineCookies}
onClose={closeCookieBanner}
/>
) : null}
<AppShell.Footer>
<Footer />
</AppShell.Footer>
Expand Down
66 changes: 0 additions & 66 deletions src/components/CookieNotice/index.jsx

This file was deleted.

14 changes: 6 additions & 8 deletions src/components/DropzoneButton/index.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React, { useRef } from "react";
import {
Text,
Group,
Button,
useMantineTheme,
Popover,
} from "@mantine/core";
import { Text, Group, Button, useMantineTheme, Popover } from "@mantine/core";
import { Dropzone, MIME_TYPES } from "@mantine/dropzone";
import { IconCloudUpload, IconX, IconDownload } from "@tabler/icons-react";
import classes from "./dropzonebutton.module.css";
Expand Down Expand Up @@ -35,7 +29,11 @@ const DropzoneButton = ({ popOverOpen, setPopOverOpen, changeFiles }) => {
<div style={{ pointerEvents: "none" }}>
<Group justify="center">
<Dropzone.Accept>
<IconDownload size={50} color={theme.colors.blue[6]} stroke={1.5} />
<IconDownload
size={50}
color={theme.colors.blue[6]}
stroke={1.5}
/>
</Dropzone.Accept>
<Dropzone.Reject>
<IconX size={50} color={theme.colors.red[6]} stroke={1.5} />
Expand Down
9 changes: 0 additions & 9 deletions src/context/MainContextProvider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,10 @@ import { createContext, useReducer } from "react";
import MainReducer from "../../reducer/MainReducer/index.jsx";

const themeType = localStorage.themeType ? localStorage.themeType : "auto";
let hasSetCookies = false;
let allowCookies = true;

if (localStorage.allowCookies) {
allowCookies = localStorage.allowCookies === "true";
hasSetCookies = true;
}

const initialState = {
pageIndex: 0,
themeType,
allowCookies,
hasSetCookies,
};

export const MainContext = createContext(initialState);
Expand Down
1 change: 0 additions & 1 deletion src/reducer/MainReducer/Actions/ActionTypes/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export const SET_PAGE_INDEX = "SET_PAGE_INDEX";
export const SET_THEME_TYPE = "SET_THEME_TYPE";
export const SET_ALLOW_COOKIES = "SET_ALLOW_COOKIES";
11 changes: 1 addition & 10 deletions src/reducer/MainReducer/Actions/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
SET_ALLOW_COOKIES,
SET_PAGE_INDEX,
SET_THEME_TYPE,
} from "./ActionTypes/index.js";
import { SET_PAGE_INDEX, SET_THEME_TYPE } from "./ActionTypes/index.js";

export const setPageIndex = (index) => ({
type: SET_PAGE_INDEX,
Expand All @@ -13,8 +9,3 @@ export const setThemeType = (type) => ({
type: SET_THEME_TYPE,
payload: type,
});

export const setAllowCookies = (allow) => ({
type: SET_ALLOW_COOKIES,
payload: allow,
});
12 changes: 1 addition & 11 deletions src/reducer/MainReducer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
SET_ALLOW_COOKIES,
SET_PAGE_INDEX,
SET_THEME_TYPE,
} from "./Actions/ActionTypes/index.js";
import { SET_PAGE_INDEX, SET_THEME_TYPE } from "./Actions/ActionTypes/index.js";

const MainReducer = (state, action) => {
switch (action.type) {
Expand All @@ -17,12 +13,6 @@ const MainReducer = (state, action) => {
...state,
themeType: action.payload,
};
case SET_ALLOW_COOKIES:
localStorage.allowCookies = action.payload;
return {
...state,
allowCookies: action.payload,
};
default:
throw new Error();
}
Expand Down
12 changes: 1 addition & 11 deletions src/routes/About/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@ import { Accordion, Container, Title } from "@mantine/core";
import { MainContext } from "../../context/MainContextProvider/index.jsx";
import { setPageIndex } from "../../reducer/MainReducer/Actions/index.js";
import AboutCard from "../../components/AboutCard/index.jsx";
import ReactGA from "react-ga4";

const About = () => {
const [state, d1] = useContext(MainContext);
const { allowCookies } = state;
const [, d1] = useContext(MainContext);

useEffect(() => {
d1(setPageIndex(1));
document.title = "About | Compressr";

if (allowCookies) {
ReactGA.send({
hitType: "pageview",
page: "/about",
title: "About | Compressr",
});
}
}, []);

return (
Expand Down
12 changes: 1 addition & 11 deletions src/routes/Home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import classes from "./home.module.css";
import { IconCircleLetterX, IconSword } from "@tabler/icons-react";
import { notifications } from "@mantine/notifications";
import Compressor from "compressorjs";
import ReactGA from "react-ga4";

const Home = () => {
const [files, setFiles] = useState(null);
const [popOverOpen, setPopOverOpen] = useState(false);
const [quality, setQuality] = useState(65);

const [state, d1] = useContext(MainContext);
const { allowCookies } = state;
const [, d1] = useContext(MainContext);

/**
* Change the popover open state
Expand Down Expand Up @@ -77,14 +75,6 @@ const Home = () => {
useEffect(() => {
d1(setPageIndex(0));
document.title = "Home | Compressr";

if (allowCookies) {
ReactGA.send({
hitType: "pageview",
page: "/",
title: "Home | Compressr",
});
}
}, []);

return (
Expand Down
15 changes: 1 addition & 14 deletions src/routes/NotFound/index.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import React, { useContext, useEffect } from "react";
import React, { useEffect } from "react";
import { Title, Text, Button, Container, Group } from "@mantine/core";
import classes from "./notfound.module.css";
import { useNavigate } from "react-router-dom";
import ReactGA from "react-ga4";
import { MainContext } from "../../context/MainContextProvider/index.jsx";

const NotFound = () => {
const [state] = useContext(MainContext);
const navigate = useNavigate();

const { allowCookies } = state;

/**
* Go to the home page
*/
Expand All @@ -20,14 +15,6 @@ const NotFound = () => {

useEffect(() => {
document.title = "Not Found | Compressr";

if (allowCookies) {
ReactGA.send({
hitType: "pageview",
page: "/not-found",
title: "Not Found | Compressr",
});
}
}, []);

return (
Expand Down
Loading