From e243de292e2c00006fcf60e5b0d7333a116ac62e Mon Sep 17 00:00:00 2001 From: Karthik Ayangar Date: Fri, 16 Feb 2024 23:59:41 +0530 Subject: [PATCH] chore: ran prettier Signed-off-by: Karthik Ayangar --- src/app/api/file.ts | 31 +++++++------- src/app/components/popup/index.tsx | 5 ++- src/app/components/timeRangeSwitch/index.tsx | 15 ++++--- src/features/EditWorkspace/index.tsx | 11 ++--- .../components/MemberCard.tsx | 42 +++++++++++-------- .../components/BackNavigation.tsx | 3 +- .../components/MemberCard.tsx | 20 ++++----- src/features/workspace-view/index.tsx | 30 ++++++------- .../workspace-view/workspace-card/index.tsx | 21 ++++------ .../components/projectCard/index.tsx | 6 ++- .../components/projectCardContainer/index.tsx | 3 +- 11 files changed, 92 insertions(+), 95 deletions(-) diff --git a/src/app/api/file.ts b/src/app/api/file.ts index fb67af2..4683304 100644 --- a/src/app/api/file.ts +++ b/src/app/api/file.ts @@ -7,8 +7,8 @@ export interface FileUpload { statusCode: number; } -export interface IconNameRes{ - message: string +export interface IconNameRes { + message: string; } export const uploadIcon = async ( authorizationToken: string, @@ -57,19 +57,16 @@ export const deleteFile = async ( return respnse; }; - -export const getIconName = async( +export const getIconName = async ( authorizationToken: string, - orgName: string -): Promise>=>{ - const url= BACKEND_URL+'/api/protected/file/getIconName/'+orgName - const response = await axios.get(url, - { - headers: { - Accept: 'application/json', - Authorization: `Bearer ${authorizationToken}`, - }, - }) - return response - -} \ No newline at end of file + orgName: string +): Promise> => { + const url = BACKEND_URL + '/api/protected/file/getIconName/' + orgName; + const response = await axios.get(url, { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${authorizationToken}`, + }, + }); + return response; +}; diff --git a/src/app/components/popup/index.tsx b/src/app/components/popup/index.tsx index 2badb89..49e05c4 100644 --- a/src/app/components/popup/index.tsx +++ b/src/app/components/popup/index.tsx @@ -31,7 +31,10 @@ const Popup = ({ className='popup-overlay' style={{ zIndex: popup_zindex?.overlay ?? 1000 }} /> -
+
{typeof title === 'string' ? ( {title} diff --git a/src/app/components/timeRangeSwitch/index.tsx b/src/app/components/timeRangeSwitch/index.tsx index f3b571f..929fa24 100644 --- a/src/app/components/timeRangeSwitch/index.tsx +++ b/src/app/components/timeRangeSwitch/index.tsx @@ -13,23 +13,22 @@ interface Props { const TimeRangeSwitch: React.FC = ({ weekly, setWeekly }) => { // const dispatch = useDispatch(); // const isWeekly = useSelector((state: timeRangeModel) => state.isWeekly.value); - useEffect(()=>{ - console.log(weekly,"makki") - },[weekly, setWeekly]) + useEffect(() => { + console.log(weekly, 'makki'); + }, [weekly, setWeekly]); return (
diff --git a/src/features/EditWorkspace/index.tsx b/src/features/EditWorkspace/index.tsx index 96ed4b0..63996c0 100644 --- a/src/features/EditWorkspace/index.tsx +++ b/src/features/EditWorkspace/index.tsx @@ -51,10 +51,10 @@ const EditWorkspace = () => { setUsers(users_aray); setOrgs(org_aray); } - if(token&&spaceName){ - SetName(spaceName) - setUniqueName(true) - setValidName(true) + if (token && spaceName) { + SetName(spaceName); + setUniqueName(true); + setValidName(true); } if (token && spaceName) { const Org = await getOrg(token, spaceName); @@ -107,7 +107,6 @@ const EditWorkspace = () => { } }; - const SubmitHandler = async (): Promise => { if ( description && @@ -118,7 +117,6 @@ const EditWorkspace = () => { uniqueName && validDescription ) { - const func = async (): Promise => { const dataRes = await updateOrg(token, spaceName, { name: name, @@ -140,7 +138,6 @@ const EditWorkspace = () => { error: Could not save, }); } else { - toast.error('Invalid inputs'); } }; diff --git a/src/features/project-members /components/MemberCard.tsx b/src/features/project-members /components/MemberCard.tsx index ce020ec..ee551d9 100644 --- a/src/features/project-members /components/MemberCard.tsx +++ b/src/features/project-members /components/MemberCard.tsx @@ -50,24 +50,30 @@ const MemberCard = ({ } }; - const HandleRoleChange= async(event:ChangeEvent)=>{ - - const new_role= event.target.value - if(token&&spaceName&&orgMembers&&projectMembers&&new_role!=role){ - - - const func= async()=>{ - - const res= await changeProjectMembersStatus(token,projectName ,spaceName,{[name]:new_role}) - projectMembers[name]=new_role - setProjectMembers(projectMembers) - } - toast.promise(func(), { - loading: 'Changing Role', - success: Role changed, - error: Unable to change, - }); - + const HandleRoleChange = async (event: ChangeEvent) => { + const new_role = event.target.value; + if ( + token && + spaceName && + orgMembers && + projectMembers && + new_role != role + ) { + const func = async () => { + const res = await changeProjectMembersStatus( + token, + projectName, + spaceName, + { [name]: new_role } + ); + projectMembers[name] = new_role; + setProjectMembers(projectMembers); + }; + toast.promise(func(), { + loading: 'Changing Role', + success: Role changed, + error: Unable to change, + }); } }; diff --git a/src/features/workspace-members /components/BackNavigation.tsx b/src/features/workspace-members /components/BackNavigation.tsx index f9e84aa..15a19bf 100644 --- a/src/features/workspace-members /components/BackNavigation.tsx +++ b/src/features/workspace-members /components/BackNavigation.tsx @@ -1,8 +1,7 @@ import { useNavigate } from 'react-router-dom'; const BackNavigation = () => { - - const navigate= useNavigate() + const navigate = useNavigate(); return (
- + + - +
@@ -79,7 +80,6 @@ const WorkspaceView = () => { return [key, value]; }) .map(([orgName, details]) => { - return ( { setMembersArray(membersArray); } catch (e) {} - try{ - - const iconRes= await getIconName(token, workspaceName) - const fileName= iconRes.data.message - const deleteRes= await deleteFile(token, fileName) - }catch(e){} + try { + const iconRes = await getIconName(token, workspaceName); + const fileName = iconRes.data.message; + const deleteRes = await deleteFile(token, fileName); + } catch (e) {} } }; @@ -129,14 +128,12 @@ const WorkspaceCard = (props: workspaceCardProps) => { const status: { [key: string]: boolean } = { [workspaceName]: !archeive, }; - - - const res = await setOrgArcheiveStatus(token, status); - - + + const res = await setOrgArcheiveStatus(token, status); + const orgs = userContext?.userOrgs; if (orgs?.userOrgs.hasOwnProperty(workspaceName)) { - orgs.userOrgs[workspaceName].archeive= (!archeive).toString(); + orgs.userOrgs[workspaceName].archeive = (!archeive).toString(); userContext?.setUserOrgs(orgs); } }; diff --git a/src/features/workspace/components/projectCard/index.tsx b/src/features/workspace/components/projectCard/index.tsx index f0e1caf..f5071d9 100644 --- a/src/features/workspace/components/projectCard/index.tsx +++ b/src/features/workspace/components/projectCard/index.tsx @@ -40,8 +40,10 @@ const ProjectCard: React.FC = ({ const navigate = useNavigate(); const [pin, setPin] = useState(status.bookmark); const [archive, setArchive] = useState(status.archeive); - const [project, setProject]= useState(null) - const [projectMembers, setProjectMembers]= useState<{key:string, value: string}[]>([]) + const [project, setProject] = useState(null); + const [projectMembers, setProjectMembers] = useState< + { key: string; value: string }[] + >([]); const fetchProjectData = async () => { if (token != null) { diff --git a/src/features/workspace/components/projectCardContainer/index.tsx b/src/features/workspace/components/projectCardContainer/index.tsx index 310c521..bd64cd2 100644 --- a/src/features/workspace/components/projectCardContainer/index.tsx +++ b/src/features/workspace/components/projectCardContainer/index.tsx @@ -24,8 +24,7 @@ const ProjectCardCont: React.FC = ({ }) => { const searchValue = useSelector((state: any) => state.searchKeyword.value); - useEffect(() => { - }, [weekly, searchValue]); + useEffect(() => {}, [weekly, searchValue]); return ( <>