Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #164 from sef-global/development
Browse files Browse the repository at this point in the history
ScholarX - v1.2 Release
  • Loading branch information
jayasanka-sack authored Jun 5, 2021
2 parents deb516b + 398cb40 commit 8fab792
Show file tree
Hide file tree
Showing 44 changed files with 1,700 additions and 606 deletions.
231 changes: 31 additions & 200 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development",
"build": "webpack",
"build": "webpack --mode production",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src --color",
"lint-fix": "eslint --ext .js,.jsx,.ts,.tsx src --color --fix",
"prepare": "husky install"
Expand Down Expand Up @@ -36,6 +36,7 @@
"lint-staged": "^10.5.4",
"prettier": "^2.0.5",
"react-hot-loader": "^4.12.21",
"react-moment": "^1.1.1",
"style-loader": "^1.2.1",
"typescript": "^3.9.7",
"webpack": "^4.44.0",
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const API_URL = '/api';
export const AUTH_URL = '/login';
export const LOGOUT_URL = '/logout';
export const APPLICATION_TEMPLATE =
'https://docs.google.com/document/d/1pRd2Mml7ejjY9rbgQS0PEo3AWooenHWKsXWBAQmnw9Q/edit?usp=sharing';
44 changes: 42 additions & 2 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ export interface Profile {
headline: string;
linkedinUrl: string;
type: string;
name: string;
attributes: string;
authorities: [
{
authority: string,
}
];
}

export interface SavedProgram extends UnsavedProgram {
id: number;
state: string;
imageUrl: string;
}

export interface UnsavedProgram {
Expand All @@ -38,6 +46,38 @@ export interface Mentee {
}

export interface Application {
application: string;
prerequisites: string;
response: string;
question: {
id: number,
};
}
export interface Question {
id: number;
question: string;
category: string;
}
export interface MentorQuestion extends Question {
program: SavedProgram;
}
export interface QuestionResponse {
id: {
questionId: number,
mentorId: number,
};
question: MentorQuestion;
mentor: Mentor;
response: string;
}

export interface UpdateQuestion {
id: {
questionId: number,
mentorId: number,
};
response: string;
}

export interface FormData {
key: number;
value: string;
}
25 changes: 24 additions & 1 deletion src/scenes/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AppstoreOutlined,
EditOutlined,
TeamOutlined,
ProfileOutlined,
} from '@ant-design/icons';
import {
Link,
Expand All @@ -23,6 +24,8 @@ import { Profile } from '../../interfaces';
import { UserContext } from '../../index';
import LogInModal from '../../components/LogInModal';
import { LOGOUT_URL } from '../../constants';
import MentorQuestions from './scenes/MentorQuestions';
import MenteeQuestions from './scenes/MenteeQuestions';

const { Content, Sider, Header } = Layout;

Expand Down Expand Up @@ -66,6 +69,16 @@ function Dashboard() {
<TeamOutlined /> Manage Mentees
</Link>
</Menu.Item>
<Menu.Item key="5">
<Link to={`/dashboard/${programId}/mentor-questions`}>
<ProfileOutlined /> Mentor Questions
</Link>
</Menu.Item>
<Menu.Item key="6">
<Link to={`/dashboard/${programId}/mentee-questions`}>
<ProfileOutlined /> Mentee Questions
</Link>
</Menu.Item>
</Menu>
</Sider>
<Layout>
Expand All @@ -78,7 +91,7 @@ function Dashboard() {
>
<Menu.ItemGroup title={localStorage.username}>
<Menu.Item>
<a href={LOGOUT_URL}>logout</a>
<a href={LOGOUT_URL}>Logout</a>
</Menu.Item>
</Menu.ItemGroup>
</Menu.SubMenu>
Expand Down Expand Up @@ -111,6 +124,16 @@ function Dashboard() {
path="/dashboard/:programId/manage-mentees"
component={ManageMentees}
/>
<Route
exact
path="/dashboard/:programId/mentor-questions"
component={MentorQuestions}
/>
<Route
exact
path="/dashboard/:programId/mentee-questions"
component={MenteeQuestions}
/>
</Switch>
</Content>
</Layout>
Expand Down
89 changes: 48 additions & 41 deletions src/scenes/Dashboard/scenes/ChangeState/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Progress,
Modal,
notification,
Spin,
} from 'antd';
import { State } from './interfaces';
import { ExclamationCircleOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -86,6 +87,7 @@ function ChangeState() {
const { programId } = useParams();
const [programTitle, setProgramTitle] = useState<string>('');
const [currentStep, setCurrentStep] = useState<number>(0);
const [isLoading, setIsLoading] = useState<boolean>(false);
useEffect(() => {
axios
.get(`${API_URL}/programs/${programId}`, {
Expand All @@ -107,12 +109,14 @@ function ChangeState() {
});
});
const handleStepChange = () => {
setIsLoading(true);
axios({
method: 'put',
url: `${API_URL}/admin/programs/${programId}/state`,
withCredentials: true,
})
.then((result) => {
setIsLoading(false);
if (result.status == 200) {
setCurrentStep(currentStep + 1);
notification.success({
Expand All @@ -124,6 +128,7 @@ function ChangeState() {
}
})
.catch(() => {
setIsLoading(false);
notification.warning({
message: 'Warning!',
description: 'Something went wrong when changing the state',
Expand All @@ -148,49 +153,51 @@ function ChangeState() {
});
};
return (
<div className={styles.contentWrapper}>
<Title>Change State</Title>
<Row justify="center">
<Col md={20}>
<Card className={styles.cardWrapper}>
<Title level={3}>{programTitle}</Title>
<Progress
className={styles.progress}
type="circle"
percent={Math.round(
((currentStep + 1) * 100) / programStates.length
)}
/>
<Paragraph>
<Text type="warning">Current State: </Text>{' '}
{programStates[currentStep].name}
</Paragraph>
<Paragraph>{programStates[currentStep].description}</Paragraph>
<Button
type="primary"
onClick={showConfirm}
disabled={currentStep >= programStates.length - 1}
>
Change State
</Button>
</Card>
<br />
</Col>
</Row>
<div className={styles.bottomDoc}>
<Steps progressDot current={currentStep}>
{programStates.map((step: State) => {
return (
<Step
key={step.stepNo}
title={'Phase ' + (step.stepNo + 1)}
description={step.name}
<Spin tip="Loading..." spinning={isLoading}>
<div className={styles.contentWrapper}>
<Title>Change State</Title>
<Row justify="center">
<Col md={20}>
<Card className={styles.cardWrapper}>
<Title level={3}>{programTitle}</Title>
<Progress
className={styles.progress}
type="circle"
percent={Math.round(
((currentStep + 1) * 100) / programStates.length
)}
/>
);
})}
</Steps>
<Paragraph>
<Text type="warning">Current State: </Text>{' '}
{programStates[currentStep].name}
</Paragraph>
<Paragraph>{programStates[currentStep].description}</Paragraph>
<Button
type="primary"
onClick={showConfirm}
disabled={currentStep >= programStates.length - 1}
>
Change State
</Button>
</Card>
<br />
</Col>
</Row>
<div className={styles.bottomDoc}>
<Steps progressDot current={currentStep}>
{programStates.map((step: State) => {
return (
<Step
key={step.stepNo}
title={'Phase ' + (step.stepNo + 1)}
description={step.name}
/>
);
})}
</Steps>
</div>
</div>
</div>
</Spin>
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/scenes/Dashboard/scenes/ManageMentees/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Mentee } from './interfaces';
import { useParams } from 'react-router';
import axios, { AxiosResponse } from 'axios';
import { API_URL } from '../../../../constants';
import styles from '../../styles.css';

const { Title } = Typography;
const { confirm } = Modal;
Expand Down Expand Up @@ -76,7 +77,7 @@ function ManageMentees() {
};

return (
<div>
<div className={styles.container}>
<Title>Manage Mentees</Title>
<Spin tip="Loading..." spinning={isLoading}>
<List
Expand Down
1 change: 1 addition & 0 deletions src/scenes/Dashboard/scenes/ManageMentees/interfaces.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Profile } from '../../../../interfaces';

export interface Mentee {
id: number;
profile: Profile;
state: string;
submissionUrl: string;
Expand Down
Loading

0 comments on commit 8fab792

Please sign in to comment.