Skip to content

Commit 5596cd2

Browse files
committed
style: project members
Signed-off-by: Karthik Ayangar <[email protected]>
1 parent 0aa5242 commit 5596cd2

File tree

33 files changed

+563
-552
lines changed

33 files changed

+563
-552
lines changed

src/app/api/file.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ export const uploadIcon = async (
2626

2727
export const getIcon = async (authorizationToken: string, orgName: string) => {
2828
const url = BACKEND_URL + '/api/protected/file/getIcon/' + orgName;
29-
const response = await axios.get(url,
30-
29+
const response = await axios.get(
30+
url,
31+
3132
{
32-
responseType:'blob',
33-
headers: {
34-
Authorization: `Bearer ${authorizationToken}`,
35-
Accept: "*/*"
36-
},
37-
});
33+
responseType: 'blob',
34+
headers: {
35+
Authorization: `Bearer ${authorizationToken}`,
36+
Accept: '*/*',
37+
},
38+
}
39+
);
3840
return response;
3941
};
4042

src/app/api/githubData.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
11
import axios, { AxiosResponse } from 'axios';
22
import { BACKEND_URL } from 'envConstants';
33

4-
5-
64
export interface Contributors {
75
[contributorName: string]: {
8-
issues: number,
9-
pulls: number,
10-
commits:number
6+
issues: number;
7+
pulls: number;
8+
commits: number;
119
};
1210
}
1311

1412
export interface ProjectsGithubData {
1513
[contributorName: string]: {
16-
issues: number,
17-
pulls: number,
18-
commits:number
14+
issues: number;
15+
pulls: number;
16+
commits: number;
1917
};
2018
}
2119

22-
23-
export interface OrgRank{
24-
contributors: Contributors
20+
export interface OrgRank {
21+
contributors: Contributors;
2522
}
2623

27-
2824
// Contributors==project issues commits pull
29-
export interface OrgProjectGithubData{
30-
projects: ProjectsGithubData
25+
export interface OrgProjectGithubData {
26+
projects: ProjectsGithubData;
3127
}
3228

33-
34-
3529
export const getOrgGithubData = async (
3630
authorizationToken: string,
3731
orgName: string,
3832
monthly: boolean
39-
):Promise<AxiosResponse<OrgProjectGithubData>> => {
33+
): Promise<AxiosResponse<OrgProjectGithubData>> => {
4034
const url =
4135
BACKEND_URL + '/api/protected/github/' + orgName + '?monthly=' + monthly;
4236
const respnse = await axios.get<OrgProjectGithubData>(url, {

src/app/api/organization.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,27 @@ export interface AllOrgs {
1414
}[];
1515
}
1616

17-
export interface Projects{
18-
[ProjectName: string]:{
19-
archeive:boolean,
20-
bookmark: boolean
21-
}
17+
export interface Projects {
18+
[ProjectName: string]: {
19+
archeive: boolean;
20+
bookmark: boolean;
21+
};
2222
}
23-
export interface OrgProjects{
24-
projects: Projects
23+
export interface OrgProjects {
24+
projects: Projects;
2525
}
2626

27-
export interface Workspace{
27+
export interface Workspace {
2828
id: number;
2929
name: string;
30-
description: string
30+
description: string;
3131
}
3232
interface OrgMembers {
3333
members: {
3434
[username: string]: string;
3535
};
3636
}
3737

38-
3938
export const deleteOrg = async (
4039
authorizationToken: string,
4140
orgName: string
@@ -98,7 +97,7 @@ export const addOrgMembers = async (
9897
},
9998
}
10099
);
101-
100+
102101
return respnse;
103102
};
104103

@@ -142,7 +141,6 @@ export const changeOrgMembersStatus = async (
142141
return respnse;
143142
};
144143

145-
146144
export const setArcheiveStatus = async (
147145
authorizationToken: string,
148146
orgName: string,
@@ -189,7 +187,7 @@ export const setBookmarkStatus = async (
189187
export const getOrgMembers = async (
190188
authorizationToken: string,
191189
orgName: string
192-
) : Promise<AxiosResponse<OrgMembers>> => {
190+
): Promise<AxiosResponse<OrgMembers>> => {
193191
const url = BACKEND_URL + '/api/protected/org/getMembers/' + orgName;
194192

195193
const respnse = await axios.get<OrgMembers>(url, {
@@ -204,7 +202,7 @@ export const getOrgMembers = async (
204202
export const getOrgProjects = async (
205203
authorizationToken: string,
206204
orgName: string
207-
):Promise<AxiosResponse<OrgProjects>> => {
205+
): Promise<AxiosResponse<OrgProjects>> => {
208206
const url = BACKEND_URL + '/api/protected/org/getProjects/' + orgName;
209207
const respnse = await axios.get<OrgProjects>(url, {
210208
headers: {
@@ -215,7 +213,10 @@ export const getOrgProjects = async (
215213
return respnse;
216214
};
217215

218-
export const getOrg = async (authorizationToken: string, orgName: string): Promise<AxiosResponse<Workspace>> => {
216+
export const getOrg = async (
217+
authorizationToken: string,
218+
orgName: string
219+
): Promise<AxiosResponse<Workspace>> => {
219220
const url = BACKEND_URL + '/api/protected/org/getOrg/' + orgName;
220221
const respnse = await axios.get<Workspace>(url, {
221222
headers: {

src/app/api/project.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ export interface projectBody {
77
link: string;
88
}
99

10-
export interface GetProject{
11-
id: number,
12-
name: string,
13-
description: string
10+
export interface GetProject {
11+
id: number;
12+
name: string;
13+
description: string;
1414
}
1515

16-
export interface Member{
17-
[key: string]:string
16+
export interface Member {
17+
[key: string]: string;
1818
}
19-
export interface ProjectMembers{
20-
members:Member
19+
export interface ProjectMembers {
20+
members: Member;
2121
}
2222

2323
export const addProject = async (
@@ -159,7 +159,7 @@ export const getProject = async (
159159
authorizationToken: string,
160160
projectName: string,
161161
orgName: string
162-
):Promise<AxiosResponse<GetProject>> => {
162+
): Promise<AxiosResponse<GetProject>> => {
163163
const url =
164164
BACKEND_URL +
165165
'/api/protected/project/getProject/' +
@@ -179,7 +179,7 @@ export const getMembers = async (
179179
authorizationToken: string,
180180
projectName: string,
181181
orgName: string
182-
) : Promise<AxiosResponse<ProjectMembers>>=> {
182+
): Promise<AxiosResponse<ProjectMembers>> => {
183183
const url =
184184
BACKEND_URL +
185185
'/api/protected/project/getMembers/' +

src/app/api/user.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export interface UserData {
55
message: string;
66
}
77

8-
98
export interface UserOrgs {
109
userOrgs: UserOrgDetails;
1110
}
@@ -16,11 +15,8 @@ export interface UserOrgDetails {
1615
role: string;
1716
archive: string;
1817
};
19-
2018
}
2119

22-
23-
2420
export interface AllUserData {
2521
users: {
2622
id: number;
@@ -96,17 +92,13 @@ export const setOrgArcheiveStatus = async (
9692
);
9793

9894
return respnse;
99-
10095
};
10196

10297
export const getUserOrgs = async (
10398
authorizationToken: string,
10499
username: string
105-
):Promise<AxiosResponse<UserOrgs>> => {
106-
const url =
107-
BACKEND_URL +
108-
'/api/protected/user/getUserOrgs/' +
109-
username;
100+
): Promise<AxiosResponse<UserOrgs>> => {
101+
const url = BACKEND_URL + '/api/protected/user/getUserOrgs/' + username;
110102
const respnse = await axios.get<UserOrgs>(url, {
111103
headers: {
112104
Accept: 'application/json',

src/app/components/buttonBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import TimeRangeSwitch from 'app/components/timeRangeSwitch';
33

44
import './index.scss';
55
const ButtonBar = () => {
6-
const [weeky, setWeekly]= useState<boolean>(true);
6+
const [weeky, setWeekly] = useState<boolean>(true);
77
return (
88
<div className='project-upper-cont'>
99
<div className='button-bar'>
1010
<button className='back-btn'>&larr; Back</button>
11-
<TimeRangeSwitch weekly={weeky} setWeekly={setWeekly}/>
11+
<TimeRangeSwitch weekly={weeky} setWeekly={setWeekly} />
1212
</div>
1313
<h1>Appetizer</h1>
1414
<p>

src/app/components/timeRangeSwitch/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { timeRangeModel } from 'features/project/components/contributorCard/type
44
import { weekAction, monthAction } from './timeRangeSlice';
55
import './index.scss';
66

7-
interface Props{
8-
weekly: boolean,
9-
setWeekly: (bool: boolean)=>void
7+
interface Props {
8+
weekly: boolean;
9+
setWeekly: (bool: boolean) => void;
1010
}
1111

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

src/app/constants/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const AVATAR_URL="https://api.multiavatar.com"
1+
export const AVATAR_URL = 'https://api.multiavatar.com';

src/app/context/user/userContext.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { UserOrgDetails, UserOrgs } from "app/api/user";
2-
import { createContext } from "react";
1+
import { UserOrgDetails, UserOrgs } from 'app/api/user';
2+
import { createContext } from 'react';
33

4-
export interface UserContextType{
5-
username: String | null;
6-
setUsername: (name: String)=>void;
7-
userOrgs: UserOrgs | null;
8-
setUserOrgs: (user_Orgs: UserOrgs)=> void
4+
export interface UserContextType {
5+
username: String | null;
6+
setUsername: (name: String) => void;
7+
userOrgs: UserOrgs | null;
8+
setUserOrgs: (user_Orgs: UserOrgs) => void;
99
}
1010

11-
const UserContext= createContext<UserContextType | undefined>(undefined);
11+
const UserContext = createContext<UserContextType | undefined>(undefined);
1212

13-
export default UserContext;
13+
export default UserContext;

src/app/context/user/userState.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
import { FC, ReactNode, useState } from "react";
2-
import UserContext from "./userContext";
3-
import { UserOrgDetails, UserOrgs } from "app/api/user";
1+
import { FC, ReactNode, useState } from 'react';
2+
import UserContext from './userContext';
3+
import { UserOrgDetails, UserOrgs } from 'app/api/user';
44

5-
interface Props{
6-
children: ReactNode
5+
interface Props {
6+
children: ReactNode;
77
}
88

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

11-
const [username, setUsername] = useState<String | null>(null);
12-
const [userOrgs, setUserOrgs] = useState<UserOrgs|null>(null)
13+
return (
14+
<UserContext.Provider
15+
value={{ username, setUsername, userOrgs, setUserOrgs }}
16+
>
17+
{children}
18+
</UserContext.Provider>
19+
);
20+
};
1321

14-
return (
15-
<UserContext.Provider value={{username, setUsername, userOrgs, setUserOrgs}} >
16-
17-
{children}
18-
19-
</UserContext.Provider>
20-
)
21-
}
22-
23-
export default UserState
22+
export default UserState;

0 commit comments

Comments
 (0)