From 48339eb376fe2f519422bd805db1cf77a2f597c8 Mon Sep 17 00:00:00 2001 From: Krishnansh5 <5272.krishnansh@gmail.com> Date: Wed, 17 Jan 2024 00:03:35 +0530 Subject: [PATCH] changes for prod --- Dockerfile | 2 +- components/Layouts/LayoutWrapper.tsx | 13 +- components/Layouts/MasterLayout.tsx | 1 - components/Parser/parser.ts | 7 +- components/Utils/MatrixCondensed.tsx | 248 +++++++++--------- components/Utils/MatrixExpanded.tsx | 6 +- pages/admin/companyHR/index.tsx | 8 + .../rc/[rcid]/company/[companyId]/index.tsx | 17 +- .../rc/[rcid]/proforma/[proformaid]/index.tsx | 6 +- pages/admin/rc/[rcid]/stats.tsx | 1 - .../rc/[rcid]/proforma/[proformaid]/index.tsx | 9 +- scripts/production.sh | 2 +- 12 files changed, 150 insertions(+), 170 deletions(-) diff --git a/Dockerfile b/Dockerfile index 763b235..8775121 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ RUN git clone --depth 1 https://github.com/PhD-PAS/PhD-PAS-frontend.git . EXPOSE 80 # Run script -CMD [ "/home/ras/scripts/production.sh" ] +CMD bash /home/ras/scripts/production.sh diff --git a/components/Layouts/LayoutWrapper.tsx b/components/Layouts/LayoutWrapper.tsx index f2dd050..3ba65c7 100644 --- a/components/Layouts/LayoutWrapper.tsx +++ b/components/Layouts/LayoutWrapper.tsx @@ -7,7 +7,6 @@ import BarChartIcon from "@mui/icons-material/BarChart"; import CalendarMonthIcon from "@mui/icons-material/CalendarMonth"; import EqualizerIcon from "@mui/icons-material/Equalizer"; import FeedIcon from "@mui/icons-material/Feed"; -import LightbulbIcon from "@mui/icons-material/Lightbulb"; import PieChartIcon from "@mui/icons-material/PieChart"; import TravelExploreIcon from "@mui/icons-material/TravelExplore"; import { useRouter } from "next/router"; @@ -427,12 +426,12 @@ function LayoutWrapper({ children }: { children: JSX.Element }) { // role === 100 || role === 101 // ? // { avatar: <>, name: "", id: "", hidden: true } - // ? { - // avatar: , - // name: "User Database", - // id: "/users", - // } - // : { avatar: <>, name: "", id: "", hidden: true }, + // ? { + // avatar: , + // name: "User Database", + // id: "/users", + // } + // : { avatar: <>, name: "", id: "", hidden: true }, // role === 100 || role === 101 // ? { // avatar: , diff --git a/components/Layouts/MasterLayout.tsx b/components/Layouts/MasterLayout.tsx index 36c513e..4c6024a 100644 --- a/components/Layouts/MasterLayout.tsx +++ b/components/Layouts/MasterLayout.tsx @@ -1,5 +1,4 @@ import styled from "@emotion/styled"; -import CallIcon from "@mui/icons-material/Call"; import LogoutIcon from "@mui/icons-material/Logout"; import MenuIcon from "@mui/icons-material/Menu"; import { diff --git a/components/Parser/parser.ts b/components/Parser/parser.ts index 5dc9c6f..fdf024d 100644 --- a/components/Parser/parser.ts +++ b/components/Parser/parser.ts @@ -1,4 +1,4 @@ -import { func, programType, rev } from "@components/Utils/matrixUtils"; +import { func, rev } from "@components/Utils/matrixUtils"; export const getProgram = (id: number) => { if (id === 200 || id === 0) return "NA"; @@ -25,5 +25,8 @@ export const getId = (program: string, department: string) => { return 200; if (program === "" || department === "") return 0; - return func[department as keyof typeof func][program as keyof programType]; + const temp = func[department as keyof typeof func]; + const idx = + func[department as keyof typeof func][program as keyof typeof temp]; + return idx; }; diff --git a/components/Utils/MatrixCondensed.tsx b/components/Utils/MatrixCondensed.tsx index 27d6db6..afa6cd1 100644 --- a/components/Utils/MatrixCondensed.tsx +++ b/components/Utils/MatrixCondensed.tsx @@ -1,127 +1,129 @@ +export {}; + /* eslint-disable no-nested-ternary */ -import RemoveIcon from "@mui/icons-material/Remove"; -import { - Paper, - Table, - TableBody, - TableCell, - TableContainer, - TableRow, -} from "@mui/material"; -import React from "react"; -import CloseIcon from "@mui/icons-material/Close"; -import CheckIcon from "@mui/icons-material/Check"; +// import RemoveIcon from "@mui/icons-material/Remove"; +// import { +// Paper, +// Table, +// TableBody, +// TableCell, +// TableContainer, +// TableRow, +// } from "@mui/material"; +// import React from "react"; +// import CloseIcon from "@mui/icons-material/Close"; +// import CheckIcon from "@mui/icons-material/Check"; -import { Branches, func } from "@components/Utils/matrixUtils"; +// import { Branches, func } from "@components/Utils/matrixUtils"; -function MatrixCondensed({ data }: { data: string }) { - return ( - - - {/* - - - Program - - - BT / BS / Double Major - - - MT / MSc /MSR - - - Dual - - - MDes - - - MBA - - - PhD - - - */} - - {Branches.map((branch) => ( - - - {branch} - - {/* - {func[branch as keyof typeof func].BT === -1 && - func[branch as keyof typeof func].BS === -1 && - func[branch as keyof typeof func].DoubleMajor === -1 ? ( - - ) : data[func[branch as keyof typeof func].BT] === "1" || - data[func[branch as keyof typeof func].BS] === "1" || - data[func[branch as keyof typeof func].DoubleMajor] === - "1" ? ( - - ) : ( - - )} - - - {func[branch as keyof typeof func].MT === -1 && - func[branch as keyof typeof func].MSc === -1 && - func[branch as keyof typeof func].MSR === -1 ? ( - - ) : data[func[branch as keyof typeof func].MT] === "1" || - data[func[branch as keyof typeof func].MSc] === "1" || - data[func[branch as keyof typeof func].MSR] === "1" ? ( - - ) : ( - - )} - - - {func[branch as keyof typeof func].DualA === -1 && - func[branch as keyof typeof func].DualB === -1 && - func[branch as keyof typeof func].DualC === -1 ? ( - - ) : data[func[branch as keyof typeof func].DualA] === "1" || - data[func[branch as keyof typeof func].DualB] === "1" || - data[func[branch as keyof typeof func].DualC] === "1" ? ( - - ) : ( - - )} - - - {func[branch as keyof typeof func].MDes === -1 ? ( - - ) : data[func[branch as keyof typeof func].MDes] === "1" ? ( - - ) : ( - - )} - - - {func[branch as keyof typeof func].MBA === -1 ? ( - - ) : data[func[branch as keyof typeof func].MBA] === "1" ? ( - - ) : ( - - )} - */} - - {func[branch as keyof typeof func].PhD === -1 ? ( - - ) : data[func[branch as keyof typeof func].PhD] === "1" ? ( - - ) : ( - - )} - - - ))} - -
-
- ); -} +// function MatrixCondensed({ data }: { data: string }) { +// return ( +// +// +// {/* +// +// +// Program +// +// +// BT / BS / Double Major +// +// +// MT / MSc /MSR +// +// +// Dual +// +// +// MDes +// +// +// MBA +// +// +// PhD +// +// +// */} +// +// {Branches.map((branch) => ( +// +// +// {branch} +// +// {/* +// {func[branch as keyof typeof func].BT === -1 && +// func[branch as keyof typeof func].BS === -1 && +// func[branch as keyof typeof func].DoubleMajor === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].BT] === "1" || +// data[func[branch as keyof typeof func].BS] === "1" || +// data[func[branch as keyof typeof func].DoubleMajor] === +// "1" ? ( +// +// ) : ( +// +// )} +// +// +// {func[branch as keyof typeof func].MT === -1 && +// func[branch as keyof typeof func].MSc === -1 && +// func[branch as keyof typeof func].MSR === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].MT] === "1" || +// data[func[branch as keyof typeof func].MSc] === "1" || +// data[func[branch as keyof typeof func].MSR] === "1" ? ( +// +// ) : ( +// +// )} +// +// +// {func[branch as keyof typeof func].DualA === -1 && +// func[branch as keyof typeof func].DualB === -1 && +// func[branch as keyof typeof func].DualC === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].DualA] === "1" || +// data[func[branch as keyof typeof func].DualB] === "1" || +// data[func[branch as keyof typeof func].DualC] === "1" ? ( +// +// ) : ( +// +// )} +// +// +// {func[branch as keyof typeof func].MDes === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].MDes] === "1" ? ( +// +// ) : ( +// +// )} +// +// +// {func[branch as keyof typeof func].MBA === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].MBA] === "1" ? ( +// +// ) : ( +// +// )} +// */} +// +// {func[branch as keyof typeof func].PhD === -1 ? ( +// +// ) : data[func[branch as keyof typeof func].PhD] === "1" ? ( +// +// ) : ( +// +// )} +// +// +// ))} +// +//
+//
+// ); +// } -export default MatrixCondensed; +// export default MatrixCondensed; diff --git a/components/Utils/MatrixExpanded.tsx b/components/Utils/MatrixExpanded.tsx index 098286e..1841e6e 100644 --- a/components/Utils/MatrixExpanded.tsx +++ b/components/Utils/MatrixExpanded.tsx @@ -12,11 +12,7 @@ import React from "react"; import CloseIcon from "@mui/icons-material/Close"; import CheckIcon from "@mui/icons-material/Check"; -import { - Branches, - func, - totalDeptKeywords, -} from "@components/Utils/matrixUtils"; +import { Branches, func } from "@components/Utils/matrixUtils"; function MatrixExpanded({ data }: { data: string }) { if (data?.length < 110) diff --git a/pages/admin/companyHR/index.tsx b/pages/admin/companyHR/index.tsx index a918825..61a3c85 100644 --- a/pages/admin/companyHR/index.tsx +++ b/pages/admin/companyHR/index.tsx @@ -1,5 +1,6 @@ // import { GridColDef } from "@mui/x-data-grid"; // import React, { useEffect, useState } from "react"; +import React from "react"; // import CompanyHRRequest, { // CompanyHR, @@ -73,3 +74,10 @@ // Index.layout = "adminDashBoard"; // export default Index; + +function Index() { + return
companyHR
; +} + +Index.layout = "adminDashBoard"; +export default Index; diff --git a/pages/admin/rc/[rcid]/company/[companyId]/index.tsx b/pages/admin/rc/[rcid]/company/[companyId]/index.tsx index c3db533..ac334f9 100644 --- a/pages/admin/rc/[rcid]/company/[companyId]/index.tsx +++ b/pages/admin/rc/[rcid]/company/[companyId]/index.tsx @@ -1,21 +1,13 @@ /* eslint-disable no-shadow */ import React, { useEffect, useState } from "react"; import { GridColDef } from "@mui/x-data-grid"; -import { - Button, - Card, - IconButton, - Modal, - Stack, - Typography, -} from "@mui/material"; +import { Button, Card, IconButton, Stack, Typography } from "@mui/material"; import Grid from "@mui/material/Grid"; import AddIcon from "@mui/icons-material/Add"; import { useRouter } from "next/router"; import DataGrid from "@components/DataGrid"; import Meta from "@components/Meta"; -import AddPPO from "@components/Modals/addPPO"; import useStore from "@store/store"; import requestProforma, { ProformaType } from "@callbacks/admin/rc/proforma"; import requestCompany, { CompanyRc } from "@callbacks/admin/rc/company"; @@ -89,14 +81,7 @@ function Index() { const { rcid } = router.query; const rid = (rcid || "").toString(); const ID = (CID || "").toString(); - const [openNew, setOpenNew] = useState(false); const [rows, setRows] = useState([]); - const handleOpenNew = () => { - setOpenNew(true); - }; - const handleCloseNew = () => { - setOpenNew(false); - }; const { token, rcName, role } = useStore(); const [showExtraContent, setShowExtraContent] = useState(false); const [row, setRow] = useState({ diff --git a/pages/admin/rc/[rcid]/proforma/[proformaid]/index.tsx b/pages/admin/rc/[rcid]/proforma/[proformaid]/index.tsx index f724c5e..0e114ad 100644 --- a/pages/admin/rc/[rcid]/proforma/[proformaid]/index.tsx +++ b/pages/admin/rc/[rcid]/proforma/[proformaid]/index.tsx @@ -25,11 +25,7 @@ import StudentRequest from "@callbacks/admin/rc/proforma/students"; import { CDN_URL } from "@callbacks/constants"; import DataGrid from "@components/DataGrid"; import Meta from "@components/Meta"; -import { - getDepartment, - getDeptProgram, - getProgram, -} from "@components/Parser/parser"; +import { getDepartment, getProgram } from "@components/Parser/parser"; import useStore from "@store/store"; import zip from "@callbacks/auth/zip"; import DownloadResume, { diff --git a/pages/admin/rc/[rcid]/stats.tsx b/pages/admin/rc/[rcid]/stats.tsx index c16a417..6fa8654 100644 --- a/pages/admin/rc/[rcid]/stats.tsx +++ b/pages/admin/rc/[rcid]/stats.tsx @@ -4,7 +4,6 @@ import Tab from "@mui/material/Tab"; import Box from "@mui/material/Box"; import { useRouter } from "next/router"; -import BranchStats from "sections/BranchStats"; import StudentStats from "sections/StudentStats"; import statRequest, { Stats as StatsType } from "@callbacks/admin/rc/stats"; import useStore from "@store/store"; diff --git a/pages/company/rc/[rcid]/proforma/[proformaid]/index.tsx b/pages/company/rc/[rcid]/proforma/[proformaid]/index.tsx index 4ac0ed1..25c3379 100644 --- a/pages/company/rc/[rcid]/proforma/[proformaid]/index.tsx +++ b/pages/company/rc/[rcid]/proforma/[proformaid]/index.tsx @@ -2,17 +2,10 @@ import { Card, Grid, Stack, TextField } from "@mui/material"; import React, { useEffect, useState } from "react"; import { useRouter } from "next/router"; -import StepperComp from "@components/Stepper/stepperComp"; import Meta from "@components/Meta"; import MatrixExpanded from "@components/Utils/MatrixExpanded"; import useStore from "@store/store"; -import proformaRequest, { - ProformaEvent, - ProformaType, -} from "@callbacks/company/proforma"; -import { - totalDeptKeywords, -} from "@components/Utils/matrixUtils"; +import proformaRequest, { ProformaType } from "@callbacks/company/proforma"; import RichText from "@components/Editor/RichText"; const textFieldColor = "#ff0000"; diff --git a/scripts/production.sh b/scripts/production.sh index 60777d0..1838aff 100644 --- a/scripts/production.sh +++ b/scripts/production.sh @@ -1,6 +1,6 @@ #!/bin/bash -git pull origin main +git pull origin master # Remove old packages and build files rm -rf node_modules/ ./.next/