diff --git a/psych-info-ui/package-lock.json b/psych-info-ui/package-lock.json index a8e481d..f16ad80 100644 --- a/psych-info-ui/package-lock.json +++ b/psych-info-ui/package-lock.json @@ -13,6 +13,7 @@ "@mui/icons-material": "^5.14.12", "@mui/material": "^5.14.12", "@reduxjs/toolkit": "^1.9.7", + "encoding": "^0.1.13", "firebase": "^10.4.0", "i18next": "^23.5.1", "next": "13.5.4", @@ -1519,6 +1520,14 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1677,6 +1686,17 @@ "@babel/runtime": "^7.22.5" } }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/idb": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", @@ -2184,6 +2204,11 @@ } ] }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "node_modules/scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", diff --git a/psych-info-ui/package.json b/psych-info-ui/package.json index c7dbc47..15562c1 100644 --- a/psych-info-ui/package.json +++ b/psych-info-ui/package.json @@ -14,6 +14,7 @@ "@mui/icons-material": "^5.14.12", "@mui/material": "^5.14.12", "@reduxjs/toolkit": "^1.9.7", + "encoding": "^0.1.13", "firebase": "^10.4.0", "i18next": "^23.5.1", "next": "13.5.4", diff --git a/psych-info-ui/src/app/Components/AdminComp/IncomingRequests.tsx b/psych-info-ui/src/app/Components/AdminComp/IncomingRequests.tsx index b07f2cb..32641d8 100644 --- a/psych-info-ui/src/app/Components/AdminComp/IncomingRequests.tsx +++ b/psych-info-ui/src/app/Components/AdminComp/IncomingRequests.tsx @@ -1,6 +1,6 @@ "use client"; import { useState, useEffect, Fragment } from "react"; -import { Content } from "@/app/General/interfaces"; +import { Content } from "@/app/general/interfaces"; import { Typography } from "@mui/material"; import RequestAccordion from "@/app/Components/AdminComp/RequestAccordion"; import { getPendingContent } from "@/app/firebase/commands"; diff --git a/psych-info-ui/src/app/Components/AdminComp/RequestAccordion.tsx b/psych-info-ui/src/app/Components/AdminComp/RequestAccordion.tsx index 27b7ee7..931228c 100644 --- a/psych-info-ui/src/app/Components/AdminComp/RequestAccordion.tsx +++ b/psych-info-ui/src/app/Components/AdminComp/RequestAccordion.tsx @@ -9,7 +9,7 @@ import { Button, } from "@mui/material"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { RequestAccordionProps } from "@/app/General/interfaces"; +import { RequestAccordionProps } from "@/app/general/interfaces"; import AccordionContent from "@/app/Components/ResultComp/AccordionContent"; import { deletePendingContent, createContent } from "@/app/firebase/commands"; diff --git a/psych-info-ui/src/app/Components/AdminComp/SigninForm.tsx b/psych-info-ui/src/app/Components/AdminComp/SigninForm.tsx index e4a0cfd..ea8489c 100644 --- a/psych-info-ui/src/app/Components/AdminComp/SigninForm.tsx +++ b/psych-info-ui/src/app/Components/AdminComp/SigninForm.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useEffect } from "react"; import { Button, TextField, Box } from "@mui/material"; -import { AdminSignInFormProps } from "@/app/General/interfaces"; +import { AdminSignInFormProps } from "@/app/general/interfaces"; function SigninForm({ handleSubmit = () => null, diff --git a/psych-info-ui/src/app/Components/ResultComp/AccordionContent.tsx b/psych-info-ui/src/app/Components/ResultComp/AccordionContent.tsx index b876eca..a433aeb 100644 --- a/psych-info-ui/src/app/Components/ResultComp/AccordionContent.tsx +++ b/psych-info-ui/src/app/Components/ResultComp/AccordionContent.tsx @@ -1,5 +1,5 @@ import { Typography, Box } from "@mui/material"; -import { Content } from "@/app/General/interfaces"; +import { Content } from "@/app/general/interfaces"; function AccordionContent({ title = "", diff --git a/psych-info-ui/src/app/Components/ResultComp/ResultPrePage.tsx b/psych-info-ui/src/app/Components/ResultComp/ResultPrePage.tsx index b19babc..520e886 100644 --- a/psych-info-ui/src/app/Components/ResultComp/ResultPrePage.tsx +++ b/psych-info-ui/src/app/Components/ResultComp/ResultPrePage.tsx @@ -4,7 +4,7 @@ import { useSelector } from "react-redux"; import { Typography, Button } from "@mui/material"; import ResultAccordion from "@/app/Components/ResultComp/ResultAccordion"; import { getContent } from "@/app/firebase/commands"; -import { Content, Operator } from "@/app/General/interfaces"; +import { Content, Operator } from "@/app/general/interfaces"; const operator = Operator.AND; diff --git a/psych-info-ui/src/app/Components/ResultComp/ShareDialog.tsx b/psych-info-ui/src/app/Components/ResultComp/ShareDialog.tsx index df19b3e..888b2c2 100644 --- a/psych-info-ui/src/app/Components/ResultComp/ShareDialog.tsx +++ b/psych-info-ui/src/app/Components/ResultComp/ShareDialog.tsx @@ -20,7 +20,7 @@ import { LinkedinIcon, TelegramIcon, } from "react-share"; -import { ShareDialogProps } from "@/app/General/interfaces"; +import { ShareDialogProps } from "@/app/general/interfaces"; function ShareDialog({ open = false, diff --git a/psych-info-ui/src/app/Components/UI/NavBar.tsx b/psych-info-ui/src/app/Components/UI/NavBar.tsx index 670139d..fb85bcb 100644 --- a/psych-info-ui/src/app/Components/UI/NavBar.tsx +++ b/psych-info-ui/src/app/Components/UI/NavBar.tsx @@ -4,7 +4,6 @@ import { AppBar, Toolbar, Typography, - Button, Select, MenuItem, Container, @@ -25,12 +24,12 @@ function Navbar() { const handleOpenMenu = () => setOpenMenu(true); const handleCloseMenu = () => setOpenMenu(false); const [authUser, setAuthUser] = useState(null); - const [width, setWidth] = useState(window?.innerWidth); + const [width, setWidth] = useState(window.innerWidth); const { user } = useContext(AuthContext); function handleWindowSizeChange() { - setWidth(); + setWidth(window.innerWidth); } useEffect(() => { diff --git a/psych-info-ui/src/app/Components/Wizard/steps/LangStep.tsx b/psych-info-ui/src/app/Components/Wizard/steps/LangStep.tsx index df0125f..c158daa 100644 --- a/psych-info-ui/src/app/Components/Wizard/steps/LangStep.tsx +++ b/psych-info-ui/src/app/Components/Wizard/steps/LangStep.tsx @@ -1,7 +1,7 @@ import { useState, useEffect, Fragment } from "react"; import { Chip, Grid, Typography } from "@mui/material"; import { Language, Tag } from "@/app/general/interfaces"; -import { GetAllDisplays, ListContainsById } from "@/app/General/utils"; +import { GetAllDisplays, ListContainsById } from "@/app/general/utils"; import { useTranslation } from "react-i18next"; interface LangStepProps { diff --git a/psych-info-ui/src/app/Components/Wizard/steps/OrgsStep.tsx b/psych-info-ui/src/app/Components/Wizard/steps/OrgsStep.tsx index 2ddd2c9..cec7d0c 100644 --- a/psych-info-ui/src/app/Components/Wizard/steps/OrgsStep.tsx +++ b/psych-info-ui/src/app/Components/Wizard/steps/OrgsStep.tsx @@ -1,7 +1,7 @@ import { useState, useEffect, Fragment } from "react"; import { Chip, Grid, Typography } from "@mui/material"; import { Organization } from "@/app/general/interfaces"; -import { GetAllDisplays, ListContainsById } from "@/app/General/utils"; +import { GetAllDisplays, ListContainsById } from "@/app/general/utils"; import { useTranslation } from "react-i18next"; interface OrganizationStepProps { diff --git a/psych-info-ui/src/app/Components/Wizard/steps/TagsStep.tsx b/psych-info-ui/src/app/Components/Wizard/steps/TagsStep.tsx index 245315f..a08b3d0 100644 --- a/psych-info-ui/src/app/Components/Wizard/steps/TagsStep.tsx +++ b/psych-info-ui/src/app/Components/Wizard/steps/TagsStep.tsx @@ -1,7 +1,7 @@ import { useState, useEffect, Fragment } from "react"; import { Chip, Grid, Typography } from "@mui/material"; import { Tag } from "@/app/general/interfaces"; -import { GetAllDisplays, ListContainsById } from "@/app/General/utils"; +import { GetAllDisplays, ListContainsById } from "@/app/general/utils"; import { useTranslation } from "react-i18next"; interface TagsStepProps { diff --git a/psych-info-ui/src/app/General/utils.tsx b/psych-info-ui/src/app/General/utils.tsx index 68f1880..3fa9683 100644 --- a/psych-info-ui/src/app/General/utils.tsx +++ b/psych-info-ui/src/app/General/utils.tsx @@ -1,4 +1,4 @@ -import { Filter, Language, Organization, StringObject, Tag } from "./interfaces"; +import { Filter, Language, Organization, StringObject, Tag } from "@/app/general/interfaces"; export function ListContainsById(StringObjectList: Tag[] | Organization[] | StringObject[], id: string): boolean { return StringObjectList.some((item) => item.id === id); diff --git a/psych-info-ui/src/app/firebase/commands.ts b/psych-info-ui/src/app/firebase/commands.ts index b1c91b9..1ec86a2 100644 --- a/psych-info-ui/src/app/firebase/commands.ts +++ b/psych-info-ui/src/app/firebase/commands.ts @@ -6,7 +6,7 @@ import { Operator, Organization, Tag, -} from "@/app/General/interfaces"; +} from "@/app/general/interfaces"; export async function getAllTags(used: boolean): Promise { try { diff --git a/psych-info-ui/src/app/firebase/utils.tsx b/psych-info-ui/src/app/firebase/utils.tsx deleted file mode 100644 index c59c565..0000000 --- a/psych-info-ui/src/app/firebase/utils.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; -import { db } from "@/app/firebase/app"; -import { ref, set, remove, update, get } from "firebase/database"; - -interface DataForDB { - title: string; - content: string; - link: string; - organization: string; - relevantTags: string[]; -} - -export const writeToDB = (path: string, data: DataForDB) => { - set(ref(db, path), data); -}; - -export const getDataFromDB = (callback: Function, path: string) => { - get(ref(db, path)) - .then((snapshot) => { - if (snapshot.exists()) { - callback(snapshot.val()); - } else { - console.log("No data available"); - } - }) - .catch((error) => { - console.error(error); - }); -}; - -export const deleteFromDB = (path: string) => { - remove(ref(db, path)); -}; - -export const updateDB = (path: string, data: DataForDB) => { - update(ref(db, path), data); -}; diff --git a/psych-info-ui/src/app/layout.tsx b/psych-info-ui/src/app/layout.tsx index bf181a2..83caab0 100644 --- a/psych-info-ui/src/app/layout.tsx +++ b/psych-info-ui/src/app/layout.tsx @@ -6,7 +6,7 @@ import AuthProvider from "@/app/context/AuthContext"; import "../i18n/config"; import { ThemeProvider } from "@mui/material/styles"; -import { appTheme } from "./General/styles"; +import { appTheme } from "./general/styles"; const inter = Inter({ subsets: ["latin"] }); diff --git a/psych-info-ui/src/app/page.tsx b/psych-info-ui/src/app/page.tsx index a04a764..1f3a241 100644 --- a/psych-info-ui/src/app/page.tsx +++ b/psych-info-ui/src/app/page.tsx @@ -5,7 +5,7 @@ import Wizrad from "@/app/Components/Wizard/Wizard"; import WelcomeMsg from "@/app/Components/UI/WelcomeMsg"; import { Provider } from "react-redux"; import store from "@/app/store"; -import { Filter } from "./General/interfaces"; +import { Filter } from "./general/interfaces"; import Gallary from "./Components/gallary/gallary"; import { GetFilters } from "./general/utils"; diff --git a/psych-info-ui/src/app/upload/page.tsx b/psych-info-ui/src/app/upload/page.tsx index c71e6d2..3891c11 100644 --- a/psych-info-ui/src/app/upload/page.tsx +++ b/psych-info-ui/src/app/upload/page.tsx @@ -16,7 +16,7 @@ import { SelectChangeEvent, Theme, } from "@mui/material"; -import { appTheme } from "@/app/General/styles"; +import { appTheme } from "@/app/general/styles"; import { AddString } from "../Components/addString"; import { Content, @@ -24,12 +24,12 @@ import { Organization, StringObject, Tag, -} from "@/app/General/interfaces"; +} from "@/app/general/interfaces"; import { EMPTY_LANGUAGE, EMPTY_ORGANIZATION, EMPTY_TAG, -} from "@/app/General/utils"; +} from "@/app/general/utils"; import { createLanguage, createOrganization,