Skip to content

Commit 7bced3b

Browse files
committed
Merge branch 'staging' into frontend-changes2
2 parents af68728 + 02b9a80 commit 7bced3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4077
-9
lines changed

apps/frontend/src/app/collaboration/[id]/page.tsx

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
.collaboration-layout {
2+
background: white;
3+
display: flex;
4+
flex-direction: column;
5+
height: 100vh;
6+
}
7+
8+
.collaboration-content {
9+
background: white;
10+
flex: 1;
11+
overflow-y: auto;
12+
}
13+
14+
.first-col,
15+
.second-col,
16+
.third-col {
17+
height: 90vh;
18+
}
19+
20+
.collab-row {
21+
padding: 0rem 1rem;
22+
}
23+
24+
.question-row {
25+
height: 60%;
26+
padding: 1rem 0.25rem 0.25rem;
27+
}
28+
29+
.test-row {
30+
height: 40%;
31+
padding: 0.25rem;
32+
}
33+
34+
.code-row {
35+
height: 100%;
36+
padding: 1rem 0.25rem 0.25rem;
37+
}
38+
39+
.session-row {
40+
height: 20%;
41+
padding: 1rem 0.25rem 0.25rem;
42+
}
43+
44+
.chat-row {
45+
height: 80%;
46+
padding: 0.25rem;
47+
}
48+
49+
.question-container {
50+
border: 2px solid #463f3a;
51+
border-radius: 10px;
52+
width: 100%;
53+
padding: 1rem;
54+
}
55+
56+
.test-container {
57+
border: 2px solid #463f3a;
58+
border-radius: 10px;
59+
width: 100%;
60+
padding: 1rem;
61+
}
62+
63+
.test-top-container,
64+
.code-top-container,
65+
.session-top-container {
66+
display: flex;
67+
justify-content: space-between;
68+
}
69+
70+
.code-container {
71+
border: 2px solid #463f3a;
72+
border-radius: 10px;
73+
width: 100%;
74+
padding: 1rem;
75+
}
76+
77+
// .code-second-container {
78+
// display: flex;
79+
// margin: 4px 0px;
80+
// }
81+
82+
.code-language {
83+
margin: auto 8px auto 0px;
84+
}
85+
86+
.language-select {
87+
width: 120px;
88+
}
89+
90+
.session-container {
91+
border: 2px solid #463f3a;
92+
border-radius: 10px;
93+
width: 100%;
94+
padding: 1rem;
95+
}
96+
97+
.chat-container {
98+
border: 2px solid #463f3a;
99+
border-radius: 10px;
100+
width: 100%;
101+
padding: 1rem;
102+
}
103+
104+
.chat-message-box {
105+
margin-top: 1rem;
106+
height: 365px;
107+
border: 1px solid #d9d9d9;
108+
border-radius: 6px;
109+
overflow-y: scroll;
110+
}
111+
112+
.chat-header-message {
113+
font-size: 14px;
114+
color: #c6c6c6;
115+
margin: 3px auto;
116+
text-align: center;
117+
}
118+
119+
.chat-typing-box {
120+
margin-top: 1rem;
121+
}
122+
123+
.question-title,
124+
.test-title,
125+
.code-title,
126+
.session-title,
127+
.chat-title {
128+
font-size: 16px;
129+
font-weight: bold;
130+
}
131+
132+
.question-difficulty,
133+
.question-topic {
134+
margin: 4px 0px;
135+
}
136+
137+
.session-duration,
138+
.session-matched-user-label {
139+
margin: 4px 0px;
140+
}
141+
142+
.session-duration-timer {
143+
font-weight: normal;
144+
margin-left: 8px;
145+
}
146+
147+
.session-matched-user-name {
148+
color: #e0afa0;
149+
margin-left: 8px;
150+
}
151+
152+
.topic-label,
153+
.session-duration,
154+
.session-matched-user-label {
155+
font-size: 14px;
156+
font-weight: bold;
157+
}
158+
159+
.question-description {
160+
text-align: justify;
161+
text-justify: inter-word;
162+
line-height: 1.3;
163+
margin-top: 1rem;
164+
max-height: 270px;
165+
overflow-y: scroll;
166+
}
167+
168+
.title-icons {
169+
margin-right: 4px;
170+
}
171+
172+
.code-submit-button,
173+
.session-end-button,
174+
.test-case-button {
175+
width: fit-content;
176+
}
177+
178+
.modal-description {
179+
margin-bottom: 2rem;
180+
}
181+
182+
.session-modal-question,
183+
.session-modal-difficulty,
184+
.session-modal-duration,
185+
.session-modal-matched-user {
186+
font-weight: bold;
187+
}
188+
189+
.session-modal-time,
190+
.session-modal-title {
191+
font-weight: normal;
192+
}
193+
.session-modal-matched-user-name {
194+
color: #e0afa0;
195+
}
196+
197+
.info-modal-icon {
198+
color: red;
199+
}

apps/frontend/src/app/matching/MatchingModal.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { useTimer } from 'react-timer-hook';
1818
import { useRouter } from 'next/router';
1919

2020
interface MatchingModalProps {
21-
isOpen: boolean;
22-
close: () => void;
21+
isOpen: boolean;
22+
close: () => void;
2323
}
2424

2525
export interface MatchParams {
@@ -52,14 +52,14 @@ const MatchingModal: React.FC<MatchingModalProps> = ({ isOpen, close: _close })
5252
});
5353
const passed = MATCH_TIMEOUT - totalSeconds;
5454

55-
function close() {
56-
// clean up matching and closedType State
57-
if (matchingState.state === "timeout") {
58-
matchingState.ok();
59-
}
60-
setClosedType("finding");
61-
_close();
55+
function close() {
56+
// clean up matching and closedType State
57+
if (matchingState.state === "timeout") {
58+
matchingState.ok();
6259
}
60+
setClosedType("finding");
61+
_close();
62+
}
6363

6464
const startMatch = matchingState.state == "closed" || matchingState.state == "timeout" ? async (params: MatchParams): Promise<void> => {
6565
const user = await ValidateUser();
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
const HISTORY_SERVICE_URL = process.env.NEXT_PUBLIC_HISTORY_SERVICE_URL;
2+
3+
export interface History {
4+
title: string;
5+
code: string;
6+
language: string;
7+
user: string;
8+
matchedUser: string;
9+
matchId: string;
10+
matchedTopics: string[];
11+
questionDocRefId: string;
12+
questionDifficulty: string;
13+
questionTopics: string[];
14+
createdAt?: string;
15+
updatedAt?: string;
16+
}
17+
18+
export const CreateOrUpdateHistory = async (
19+
history: History,
20+
matchId: string,
21+
): Promise<History> => {
22+
const response = await fetch(
23+
`${HISTORY_SERVICE_URL}histories/${matchId}`,
24+
{
25+
method: "PUT",
26+
headers: {
27+
"Content-Type": "application/json",
28+
},
29+
body: JSON.stringify(history),
30+
}
31+
);
32+
33+
if (response.status === 200) {
34+
return response.json();
35+
} else {
36+
throw new Error(
37+
`Error saving history: ${response.status} ${response.statusText}`
38+
);
39+
}
40+
}
41+
42+
export const GetHistory = async (
43+
matchId: string,
44+
): Promise<History> => {
45+
const response = await fetch(
46+
`${HISTORY_SERVICE_URL}histories/${matchId}`,
47+
{
48+
method: "GET",
49+
headers: {
50+
"Content-Type": "application/json",
51+
},
52+
}
53+
);
54+
55+
if (response.status === 200) {
56+
return response.json();
57+
} else {
58+
throw new Error(
59+
`Error reading history: ${response.status} ${response.statusText}`
60+
);
61+
}
62+
}
63+
64+
export const GetUserHistories = async (
65+
username: string,
66+
): Promise<History[]> => {
67+
const response = await fetch(
68+
`${HISTORY_SERVICE_URL}histories/${username}`,
69+
{
70+
method: "GET",
71+
headers: {
72+
"Content-Type": "application/json",
73+
},
74+
}
75+
);
76+
77+
if (response.status === 200) {
78+
return response.json();
79+
} else {
80+
throw new Error(
81+
`Error reading user histories: ${response.status} ${response.statusText}`
82+
);
83+
}
84+
}

0 commit comments

Comments
 (0)