Skip to content

Commit

Permalink
chore: ran prettier
Browse files Browse the repository at this point in the history
Signed-off-by: Karthik Ayangar <[email protected]>
  • Loading branch information
kituuu committed Feb 16, 2024
1 parent 315b78c commit e243de2
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 95 deletions.
31 changes: 14 additions & 17 deletions src/app/api/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -57,19 +57,16 @@ export const deleteFile = async (
return respnse;
};


export const getIconName = async(
export const getIconName = async (
authorizationToken: string,
orgName: string
): Promise<AxiosResponse<IconNameRes>>=>{
const url= BACKEND_URL+'/api/protected/file/getIconName/'+orgName
const response = await axios.get<IconNameRes>(url,
{
headers: {
Accept: 'application/json',
Authorization: `Bearer ${authorizationToken}`,
},
})
return response

}
orgName: string
): Promise<AxiosResponse<IconNameRes>> => {
const url = BACKEND_URL + '/api/protected/file/getIconName/' + orgName;
const response = await axios.get<IconNameRes>(url, {
headers: {
Accept: 'application/json',
Authorization: `Bearer ${authorizationToken}`,
},
});
return response;
};
5 changes: 4 additions & 1 deletion src/app/components/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const Popup = ({
className='popup-overlay'
style={{ zIndex: popup_zindex?.overlay ?? 1000 }}
/>
<div className='popup-modal' style={{ zIndex: popup_zindex?.modal ?? 2000 }}>
<div
className='popup-modal'
style={{ zIndex: popup_zindex?.modal ?? 2000 }}
>
<div className='popup-title'>
{typeof title === 'string' ? (
<span>{title}</span>
Expand Down
15 changes: 7 additions & 8 deletions src/app/components/timeRangeSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ interface Props {
const TimeRangeSwitch: React.FC<Props> = ({ 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 (
<div className='timerange-cont'>
<button
onClick={() => setWeekly(true)}
className={weekly ? 'active' :''}
style={weekly?{}:{background:'transparent'}}

className={weekly ? 'active' : ''}
style={weekly ? {} : { background: 'transparent' }}
>
Weekly{' '}
</button>
<button
onClick={() => setWeekly(false)}
className={weekly ? '' :'active'}
style={weekly?{background:'transparent'}:{}}
className={weekly ? '' : 'active'}
style={weekly ? { background: 'transparent' } : {}}
>
Monthly{' '}
</button>
Expand Down
11 changes: 4 additions & 7 deletions src/features/EditWorkspace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -107,7 +107,6 @@ const EditWorkspace = () => {
}
};


const SubmitHandler = async (): Promise<void> => {
if (
description &&
Expand All @@ -118,7 +117,6 @@ const EditWorkspace = () => {
uniqueName &&
validDescription
) {

const func = async (): Promise<void> => {
const dataRes = await updateOrg(token, spaceName, {
name: name,
Expand All @@ -140,7 +138,6 @@ const EditWorkspace = () => {
error: <b>Could not save</b>,
});
} else {

toast.error('Invalid inputs');
}
};
Expand Down
42 changes: 24 additions & 18 deletions src/features/project-members /components/MemberCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,30 @@ const MemberCard = ({
}
};

const HandleRoleChange= async(event:ChangeEvent<HTMLSelectElement>)=>{

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: <b>Role changed</b>,
error: <b>Unable to change</b>,
});

const HandleRoleChange = async (event: ChangeEvent<HTMLSelectElement>) => {
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: <b>Role changed</b>,
error: <b>Unable to change</b>,
});
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useNavigate } from 'react-router-dom';

const BackNavigation = () => {

const navigate= useNavigate()
const navigate = useNavigate();
return (
<div className='back-title-container'>
<button className='button' onClick={() => navigate('/')}>
Expand Down
20 changes: 9 additions & 11 deletions src/features/workspace-members /components/MemberCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@ const MemberCard = ({
}
};

const HandleRoleChange= async(event:ChangeEvent<HTMLSelectElement>)=>{

const new_role= event.target.value
if(token&&spaceName&&orgMembers&&new_role!=role){

const HandleRoleChange = async (event: ChangeEvent<HTMLSelectElement>) => {
const new_role = event.target.value;
if (token && spaceName && orgMembers && new_role != role) {
const func = async () => {
const res = await changeOrgMembersStatus(token, spaceName, {
[name]: new_role,
});
orgMembers[name] = new_role;
setOrgMembers(orgMembers);

const func= async()=>{

const res= await changeOrgMembersStatus(token, spaceName,{[name]:new_role})
orgMembers[name]=new_role
setOrgMembers(orgMembers)

toast.promise(func(), {
loading: 'Changing Role',
success: <b>Role changed</b>,
Expand Down
30 changes: 15 additions & 15 deletions src/features/workspace-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,30 @@ const WorkspaceView = () => {
searchValue,
]);

const LogoutHandler= async()=>{
try{
localStorage.removeItem('token')
toast.success('Logout successful!');
navigate("/login")
}catch(e){

}
}
const LogoutHandler = async () => {
try {
localStorage.removeItem('token');
toast.success('Logout successful!');
navigate('/login');
} catch (e) {}
};
return (
<div className='workspaceview-container'>
<FirstVisit />
<div className='workspaceview-header'>
<SearchBar />

<button onClick={() => setArcheives(!archeives)} style={archeives?{background: '#141432'}:{}}>Archeives</button>

<button
onClick={() => setArcheives(!archeives)}
style={archeives ? { background: '#141432' } : {}}
>
Archeives
</button>

<button onClick={() => navigate('/addWorkspace')}>
Create a workspace
</button>
<button onClick={LogoutHandler}>
Logout
</button>
<button onClick={LogoutHandler}>Logout</button>
</div>

<div className='workspaceview-card-container'>
Expand All @@ -79,7 +80,6 @@ const WorkspaceView = () => {
return [key, value];
})
.map(([orgName, details]) => {

return (
<WorkspaceCard
key={orgName}
Expand Down
21 changes: 9 additions & 12 deletions src/features/workspace-view/workspace-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ const WorkspaceCard = (props: workspaceCardProps) => {
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) {}
}
};

Expand Down Expand Up @@ -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);
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/features/workspace/components/projectCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ const ProjectCard: React.FC<Props> = ({
const navigate = useNavigate();
const [pin, setPin] = useState<boolean>(status.bookmark);
const [archive, setArchive] = useState<boolean>(status.archeive);
const [project, setProject]= useState<GetProject|null>(null)
const [projectMembers, setProjectMembers]= useState<{key:string, value: string}[]>([])
const [project, setProject] = useState<GetProject | null>(null);
const [projectMembers, setProjectMembers] = useState<
{ key: string; value: string }[]
>([]);

const fetchProjectData = async () => {
if (token != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const ProjectCardCont: React.FC<Props> = ({
}) => {
const searchValue = useSelector((state: any) => state.searchKeyword.value);

useEffect(() => {
}, [weekly, searchValue]);
useEffect(() => {}, [weekly, searchValue]);

return (
<>
Expand Down

0 comments on commit e243de2

Please sign in to comment.