Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs #71

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion collab_service/src/services/roomService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function updateMessages(roomId: string, messages: ChatMessage[]) {
}

async function getRandomQuestion(topic: string, difficulty: DifficultyLevel) {
let url = `${QUESTION_SERVICE}/questions/random/?topic=${topic}&difficulty=${difficulty}`;
let url = `${QUESTION_SERVICE}/questions/random/?topic=${topic}&difficultyLevel=${difficulty}`;
try {
const response = await axios.get(url);
return response.data;
Expand Down
12 changes: 11 additions & 1 deletion peerprep_fe/src/app/workspace/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const Workspace: React.FC<WorkspaceProps> = ({ params }) => {
const [isChatOpen, setIsChatOpen] = useState<boolean>(false);
const [isVideoOpen, setIsVideoOpen] = useState<boolean>(true);
const [leaveMessage, setLeaveMessage] = useState<string>("");
const [isNextBtnLoading, setIsNextBtnLoading] = useState<boolean>(false);
const { stopStream } = useCall();

function handleLeaveRoom() {
Expand Down Expand Up @@ -129,6 +130,7 @@ const Workspace: React.FC<WorkspaceProps> = ({ params }) => {
setError("User rejected the request to proceed to next question");
setIsErrorModalOpen(true);
}
setIsNextBtnLoading(false);
};
const openChat = () => {
setIsChatOpen(true);
Expand All @@ -138,6 +140,10 @@ const Workspace: React.FC<WorkspaceProps> = ({ params }) => {
setIsChatOpen(false);
setIsVideoOpen(true);
};
const onNextQuestion = () => {
nextQuestion();
setIsNextBtnLoading(true);
};

useEffect(() => {
if (!socket) return;
Expand Down Expand Up @@ -238,7 +244,11 @@ const Workspace: React.FC<WorkspaceProps> = ({ params }) => {
{/* Right Pane */}
<div className="w-3/5 px-4 inline-flex flex-col">
<CodeEditor />
<Button text="Next Question" onClick={nextQuestion} />
<Button
loading={isNextBtnLoading}
text="Next Question"
onClick={onNextQuestion}
/>
</div>
</div>
<NextQuestionRequestModal />
Expand Down
6 changes: 3 additions & 3 deletions peerprep_fe/src/components/workspace/problem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Problem: React.FC<ProblemProps> = ({ questionId }) => {
{/* Examples */}
{question?.examples && (
<div className="mb-4">
<h3 className="title">Examples</h3>
<h3 className="title dark:text-white">Examples</h3>
{question.examples.map((example, index) => (
<div
key={index}
Expand All @@ -74,7 +74,7 @@ const Problem: React.FC<ProblemProps> = ({ questionId }) => {
{/* Constraints */}
{question?.constraints && (
<div className="mb4">
<h3 className="title">Constraints</h3>
<h3 className="title dark:text-white">Constraints</h3>
<ul className="list-disc list-inside text-gray-700">
{question.constraints.map((constraint, index) => (
<li className="points" key={index}>
Expand All @@ -87,7 +87,7 @@ const Problem: React.FC<ProblemProps> = ({ questionId }) => {

{/* Topic*/}
<div className="mb-4">
<h3 className="title">Topics</h3>
<h3 className="title dark:text-white">Topics</h3>
<p>
{question?.topic?.map((topic, index) => (
<span key={index} className="topic">
Expand Down
3 changes: 0 additions & 3 deletions peerprep_fe/src/contexts/call-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ export const CallProvider: React.FC<CallProviderProps> = ({ children }) => {
const hasCamera = devices.some(
(device) =>
device.kind === "videoinput" &&
device.label !== "" &&
device.deviceId !== "" &&
device.groupId !== "" &&
// Handle edge case where user does not have a camera but a virtual camera is present
// Need to add all the possible virtual camera names
!device.label.includes("virtual") &&
Expand Down