Skip to content

Commit

Permalink
style: project members
Browse files Browse the repository at this point in the history
Signed-off-by: Karthik Ayangar <[email protected]>
  • Loading branch information
kituuu committed Jan 20, 2024
1 parent 0aa5242 commit 5596cd2
Show file tree
Hide file tree
Showing 33 changed files with 563 additions and 552 deletions.
18 changes: 10 additions & 8 deletions src/app/api/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ export const uploadIcon = async (

export const getIcon = async (authorizationToken: string, orgName: string) => {
const url = BACKEND_URL + '/api/protected/file/getIcon/' + orgName;
const response = await axios.get(url,

const response = await axios.get(
url,

{
responseType:'blob',
headers: {
Authorization: `Bearer ${authorizationToken}`,
Accept: "*/*"
},
});
responseType: 'blob',
headers: {
Authorization: `Bearer ${authorizationToken}`,
Accept: '*/*',
},
}
);
return response;
};

Expand Down
28 changes: 11 additions & 17 deletions src/app/api/githubData.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
import axios, { AxiosResponse } from 'axios';
import { BACKEND_URL } from 'envConstants';



export interface Contributors {
[contributorName: string]: {
issues: number,
pulls: number,
commits:number
issues: number;
pulls: number;
commits: number;
};
}

export interface ProjectsGithubData {
[contributorName: string]: {
issues: number,
pulls: number,
commits:number
issues: number;
pulls: number;
commits: number;
};
}


export interface OrgRank{
contributors: Contributors
export interface OrgRank {
contributors: Contributors;
}


// Contributors==project issues commits pull
export interface OrgProjectGithubData{
projects: ProjectsGithubData
export interface OrgProjectGithubData {
projects: ProjectsGithubData;
}



export const getOrgGithubData = async (
authorizationToken: string,
orgName: string,
monthly: boolean
):Promise<AxiosResponse<OrgProjectGithubData>> => {
): Promise<AxiosResponse<OrgProjectGithubData>> => {
const url =
BACKEND_URL + '/api/protected/github/' + orgName + '?monthly=' + monthly;
const respnse = await axios.get<OrgProjectGithubData>(url, {
Expand Down
31 changes: 16 additions & 15 deletions src/app/api/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,27 @@ export interface AllOrgs {
}[];
}

export interface Projects{
[ProjectName: string]:{
archeive:boolean,
bookmark: boolean
}
export interface Projects {
[ProjectName: string]: {
archeive: boolean;
bookmark: boolean;
};
}
export interface OrgProjects{
projects: Projects
export interface OrgProjects {
projects: Projects;
}

export interface Workspace{
export interface Workspace {
id: number;
name: string;
description: string
description: string;
}
interface OrgMembers {
members: {
[username: string]: string;
};
}


export const deleteOrg = async (
authorizationToken: string,
orgName: string
Expand Down Expand Up @@ -98,7 +97,7 @@ export const addOrgMembers = async (
},
}
);

return respnse;
};

Expand Down Expand Up @@ -142,7 +141,6 @@ export const changeOrgMembersStatus = async (
return respnse;
};


export const setArcheiveStatus = async (
authorizationToken: string,
orgName: string,
Expand Down Expand Up @@ -189,7 +187,7 @@ export const setBookmarkStatus = async (
export const getOrgMembers = async (
authorizationToken: string,
orgName: string
) : Promise<AxiosResponse<OrgMembers>> => {
): Promise<AxiosResponse<OrgMembers>> => {
const url = BACKEND_URL + '/api/protected/org/getMembers/' + orgName;

const respnse = await axios.get<OrgMembers>(url, {
Expand All @@ -204,7 +202,7 @@ export const getOrgMembers = async (
export const getOrgProjects = async (
authorizationToken: string,
orgName: string
):Promise<AxiosResponse<OrgProjects>> => {
): Promise<AxiosResponse<OrgProjects>> => {
const url = BACKEND_URL + '/api/protected/org/getProjects/' + orgName;
const respnse = await axios.get<OrgProjects>(url, {
headers: {
Expand All @@ -215,7 +213,10 @@ export const getOrgProjects = async (
return respnse;
};

export const getOrg = async (authorizationToken: string, orgName: string): Promise<AxiosResponse<Workspace>> => {
export const getOrg = async (
authorizationToken: string,
orgName: string
): Promise<AxiosResponse<Workspace>> => {
const url = BACKEND_URL + '/api/protected/org/getOrg/' + orgName;
const respnse = await axios.get<Workspace>(url, {
headers: {
Expand Down
20 changes: 10 additions & 10 deletions src/app/api/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ export interface projectBody {
link: string;
}

export interface GetProject{
id: number,
name: string,
description: string
export interface GetProject {
id: number;
name: string;
description: string;
}

export interface Member{
[key: string]:string
export interface Member {
[key: string]: string;
}
export interface ProjectMembers{
members:Member
export interface ProjectMembers {
members: Member;
}

export const addProject = async (
Expand Down Expand Up @@ -159,7 +159,7 @@ export const getProject = async (
authorizationToken: string,
projectName: string,
orgName: string
):Promise<AxiosResponse<GetProject>> => {
): Promise<AxiosResponse<GetProject>> => {
const url =
BACKEND_URL +
'/api/protected/project/getProject/' +
Expand All @@ -179,7 +179,7 @@ export const getMembers = async (
authorizationToken: string,
projectName: string,
orgName: string
) : Promise<AxiosResponse<ProjectMembers>>=> {
): Promise<AxiosResponse<ProjectMembers>> => {
const url =
BACKEND_URL +
'/api/protected/project/getMembers/' +
Expand Down
12 changes: 2 additions & 10 deletions src/app/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface UserData {
message: string;
}


export interface UserOrgs {
userOrgs: UserOrgDetails;
}
Expand All @@ -16,11 +15,8 @@ export interface UserOrgDetails {
role: string;
archive: string;
};

}



export interface AllUserData {
users: {
id: number;
Expand Down Expand Up @@ -96,17 +92,13 @@ export const setOrgArcheiveStatus = async (
);

return respnse;

};

export const getUserOrgs = async (
authorizationToken: string,
username: string
):Promise<AxiosResponse<UserOrgs>> => {
const url =
BACKEND_URL +
'/api/protected/user/getUserOrgs/' +
username;
): Promise<AxiosResponse<UserOrgs>> => {
const url = BACKEND_URL + '/api/protected/user/getUserOrgs/' + username;
const respnse = await axios.get<UserOrgs>(url, {
headers: {
Accept: 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/buttonBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import TimeRangeSwitch from 'app/components/timeRangeSwitch';

import './index.scss';
const ButtonBar = () => {
const [weeky, setWeekly]= useState<boolean>(true);
const [weeky, setWeekly] = useState<boolean>(true);
return (
<div className='project-upper-cont'>
<div className='button-bar'>
<button className='back-btn'>&larr; Back</button>
<TimeRangeSwitch weekly={weeky} setWeekly={setWeekly}/>
<TimeRangeSwitch weekly={weeky} setWeekly={setWeekly} />
</div>
<h1>Appetizer</h1>
<p>
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/timeRangeSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { timeRangeModel } from 'features/project/components/contributorCard/type
import { weekAction, monthAction } from './timeRangeSlice';
import './index.scss';

interface Props{
weekly: boolean,
setWeekly: (bool: boolean)=>void
interface Props {
weekly: boolean;
setWeekly: (bool: boolean) => void;
}

const TimeRangeSwitch:React.FC<Props> = ({weekly, setWeekly}) => {
const TimeRangeSwitch: React.FC<Props> = ({ weekly, setWeekly }) => {
const dispatch = useDispatch();
const isWeekly = useSelector((state: timeRangeModel) => state.isWeekly.value);

Expand Down
2 changes: 1 addition & 1 deletion src/app/constants/api.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const AVATAR_URL="https://api.multiavatar.com"
export const AVATAR_URL = 'https://api.multiavatar.com';
18 changes: 9 additions & 9 deletions src/app/context/user/userContext.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { UserOrgDetails, UserOrgs } from "app/api/user";
import { createContext } from "react";
import { UserOrgDetails, UserOrgs } from 'app/api/user';
import { createContext } from 'react';

export interface UserContextType{
username: String | null;
setUsername: (name: String)=>void;
userOrgs: UserOrgs | null;
setUserOrgs: (user_Orgs: UserOrgs)=> void
export interface UserContextType {
username: String | null;
setUsername: (name: String) => void;
userOrgs: UserOrgs | null;
setUserOrgs: (user_Orgs: UserOrgs) => void;
}

const UserContext= createContext<UserContextType | undefined>(undefined);
const UserContext = createContext<UserContextType | undefined>(undefined);

export default UserContext;
export default UserContext;
35 changes: 17 additions & 18 deletions src/app/context/user/userState.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { FC, ReactNode, useState } from "react";
import UserContext from "./userContext";
import { UserOrgDetails, UserOrgs } from "app/api/user";
import { FC, ReactNode, useState } from 'react';
import UserContext from './userContext';
import { UserOrgDetails, UserOrgs } from 'app/api/user';

interface Props{
children: ReactNode
interface Props {
children: ReactNode;
}

const UserState: FC<Props>= ({children})=>{
const UserState: FC<Props> = ({ children }) => {
const [username, setUsername] = useState<String | null>(null);
const [userOrgs, setUserOrgs] = useState<UserOrgs | null>(null);

const [username, setUsername] = useState<String | null>(null);
const [userOrgs, setUserOrgs] = useState<UserOrgs|null>(null)
return (
<UserContext.Provider
value={{ username, setUsername, userOrgs, setUserOrgs }}
>
{children}
</UserContext.Provider>
);
};

return (
<UserContext.Provider value={{username, setUsername, userOrgs, setUserOrgs}} >

{children}

</UserContext.Provider>
)
}

export default UserState
export default UserState;
Loading

0 comments on commit 5596cd2

Please sign in to comment.