diff --git a/frontend/public/index.html b/frontend/public/index.html index a9db1db..de43004 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -29,7 +29,6 @@ href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet" /> - Tracer diff --git a/frontend/public/site.webmanifest b/frontend/public/site.webmanifest index 45dc8a2..fa99de7 100644 --- a/frontend/public/site.webmanifest +++ b/frontend/public/site.webmanifest @@ -1 +1,19 @@ -{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/frontend/src/app/api/file.ts b/frontend/src/app/api/file.ts index 607ec01..d9e81ea 100644 --- a/frontend/src/app/api/file.ts +++ b/frontend/src/app/api/file.ts @@ -11,13 +11,6 @@ export interface IconNameRes { message: string; } - - - - - - - export const uploadIcon = async ( authorizationToken: string, orgName: string, @@ -35,10 +28,6 @@ export const uploadIcon = async ( return respnse; }; - - - - export const getIcon = async (authorizationToken: string, orgName: string) => { const url = BACKEND_URL + '/api/protected/file/getIcon/' + orgName; const response = await axios.get( @@ -55,8 +44,6 @@ export const getIcon = async (authorizationToken: string, orgName: string) => { return response; }; - - export const deleteFile = async ( authorizationToken: string, fileName: string @@ -71,9 +58,6 @@ export const deleteFile = async ( return respnse; }; - - - export const getIconName = async ( authorizationToken: string, orgName: string diff --git a/frontend/src/app/api/githubData.ts b/frontend/src/app/api/githubData.ts index 665dfae..8111994 100644 --- a/frontend/src/app/api/githubData.ts +++ b/frontend/src/app/api/githubData.ts @@ -25,7 +25,6 @@ export interface ProjectStats { contributors: Contributors; } - export interface OrgProjectGithubData { projects: ProjectsGithubData; } diff --git a/frontend/src/app/components/search/index.tsx b/frontend/src/app/components/search/index.tsx index 99ac0fb..b78e628 100644 --- a/frontend/src/app/components/search/index.tsx +++ b/frontend/src/app/components/search/index.tsx @@ -6,7 +6,7 @@ import './index.scss'; const SearchBar = () => { const dispatch = useDispatch(); - const [search,setSearch] = useState('') + const [search, setSearch] = useState(''); const handleInputChange = (e: React.ChangeEvent) => { setSearch(e.target.value); }; diff --git a/frontend/src/app/components/timeRangeSwitch/index.tsx b/frontend/src/app/components/timeRangeSwitch/index.tsx index 6e62dec..7d8a15a 100644 --- a/frontend/src/app/components/timeRangeSwitch/index.tsx +++ b/frontend/src/app/components/timeRangeSwitch/index.tsx @@ -13,9 +13,7 @@ interface Props { const TimeRangeSwitch: React.FC = ({ weekly, setWeekly }) => { // const dispatch = useDispatch(); // const isWeekly = useSelector((state: timeRangeModel) => state.isWeekly.value); - useEffect(()=>{ - - },[weekly, setWeekly]) + useEffect(() => {}, [weekly, setWeekly]); return (
diff --git a/frontend/src/features/EditWorkspace/index.tsx b/frontend/src/features/EditWorkspace/index.tsx index 267d9fd..391fc7b 100644 --- a/frontend/src/features/EditWorkspace/index.tsx +++ b/frontend/src/features/EditWorkspace/index.tsx @@ -1,13 +1,8 @@ import { getAllUser, getUser } from 'app/api/user'; -import { ChangeEvent, useContext, useEffect, useState } from 'react'; +import { ChangeEvent, useContext, useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import toast from 'react-hot-toast'; -import { - - getAllOrgs, - getOrg, - updateOrg, -} from 'app/api/organization'; +import { getAllOrgs, getOrg, updateOrg } from 'app/api/organization'; import { uploadIcon } from 'app/api/file'; import './index.scss'; @@ -25,7 +20,6 @@ const EditWorkspace = () => { const [validName, setValidName] = useState(false); const [uniqueName, setUniqueName] = useState(false); - const [users, setUsers] = useState([]); const [orgs, setOrgs] = useState([]); @@ -119,15 +113,11 @@ const EditWorkspace = () => { description: description, }); - - if (selectedFile != null) { - try{ + if (selectedFile != null) { + try { const fileRes = await uploadIcon(token, name, selectedFile); - }catch(e){ - - } - } - + } catch (e) {} + } navigate('/'); }; diff --git a/frontend/src/features/ProjectAddMember /index.tsx b/frontend/src/features/ProjectAddMember /index.tsx index b08ff09..0e10397 100644 --- a/frontend/src/features/ProjectAddMember /index.tsx +++ b/frontend/src/features/ProjectAddMember /index.tsx @@ -1,12 +1,9 @@ - -import { ChangeEvent, useContext, useEffect, useState } from 'react'; +import { ChangeEvent, useContext, useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { AVATAR_API } from 'envConstants'; import { AVATAR_URL } from 'app/constants/api'; import toast from 'react-hot-toast'; -import { - getOrgMembers, -} from 'app/api/organization'; +import { getOrgMembers } from 'app/api/organization'; import './index.scss'; import UserContext from 'app/context/user/userContext'; diff --git a/frontend/src/features/WorkspaceAddMember/index.tsx b/frontend/src/features/WorkspaceAddMember/index.tsx index 0126778..61e14d8 100644 --- a/frontend/src/features/WorkspaceAddMember/index.tsx +++ b/frontend/src/features/WorkspaceAddMember/index.tsx @@ -1,12 +1,8 @@ import { getAllUser, getUser } from 'app/api/user'; -import { ChangeEvent, useContext, useEffect, useState } from 'react'; +import { ChangeEvent, useContext, useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import toast from 'react-hot-toast'; -import { - addOrgMembers, - getOrgMembers, -} from 'app/api/organization'; - +import { addOrgMembers, getOrgMembers } from 'app/api/organization'; import './index.scss'; import UserContext from 'app/context/user/userContext'; diff --git a/frontend/src/features/login/index.tsx b/frontend/src/features/login/index.tsx index 557ccdf..c367022 100644 --- a/frontend/src/features/login/index.tsx +++ b/frontend/src/features/login/index.tsx @@ -1,4 +1,3 @@ - import { CLIENT_ID } from '../../envConstants'; import { useNavigate, useSearchParams } from 'react-router-dom'; import { login } from 'app/api/login'; diff --git a/frontend/src/features/project-members /components/MemberCard.tsx b/frontend/src/features/project-members /components/MemberCard.tsx index 88c24d7..74d3114 100644 --- a/frontend/src/features/project-members /components/MemberCard.tsx +++ b/frontend/src/features/project-members /components/MemberCard.tsx @@ -1,13 +1,9 @@ - import { changeProjectMembersStatus, removeProjectMembers, } from 'app/api/project'; import UserContext from 'app/context/user/userContext'; -import { - ChangeEvent, - useContext, -} from 'react'; +import { ChangeEvent, useContext } from 'react'; import toast from 'react-hot-toast'; const MemberCard = ({ diff --git a/frontend/src/features/project/components/contributorCard/index.tsx b/frontend/src/features/project/components/contributorCard/index.tsx index 0017431..08a1227 100644 --- a/frontend/src/features/project/components/contributorCard/index.tsx +++ b/frontend/src/features/project/components/contributorCard/index.tsx @@ -1,4 +1,3 @@ - import './index.scss'; import contributorPropTypes from 'app/models/contributorPropTypes'; import { AVATAR_API } from 'envConstants'; diff --git a/frontend/src/features/workspace-members /components/MemberCard.tsx b/frontend/src/features/workspace-members /components/MemberCard.tsx index d8b0ac4..236b691 100644 --- a/frontend/src/features/workspace-members /components/MemberCard.tsx +++ b/frontend/src/features/workspace-members /components/MemberCard.tsx @@ -1,9 +1,6 @@ import { changeOrgMembersStatus, removeOrgMembers } from 'app/api/organization'; import UserContext from 'app/context/user/userContext'; -import { - ChangeEvent, - useContext, -} from 'react'; +import { ChangeEvent, useContext } from 'react'; import toast from 'react-hot-toast'; const MemberCard = ({ diff --git a/frontend/src/features/workspace-view/index.tsx b/frontend/src/features/workspace-view/index.tsx index dab79b9..0a2eff4 100644 --- a/frontend/src/features/workspace-view/index.tsx +++ b/frontend/src/features/workspace-view/index.tsx @@ -1,9 +1,9 @@ import SearchBar from 'app/components/search'; -import { useContext, useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import './index.scss'; import WorkspaceCard from './workspace-card'; import UserContext from 'app/context/user/userContext'; -import { UserOrgs, getUserOrgs } from 'app/api/user'; +import { UserOrgs, getUserOrgs } from 'app/api/user'; import loader from '../../app/assets/gifs/loader.gif'; import { useNavigate } from 'react-router-dom'; import { useSelector } from 'react-redux'; @@ -35,12 +35,7 @@ const WorkspaceView = () => { }; useEffect(() => { fetchData(); - }, [ - userContext?.username, - navigate, - searchValue, - - ]); + }, [userContext?.username, navigate, searchValue]); const LogoutHandler = async () => { try { diff --git a/frontend/src/features/workspace-view/workspace-card/index.tsx b/frontend/src/features/workspace-view/workspace-card/index.tsx index 6df44b4..3d62eb5 100644 --- a/frontend/src/features/workspace-view/workspace-card/index.tsx +++ b/frontend/src/features/workspace-view/workspace-card/index.tsx @@ -5,8 +5,7 @@ import { deleteOrg, getOrg, getOrgMembers } from 'app/api/organization'; import { deleteFile, getIcon, getIconName } from 'app/api/file'; import UserContext from 'app/context/user/userContext'; import toast from 'react-hot-toast'; -import { FaBookmark } from "react-icons/fa"; - +import { FaBookmark } from 'react-icons/fa'; import { UserOrgDetails, @@ -28,10 +27,22 @@ interface members { [username: string]: string; } -const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { workspaceName:string, role:string, archeive:boolean, bookmark:boolean, archeives:boolean }) => { +const WorkspaceCard = ({ + workspaceName, + role, + archeive, + bookmark, + archeives, +}: { + workspaceName: string; + role: string; + archeive: boolean; + bookmark: boolean; + archeives: boolean; +}) => { // const { workspaceName, role, archeive, bookmark, archeives } = props; - const [localArchive,setLocalArchive] = useState(archeive) - const [localBookmark,setLocalBookmark] = useState(bookmark) + const [localArchive, setLocalArchive] = useState(archeive); + const [localBookmark, setLocalBookmark] = useState(bookmark); const [description, setDescription] = useState(null); const [showPopUp, setShowPopUp] = useState(false); const token = localStorage.getItem('token'); @@ -107,7 +118,7 @@ const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { userContext?.setUserOrgs(orgs); } }; - setLocalBookmark(!localBookmark) + setLocalBookmark(!localBookmark); if (initBmk) { toast.promise(func(), { loading: 'Unpinning', @@ -140,7 +151,7 @@ const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { orgs.userOrgs[workspaceName].archeive = (!archeive).toString(); userContext?.setUserOrgs(orgs); } - setLocalArchive(!localArchive) + setLocalArchive(!localArchive); }; if (!initArc) { toast.promise(func(), { @@ -165,9 +176,8 @@ const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { <> {localArchive == archeives && (
-
- {localBookmark&&} + {localBookmark && }
setShowPopUp(showPopUp ? false : true)} @@ -193,7 +203,7 @@ const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { delete
)} - + {members && userContext?.username && members[userContext?.username.toString()] === 'admin' && ( @@ -222,7 +232,10 @@ const WorkspaceCard = ({ workspaceName, role, archeive, bookmark, archeives }: { ? "USER's WORKSPACE" : workspaceName}
-
navigate(`/workspaceMembers/${workspaceName}`)}> +
navigate(`/workspaceMembers/${workspaceName}`)} + >
{membersArray.length > 0 ? ( diff --git a/frontend/src/features/workspace/components/projectCard/index.scss b/frontend/src/features/workspace/components/projectCard/index.scss index eb9be42..a009fc6 100644 --- a/frontend/src/features/workspace/components/projectCard/index.scss +++ b/frontend/src/features/workspace/components/projectCard/index.scss @@ -7,7 +7,6 @@ height: 100%; min-height: 257px; padding: 1em; - } // .projectcard:hover { @@ -162,7 +161,6 @@ font-size: 1rem; } -.pinDiv{ +.pinDiv { height: 12px; - -} \ No newline at end of file +} diff --git a/frontend/src/features/workspace/components/projectCard/index.tsx b/frontend/src/features/workspace/components/projectCard/index.tsx index e1749dc..7b09a0e 100644 --- a/frontend/src/features/workspace/components/projectCard/index.tsx +++ b/frontend/src/features/workspace/components/projectCard/index.tsx @@ -1,7 +1,7 @@ -import { useContext, useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import './index.scss'; import { deleteProject, getMembers, getProject } from 'app/api/project'; -import { FaBookmark } from "react-icons/fa"; +import { FaBookmark } from 'react-icons/fa'; import { GetProject } from 'app/api/project'; import { AVATAR_URL } from 'app/constants/api'; import { AVATAR_API } from 'envConstants'; @@ -72,16 +72,15 @@ const ProjectCard: React.FC = ({ const temp = userOrgs; Object.entries(temp.userOrgs).map(([org]) => { if (org === orgName) { - if (temp.userOrgs[org].bookmark === "true" ) { - temp.userOrgs[org].bookmark = "false"; - } - else { - temp.userOrgs[org].bookmark = "true"; + if (temp.userOrgs[org].bookmark === 'true') { + temp.userOrgs[org].bookmark = 'false'; + } else { + temp.userOrgs[org].bookmark = 'true'; } } }); - setUserOrgs(userOrgs => { - return userOrgs = {...temp} + setUserOrgs((userOrgs) => { + return (userOrgs = { ...temp }); }); userContext?.setUserOrgs(userOrgs); }; @@ -101,7 +100,7 @@ const ProjectCard: React.FC = ({ } } }; - + const ArchiveHandler = async () => { if (token && orgName) { let initial = archive; @@ -109,25 +108,23 @@ const ProjectCard: React.FC = ({ const res = await setArcheiveStatus(token, orgName, { [projectName]: !archive, }); - + setArchive(!archive); status.archeive = !archive; const temp = userOrgs; Object.entries(temp.userOrgs).map(([org]) => { if (org === orgName) { - if (temp.userOrgs[org].archeive === "true" ) { - temp.userOrgs[org].archeive = "false"; - } - else { - temp.userOrgs[org].archeive = "true"; + if (temp.userOrgs[org].archeive === 'true') { + temp.userOrgs[org].archeive = 'false'; + } else { + temp.userOrgs[org].archeive = 'true'; } } }); - setUserOrgs(userOrgs => { - return userOrgs = {...temp} + setUserOrgs((userOrgs) => { + return (userOrgs = { ...temp }); }); userContext?.setUserOrgs(userOrgs); - }; if (initial) { @@ -141,7 +138,6 @@ const ProjectCard: React.FC = ({ loading: 'On progress', success: Project archived, error: Unable to arhive, - }); } } @@ -151,10 +147,10 @@ const ProjectCard: React.FC = ({ const func = async () => { const res = await deleteProject(token, projectName, orgName); // TODO update local state - if (userOrgs) {Object.entries(userOrgs.userOrgs) - .map(([org]) =>{ - }) - };} + if (userOrgs) { + Object.entries(userOrgs.userOrgs).map(([org]) => {}); + } + }; toast.promise(func(), { loading: 'On progress', success: Successfully deleted, @@ -172,7 +168,6 @@ const ProjectCard: React.FC = ({ userContext?.setUserOrgs(userOrgsRes.data); setUserOrgs(userOrgsRes.data); } catch (e) {} - } }; useEffect(() => { @@ -180,44 +175,44 @@ const ProjectCard: React.FC = ({ fetchProjectMembers(); fetchData(); }, []); - return (
- -
- {pin && } -
+
{pin && }

{projectName}

{project ? project.description : <>}

{(userContext?.userOrgs?.userOrgs[orgName].role === 'admin' || userContext?.userOrgs?.userOrgs[orgName].role === 'manager') && ( -
+
setShowPopUp(!showPopUp)} > - +
- {showPopUp &&
-
- {pin ? 'Unpin' : 'Pin'} + {showPopUp && ( +
+
+ {pin ? 'Unpin' : 'Pin'} +
+
+ {archive ? 'Unarchive' : 'Archive'} +
+
+ navigate(`/editProject/${orgName}/${projectName}`) + } + > + Edit +
+
+ Delete +
-
- {archive ? 'Unarchive' : 'Archive'} -
-
navigate(`/editProject/${orgName}/${projectName}`)} - > - Edit -
-
- Delete -
-
} -
+ )} +
)}
diff --git a/frontend/src/features/workspace/components/projectCardContainer/index.tsx b/frontend/src/features/workspace/components/projectCardContainer/index.tsx index 10ec8ea..ca703c3 100644 --- a/frontend/src/features/workspace/components/projectCardContainer/index.tsx +++ b/frontend/src/features/workspace/components/projectCardContainer/index.tsx @@ -26,26 +26,26 @@ const ProjectCardCont: React.FC = ({ }, [weekly]); return ( -
- {orgProjects && - Object.entries(orgProjects).map(([key, value]) => { - return ( - archives === value.archeive && ( - - ) - ); - })} -
+
+ {orgProjects && + Object.entries(orgProjects).map(([key, value]) => { + return ( + archives === value.archeive && ( + + ) + ); + })} +
); }; diff --git a/frontend/src/features/workspace/index.scss b/frontend/src/features/workspace/index.scss index 444d2b0..a515882 100644 --- a/frontend/src/features/workspace/index.scss +++ b/frontend/src/features/workspace/index.scss @@ -45,7 +45,6 @@ color: white; font-size: 0.9rem; background: var(--timerange-switch-btn-bg); - } .loader-container { diff --git a/frontend/src/features/workspace/index.tsx b/frontend/src/features/workspace/index.tsx index 868f90e..0ea79f2 100644 --- a/frontend/src/features/workspace/index.tsx +++ b/frontend/src/features/workspace/index.tsx @@ -1,15 +1,12 @@ -import { useContext, useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import SearchBar from 'app/components/search'; import TimeRangeSwitch from 'app/components/timeRangeSwitch'; import ProjectCardCont from './components/projectCardContainer'; import LeaderBoard from './components/leaderboard'; import './index.scss'; -import { useNavigate, useParams } from 'react-router-dom'; -import { getOrgProjects } from 'app/api/organization'; -import { - getOrgGithubData, - getOrgRank, -} from 'app/api/githubData'; +import { useNavigate, useParams } from 'react-router-dom'; +import { getOrgProjects } from 'app/api/organization'; +import { getOrgGithubData, getOrgRank } from 'app/api/githubData'; import { Projects } from 'app/api/organization'; import { ProjectsGithubData } from 'app/api/githubData'; import { Contributors } from 'app/api/githubData'; @@ -18,7 +15,6 @@ import UserContext from 'app/context/user/userContext'; import { UserOrgs, getUserOrgs } from 'app/api/user'; import { useSelector } from 'react-redux'; - const Workspace = () => { const searchValue = useSelector((state: any) => state.searchKeyword.value); const navigate = useNavigate(); @@ -43,8 +39,10 @@ const Workspace = () => { if (token && spaceName) { try { const orgProjects = await getOrgProjects(token, spaceName); - const temp = Object.entries(orgProjects.data.projects).filter(([key]) => key.toLowerCase().includes(searchValue.toLowerCase())); - setOrgProjects(Object.fromEntries(temp)) + const temp = Object.entries(orgProjects.data.projects).filter(([key]) => + key.toLowerCase().includes(searchValue.toLowerCase()) + ); + setOrgProjects(Object.fromEntries(temp)); } catch (e) { navigate('/'); } @@ -69,7 +67,7 @@ const Workspace = () => { }; const fetchData = async () => { - console.log(userContext?.username) + console.log(userContext?.username); if (token && userContext?.username) { try { const userOrgsRes = await getUserOrgs( @@ -79,7 +77,6 @@ const Workspace = () => { userContext?.setUserOrgs(userOrgsRes.data); setUserOrgs(userOrgsRes.data); } catch (e) {} - } }; @@ -102,18 +99,13 @@ const Workspace = () => { fetchOrgProjects(); fetchWeeklyData(); fetchMonthlyData(); - }, [spaceName,searchValue]); + }, [spaceName, searchValue]); return ( <>
- +