Skip to content

Commit 5bf2f0d

Browse files
committed
Resizing panels & some small fixes
1 parent 759c04d commit 5bf2f0d

File tree

10 files changed

+105
-10
lines changed

10 files changed

+105
-10
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"react-markdown": "^10.1.0",
2929
"react-redux": "^9.2.0",
3030
"react-router-dom": "^7.9.6",
31+
"react-split": "^2.0.14",
3132
"react-timer-hook": "^4.0.5",
3233
"redux": "^5.0.1",
3334
"redux-persist": "^6.0.0",

pnpm-lock.yaml

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

src/app/styles/index.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,24 @@
77
background: var(--background);
88
color: var(--text-primary);
99
}
10+
11+
// Gutter for resizing panels
12+
.gutter {
13+
width: 1em;
14+
15+
display: flex;
16+
align-items: center;
17+
justify-content: center;
18+
19+
cursor: col-resize;
20+
21+
&::before {
22+
content: "\22EE"; // Three vertical dots
23+
24+
font-size: 1.25em;
25+
font-weight: 700;
26+
27+
pointer-events: none;
28+
color: var(--card-secondary);
29+
}
30+
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
.duelPage {
22
display: flex;
33
padding: 1em;
4-
gap: 1em;
5-
overflow: auto;
4+
overflow: hidden;
5+
}
6+
7+
.split {
8+
display: flex;
9+
flex: 1;
610
}

src/pages/duel/ui/DuelPage/DuelPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import Split from "react-split";
12
import { CodePanel } from "widgets/code-panel";
23
import { TaskPanel } from "widgets/task-panel";
34
import styles from "./DuelPage.module.scss";
45

56
const DuelPage = () => {
67
return (
78
<div className={styles.duelPage}>
8-
<CodePanel />
9-
<TaskPanel />
9+
<Split direction="horizontal" sizes={[50, 50]} minSize={300} className={styles.split}>
10+
<CodePanel />
11+
<TaskPanel />
12+
</Split>
1013
</div>
1114
);
1215
};

src/shared/ui/Button/Button.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
display: flex;
6565
align-items: center;
6666
justify-content: center;
67+
flex-shrink: 0;
6768

6869
svg {
6970
width: 1.25em;

src/shared/ui/TabbedCard/TabbedCard.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.tabbedCard {
22
display: flex;
33
flex-direction: column;
4-
width: 50%;
54

65
background-color: var(--card-primary);
76
border-radius: 0.5em;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.codePanelContent {
2-
flex: 1;
32
height: 100%;
43
overflow: hidden;
54
}

src/widgets/task-panel/ui/TaskPanel/TaskPanel.module.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
.taskPanelContent {
2-
flex: 1;
3-
42
border-radius: 0 0 0.5em 0.5em;
53

64
overflow-y: auto;

src/widgets/task-panel/ui/TaskSubmissionsContent/TaskSubmissionsContent.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ export const TaskSubmissionsContent = () => {
2525
});
2626

2727
useEffect(() => {
28-
setShouldPollSubmissions(!submissions?.every((s) => s.status === "Done"));
29-
}, [submissions]);
28+
if (submissions?.every((s) => s.status === "Done") || isError) {
29+
setShouldPollSubmissions(false);
30+
} else {
31+
setShouldPollSubmissions(true);
32+
}
33+
}, [submissions, isError]);
3034

3135
if (isSubmissionsLoading || isDuelLoading) {
3236
return <Loader />;

0 commit comments

Comments
 (0)