diff --git a/jsconfig.json b/jsconfig.json index dd88096ec..b154aa300 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "baseUrl": "./src", - "checkJs": true, + "checkJs": false, "jsx": "react" }, "exclude": ["node_modules", "**/node_modules", "dist", "build"] diff --git a/package-lock.json b/package-lock.json index b6437b2d9..f4da796a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "weverify-plugin", - "version": "0.81", + "version": "0.82", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "weverify-plugin", - "version": "0.81", + "version": "0.82", "license": "ISC", "dependencies": { "@date-io/moment": "^2.17.0", diff --git a/package.json b/package.json index 7a9d3b5bc..b58cafab7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "weverify-plugin", - "version": "0.81", + "version": "0.82", "description": "", "main": "index.js", "scripts": { diff --git a/public/manifest.json b/public/manifest.json index b2e68fb63..c69caba88 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Fake news debunker by InVID & WeVerify", - "version": "0.81", + "version": "0.82", "description": "InVID WeVerify extension", "short_name": "Verification Plugin", "action": { diff --git a/src/App.jsx b/src/App.jsx index aad73ee0a..165835ba7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react"; import { createTheme, ThemeProvider } from "@mui/material/styles"; import { HashRouter, Route, Routes } from "react-router-dom"; import PopUp from "./components/PopUp/PopUp"; -import NavBar from "./components/NavBar/NavBar"; import useAuthenticationAPI from "./components/Shared/Authentication/useAuthenticationAPI"; import { useDispatch } from "react-redux"; import { @@ -10,6 +9,7 @@ import { setErrorNetwork, } from "redux/reducers/errorReducer"; import { i18nLoadNamespace } from "components/Shared/Languages/i18nLoadNamespace"; +import ApplicationLayout from "./components/ApplicationLayout"; const theme = createTheme({ palette: { @@ -103,7 +103,7 @@ const App = () => { } /> - } /> + } /> diff --git a/src/Hooks/useAnalytics.jsx b/src/Hooks/useAnalytics.jsx index 932c2b50a..d040e3fdf 100644 --- a/src/Hooks/useAnalytics.jsx +++ b/src/Hooks/useAnalytics.jsx @@ -1,14 +1,14 @@ import { useSelector } from "react-redux"; import { useEffect } from "react"; import { - trackPageView, - trackPageViewAnonymous, trackEvent, trackEventAnonymous, + trackPageView, + trackPageViewAnonymous, } from "../components/Shared/GoogleAnalytics/MatomoAnalytics"; import { history } from "../components/Shared/History/History"; -export const useTrackPageView = (path, client_id, uid, index) => { +export const useTrackPageView = (path, client_id, uid, toolName) => { const analytics = useSelector((state) => state.cookies.analytics); useEffect(() => { //console.log("general page view"); @@ -18,7 +18,7 @@ export const useTrackPageView = (path, client_id, uid, index) => { } else { trackPageViewAnonymous(path, history); } - }, [index]); + }, [toolName]); }; export const useTrackEvent = ( diff --git a/src/components/ApplicationLayout/index.jsx b/src/components/ApplicationLayout/index.jsx new file mode 100644 index 000000000..a83ed64f2 --- /dev/null +++ b/src/components/ApplicationLayout/index.jsx @@ -0,0 +1,93 @@ +import React, { useState } from "react"; +import NotificationSnackbar from "../NotificationSnackbar"; +import { createTheme, ThemeProvider } from "@mui/material/styles"; +import TopMenu from "../TopMenu"; +import { TOP_MENU_ITEMS } from "../../constants/topMenuItems"; +import SideMenu from "../SideMenu"; +import { tools } from "../../constants/tools"; +import MainContent from "../MainContent"; +import useMyStyles from "../Shared/MaterialUiStyles/useMyStyles"; + +const ApplicationLayout = () => { + const theme = createTheme({ + palette: { + primary: { + light: "#00926c", + main: "#00926c", + dark: "#00926c", + contrastText: "#fff", + }, + }, + components: { + MuiAppBar: { + styleOverrides: { + colorPrimary: { + backgroundColor: "#ffffff", + }, + root: { + zIndex: 1300, + height: "87px", + boxShadow: "none", + paddingTop: "12px", + }, + }, + }, + MuiListItem: { + styleOverrides: { + gutters: { + paddingLeft: "26px", + }, + }, + }, + MuiAutocomplete: { + styleOverrides: { + popupIndicatorOpen: { + transform: "none!important", + }, + popper: { + zIndex: 99999, + }, + }, + }, + MuiCard: { + styleOverrides: { + root: { + borderRadius: "10px!important", + }, + }, + }, + MuiIconButton: { + styleOverrides: { + root: { + padding: 0, + }, + }, + }, + MuiTab: { + styleOverrides: { + root: { + minWidth: "160px", + }, + }, + }, + }, + }); + + // Used to display warning messages + const [openAlert, setOpenAlert] = useState(false); + + const classes = useMyStyles(); + + return ( +
+ + + + + + +
+ ); +}; + +export default ApplicationLayout; diff --git a/src/components/MainContent/index.jsx b/src/components/MainContent/index.jsx new file mode 100644 index 000000000..3ee3665bb --- /dev/null +++ b/src/components/MainContent/index.jsx @@ -0,0 +1,194 @@ +import React from "react"; +import MainContentMenuTopMenuItems from "../NavBar/MainContentMenuTabItems/MainContentMenuTopMenuItems"; +import ScrollTop from "../Shared/ScrollTop/ScrollTop"; +import { createTheme, ThemeProvider } from "@mui/material/styles"; +import { Button, Fab, Snackbar } from "@mui/material"; +import { KeyboardArrowUp } from "@mui/icons-material"; +import MySnackbar from "../MySnackbar/MySnackbar"; +import { + cleanError, + cleanErrorNetwork, +} from "../../redux/reducers/errorReducer"; +import { setFalse, setTrue } from "../../redux/reducers/cookiesReducers"; +import Feedback from "../Feedback/Feedback"; +import useMyStyles from "../Shared/MaterialUiStyles/useMyStyles"; +import { TOOL_STATUS_ICON } from "../../constants/tools"; +import { useDispatch, useSelector } from "react-redux"; +import { i18nLoadNamespace } from "../Shared/Languages/i18nLoadNamespace"; +import { TOP_MENU_ITEMS } from "../../constants/topMenuItems"; + +/** + * + * @param tools {Tool[]} + * @returns {Element} + * @constructor + */ +const MainContent = ({ tools }) => { + const classes = useMyStyles(); + + const keyword = i18nLoadNamespace("components/NavBar"); + + const dispatch = useDispatch(); + + const currentLang = useSelector((state) => state.language); + const isCurrentLanguageLeftToRight = currentLang !== "ar"; + + const error = useSelector((state) => state.error.tools); + const errorNetwork = useSelector((state) => state.error.network); + + const cookiesUsage = useSelector((state) => state.cookies); + + const role = useSelector((state) => state.userSession.user.roles); + + const toolsAllowedForRole = tools.filter((tool) => { + if ( + !tool.rolesNeeded || + tool.rolesNeeded.length === 0 || + tool.rolesNeeded.includes(TOOL_STATUS_ICON.LOCK) + ) + return true; + else if (tool.rolesNeeded.some((restriction) => role.includes(restriction))) + return true; + else return false; + }); + + const themeFab = createTheme({ + palette: { + primary: { + light: "#00926c", + main: "#00926c", + dark: "#00926c", + contrastText: "#fff", + }, + }, + components: { + MuiAppBar: { + styleOverrides: { + colorPrimary: { + backgroundColor: "#ffffff", + }, + root: { + zIndex: 1300, + height: "87px", + boxShadow: "none", + paddingTop: "12px", + }, + }, + }, + MuiListItem: { + styleOverrides: { + gutters: { + paddingLeft: "26px", + }, + }, + }, + MuiAutocomplete: { + styleOverrides: { + popupIndicatorOpen: { + transform: "none!important", + }, + popper: { + zIndex: 99999, + }, + }, + }, + MuiCard: { + styleOverrides: { + root: { + borderRadius: "10px!important", + }, + }, + }, + MuiIconButton: { + styleOverrides: { + root: { + padding: 0, + }, + }, + }, + MuiTab: { + styleOverrides: { + root: { + minWidth: "160px", + }, + }, + }, + }, + }); + + return ( +
+
+ + + + + + + + + {error !== null && ( + dispatch(cleanError())} + onClose={() => {}} + sx={{ mr: 8 }} + /> + )} + {errorNetwork !== null && ( + dispatch(cleanErrorNetwork())} + onClose={() => {}} + sx={{ mr: 8 }} + /> + )} + {cookiesUsage.active === null && ( + dispatch(setFalse())} + > + {" "} + {keyword("cookies_decline")}{" "} + , + , + ]} + /> + )} + +
+ ); +}; + +export default MainContent; diff --git a/src/components/NavBar/DrawerItem/DrawerItem.jsx b/src/components/NavBar/DrawerItem/DrawerItem.jsx index 9bd7eece7..c0b9bea9d 100644 --- a/src/components/NavBar/DrawerItem/DrawerItem.jsx +++ b/src/components/NavBar/DrawerItem/DrawerItem.jsx @@ -1,164 +1,45 @@ import React, { useEffect } from "react"; -import PropTypes from "prop-types"; import { Container } from "@mui/material"; import Fade from "@mui/material/Fade"; import { useDispatch, useSelector } from "react-redux"; -import { selectTool } from "../../../redux/reducers/tools/toolReducer"; -import MainContentMenu from "../../NavItems/tools/Alltools/MainContentMenu"; -import Analysis from "../../NavItems/tools/Analysis/Analysis"; -import Keyframes from "../../NavItems/tools/Keyframes/Keyframes"; -import Thumbnails from "../../NavItems/tools/Thumbnails/Thumbnails"; -import TwitterAdvancedSearch from "../../NavItems/tools/TwitterAdvancedSearch/TwitterAdvancedSearch"; -import Magnifier from "../../NavItems/tools/Magnifier/Magnifier"; -import Metadata from "../../NavItems/tools/Metadata/Metadata"; -import VideoRights from "../../NavItems/tools/VideoRights/VideoRights"; -import Forensic from "../../NavItems/tools/Forensic/Forensic"; import { Route, Routes, useLocation } from "react-router-dom"; -import { Footer, FOOTER_TYPES } from "../../Shared/Footer/Footer"; -import TwitterSna from "../../NavItems/tools/TwitterSna/TwitterSna"; -import OCR from "../../NavItems/tools/OCR/OCR"; -import CheckGif from "../../NavItems/tools/Gif/CheckGif"; -import DeepfakeImage from "../../NavItems/tools/Deepfake/DeepfakeImage"; -import DeepfakeVideo from "../../NavItems/tools/Deepfake/DeepfakeVideo"; -import SyntheticImageDetection from "../../NavItems/tools/SyntheticImageDetection"; -import Geolocation from "../../NavItems/tools/Geolocation/Geolocation"; import useMyStyles from "../../Shared/MaterialUiStyles/useMyStyles"; import { createTheme, ThemeProvider } from "@mui/material/styles"; -import AnalysisImg from "../../NavItems/tools/Analysis_images/Analysis"; import { getclientId } from "../../Shared/GoogleAnalytics/MatomoAnalytics"; import { useTrackPageView } from "../../../Hooks/useAnalytics"; -import Archive from "../../NavItems/tools/Archive"; -import SemanticSearch from "../../NavItems/tools/SemanticSearch"; -import Loccus from "../../NavItems/tools/Loccus"; - -const DrawerItem = ({ toolsList }) => { - const drawerItemsContent = [ - { - content: , - footer:
, - }, - { - content: , - footer: