Skip to content

Commit f5c3181

Browse files
committed
fix confilicts
2 parents 2eb5871 + aa4e0fd commit f5c3181

30 files changed

Lines changed: 1381 additions & 311 deletions

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
},
1111
},
1212

13-
plugins: ['react'],
13+
plugins: ['react', 'react-hooks'],
1414
rules: {
1515
'prettier/prettier': 'error',
1616
'react/prop-types': [2],

package-lock.json

Lines changed: 64 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"@apollo/client": "^3.7.3",
77
"@date-io/date-fns": "^1.3.13",
88
"@material-ui/core": "^4.12.4",
9+
"@material-ui/icons": "^4.11.3",
910
"@material-ui/pickers": "^3.3.10",
1011
"@material/elevation": "^0.44.0",
1112
"@material/react-button": "^0.9.2",
@@ -34,6 +35,7 @@
3435
"@material/ripple": "^0.44.1",
3536
"@material/top-app-bar": "^0.44.0",
3637
"@sentry/browser": "^5.30.0",
38+
"ace-builds": "^1.14.0",
3739
"babel-polyfill": "^6.26.0",
3840
"date-fns": "^2.29.3",
3941
"express": "^4.18.2",
@@ -47,6 +49,7 @@
4749
"prop-types": "^15.8.1",
4850
"query-string": "^6.14.1",
4951
"react": "^18.2.0",
52+
"react-ace": "^10.1.0",
5053
"react-card": "^1.0.4",
5154
"react-dom": "^18.2.0",
5255
"react-download-link": "^2.3.0",
@@ -58,6 +61,7 @@
5861
"react-scripts": "^4.0.3",
5962
"react-slick": "^0.26.1",
6063
"react-social-icons": "^4.1.0",
64+
"react-split": "^2.0.14",
6165
"slick-carousel": "^1.8.1",
6266
"styled-components": "^5.3.6",
6367
"swagger-ui": "^4.15.5",

src/Components/common/AppBar/CustomTopAppBar.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ const CustomTopAppBar = ({ setDrawerOpen }) => {
4141

4242
return (
4343
<div>
44-
<TopAppBar fixed className="react-top-app-bar-alternate">
44+
<TopAppBar
45+
fixed
46+
className="react-top-app-bar-alternate"
47+
style={{
48+
zIndex: 1000,
49+
}}
50+
>
4551
<TopAppBarRow>
4652
<TopAppBarSection align="start">
4753
<TopAppBarIcon navIcon tabIndex={0}>

src/Components/common/AppBar/drawerItems.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,55 @@ const drawerItems = [
2222
},
2323
{
2424
id: 3,
25+
name: 'Code',
26+
icon: 'data_object',
27+
path: '/code',
28+
materialIcon: true,
29+
},
30+
{
31+
id: 4,
2532
name: 'Blogs',
2633
icon: 'library_books',
2734
path: '/blogs',
2835
materialIcon: true,
2936
},
3037
{
31-
id: 4,
38+
id: 5,
3239
name: 'Problem Set',
3340
icon: 'question_answer',
3441
path: '/problem-set',
3542
materialIcon: true,
3643
},
3744
{
38-
id: 5,
45+
id: 6,
3946
name: 'Playlists',
4047
icon: 'playlist_play',
4148
path: '/playlists',
4249
materialIcon: true,
4350
},
4451
{
45-
id: 6,
52+
id: 7,
4653
name: 'Goodies',
4754
icon: 'card_giftcard',
4855
path: '/goodies',
4956
materialIcon: true,
5057
},
5158
{
52-
id: 7,
59+
id: 8,
5360
name: 'Learn',
5461
icon: 'school',
5562
path: '/learn',
5663
materialIcon: true,
5764
},
5865
{
59-
id: 8,
66+
id: 9,
6067
name: 'Labs',
6168
icon: 'insights',
6269
path: '/labs',
6370
materialIcon: true,
6471
},
6572
{
66-
id: 9,
73+
id: 10,
6774
name: 'API',
6875
icon: 'api',
6976
path: '/api',

src/Components/drawer/Api/ApiDocs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@
585585
}
586586
},
587587
"submissionStats": {
588-
"type": "object",
588+
"type": "property",
589589
"items": {
590590
"accepted": {
591591
"type": "integer",
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import React, { useState } from 'react';
2+
import PropTypes from 'prop-types';
3+
import { Route } from 'react-router-dom';
4+
import { Cell } from '@material/react-layout-grid';
5+
import Fab from '@material/react-fab';
6+
import MaterialIcon from '@material/react-material-icon';
7+
import ContestDetails from './ContestDetails';
8+
import Announcements from './Announcements';
9+
import Submit from './SubmitOnProblemPage';
10+
import ContestTabBar from './ContestTabBar';
11+
import './Split.css';
12+
13+
const ContestPageElement = ({ children, contestDetails, isMobile, parentClassName }) => {
14+
const { name, description, endsAt, announcement, startsAt } = contestDetails;
15+
const [isEditorOpen, setEditorOpen] = useState(false);
16+
return (
17+
<React.Fragment key="ChildrenElement">
18+
{(!isMobile || !isEditorOpen) && (
19+
<Cell desktopColumns={9} tabletColumns={8} className={`${parentClassName} scrollbar`}>
20+
<Cell>
21+
<Route path="/contests/:contestId" exact component={ContestTabBar} />
22+
<Route path="/contests/:contestId/status" exact component={ContestTabBar} />
23+
<Route path="/contests/:contestId/my" exact component={ContestTabBar} />
24+
<Route path="/contests/:contestId/scoreboard" exact component={ContestTabBar} />
25+
{/* <Route path="/contests/:contestId/submit" exact component={ContestTabBar} /> */}
26+
<Route path="/contests/:contestId/change" exact component={ContestTabBar} />
27+
<Route path="/contests/:contestId/problem/:problemId" exact component={ContestTabBar} />
28+
{children}
29+
</Cell>
30+
31+
<Cell>
32+
<ContestDetails
33+
name={name}
34+
description={description}
35+
endsAt={endsAt}
36+
startsAt={startsAt}
37+
/>
38+
</Cell>
39+
<Cell>
40+
<Announcements announcement={announcement} />
41+
</Cell>
42+
</Cell>
43+
)}
44+
{isMobile && (
45+
<Fab
46+
textLabel={!isEditorOpen ? 'Editor' : 'Back'}
47+
className="center editor-btn-fab"
48+
icon={<MaterialIcon icon={!isEditorOpen ? 'data_object' : 'arrow_back_ios'} />}
49+
onClick={() => setEditorOpen(!isEditorOpen)}
50+
/>
51+
)}
52+
{(!isMobile || isEditorOpen) && (
53+
<Cell className="editor scrollbar">
54+
<Submit setEditorOpen={setEditorOpen} />
55+
</Cell>
56+
)}
57+
</React.Fragment>
58+
);
59+
};
60+
61+
ContestPageElement.propTypes = {
62+
children: PropTypes.any.isRequired,
63+
contestDetails: PropTypes.object.isRequired,
64+
isMobile: PropTypes.bool.isRequired,
65+
parentClassName: PropTypes.string.isRequired,
66+
};
67+
export default ContestPageElement;

src/Components/drawer/contests/common/ContestPageSkeleton.jsx

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import PropTypes from 'prop-types';
3-
import { Route } from 'react-router-dom';
4-
import { Cell, Grid, Row } from '@material/react-layout-grid';
5-
import ContestDetails from './ContestDetails';
6-
import Announcements from './Announcements';
7-
import Submit from './SubmitOnProblemPage';
8-
import ContestTabBar from './ContestTabBar';
3+
import Split from 'react-split';
4+
import './Split.css';
5+
import useResizeWindow from '../../../../customHooks/useResizeWindow';
6+
import ContestPageElement from './ContestPageElement';
97

108
const ContestPageSkeleton = ({ children, contestDetails }) => {
11-
const { name, description, endsAt, announcement, startsAt } = contestDetails;
12-
13-
return (
14-
<Grid className="">
15-
<Row>
16-
<Cell desktopColumns={9} tabletColumns={8}>
17-
<Cell>
18-
<Route path="/contests/:contestId" exact component={ContestTabBar} />
19-
<Route path="/contests/:contestId/status" exact component={ContestTabBar} />
20-
<Route path="/contests/:contestId/my" exact component={ContestTabBar} />
21-
<Route path="/contests/:contestId/scoreboard" exact component={ContestTabBar} />
22-
<Route path="/contests/:contestId/submit" exact component={ContestTabBar} />
23-
<Route path="/contests/:contestId/change" exact component={ContestTabBar} />
24-
{children}
25-
</Cell>
26-
</Cell>
27-
<Cell desktopColumns={3} tabletColumns={8}>
28-
<Cell>
29-
<ContestDetails
30-
name={name}
31-
description={description}
32-
endsAt={endsAt}
33-
startsAt={startsAt}
34-
/>
35-
</Cell>
36-
<Cell>
37-
<Announcements announcement={announcement} />
38-
</Cell>
39-
<Cell>
40-
<Route path="/contests/:contestId/problem/:problemId" exact component={Submit} />
41-
</Cell>
42-
</Cell>
43-
</Row>
44-
</Grid>
9+
const [parentClassName, setParentClassName] = useState('o-hidden ml-0-5 mr-0-5');
10+
const width = useResizeWindow();
11+
const isMobile = width <= 768;
12+
const ChildrenElement = (
13+
<ContestPageElement
14+
isMobile={isMobile}
15+
parentClassName={parentClassName}
16+
contestDetails={contestDetails}
17+
key="ChildrenElement"
18+
>
19+
{children}
20+
</ContestPageElement>
4521
);
22+
23+
if (!isMobile) {
24+
return (
25+
<Split
26+
className="split"
27+
dragInterval={1}
28+
direction="horizontal"
29+
cursor="col-resize"
30+
sizes={[35, 65]}
31+
minSize={[0, 350]}
32+
// if drag to left then remove margin
33+
onDragEnd={(sizes) => {
34+
if (sizes[0] < 10) {
35+
setParentClassName('o-hidden ml-0 mr-0');
36+
} else {
37+
setParentClassName('o-hidden ml-0-5 mr-0-5');
38+
}
39+
}}
40+
>
41+
{[ChildrenElement]}
42+
</Split>
43+
);
44+
}
45+
return ChildrenElement;
4646
};
4747

4848
ContestPageSkeleton.propTypes = {

src/Components/drawer/contests/common/ContestTabBar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ const ContestTabBar = () => {
7575
<></>
7676
)
7777
}
78-
{authState.user.name ? (
78+
{/* {authState.user.name ? (
7979
<Tab onClick={() => onTabClick(`/${url}/submit`)}>
8080
<span className="mdc-tab__text-label">Submit</span>
8181
</Tab>
8282
) : (
8383
<></>
84-
)}
84+
)} */}
8585
</TabBar>
8686
);
8787
};
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.split {
2+
display: flex;
3+
flex-direction: row;
4+
}
5+
6+
.gutter {
7+
background-color: #eee;
8+
background-repeat: no-repeat;
9+
background-position: 50%;
10+
}
11+
12+
.gutter.gutter-horizontal {
13+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
14+
cursor: col-resize;
15+
}
16+
17+
.gutter.gutter-horizontal:hover {
18+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
19+
cursor: col-resize;
20+
background-color: rgb(240, 232, 255);
21+
}
22+
23+
.ml-0-5 {
24+
margin-left: 0.5rem;
25+
}
26+
27+
.mr-0-5 {
28+
margin-right: 0.5rem;
29+
padding-right: 0.2rem;
30+
}
31+
32+
.ml-0 {
33+
margin-left: 0rem;
34+
}
35+
36+
.mr-0 {
37+
margin-right: 0rem;
38+
padding-right: 0rem;
39+
}
40+
41+
.editor {
42+
margin-left: 0.5rem;
43+
margin-right: 0.5rem;
44+
padding: 0.5rem 0.5rem 0rem 0rem;
45+
}
46+
47+
.scrollbar {
48+
overflow-y: auto !important;
49+
overflow-x: hidden !important;
50+
height: 95vh;
51+
position: relative;
52+
scroll-behavior: smooth;
53+
padding-bottom: 2rem;
54+
}
55+
@media (max-width: 768px) {
56+
.editor {
57+
margin-top: 0.4rem;
58+
}
59+
/* remove scrollbar */
60+
.scrollbar {
61+
overflow-y: hidden !important;
62+
height: inherit;
63+
padding-bottom: 0rem;
64+
}
65+
}

0 commit comments

Comments
 (0)