-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from CS3219-AY2425S1/add-match-timer
Add matching button functionality
- Loading branch information
Showing
13 changed files
with
170 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { expireSession } from "@/app/actions/session"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function GET(request: NextRequest) { | ||
await expireSession(); | ||
const url = request.nextUrl.clone(); | ||
url.pathname = "/auth/login"; | ||
return NextResponse.redirect(url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useState, useEffect } from "react"; | ||
|
||
interface ResettingStopwatchProps { | ||
isActive: boolean; | ||
} | ||
|
||
// pass isActive from parent component | ||
// | ||
const ResettingStopwatch: React.FC<ResettingStopwatchProps> = ({ | ||
isActive, | ||
}) => { | ||
const [elapsedTime, setElapsedTime] = useState<number>(0); | ||
|
||
useEffect(() => { | ||
let interval: NodeJS.Timeout | null = null; | ||
|
||
if (isActive) { | ||
interval = setInterval(() => { | ||
setElapsedTime((prevTime) => prevTime + 1); | ||
}, 1000); | ||
} | ||
|
||
return () => { | ||
if (interval) clearInterval(interval); | ||
setElapsedTime(0); | ||
}; | ||
}, [isActive]); | ||
|
||
const formatTime = (time: number) => { | ||
const minutes = Math.floor(time / 60); | ||
const seconds = time % 60; | ||
return `${minutes}:${seconds < 10 ? "0" : ""}${seconds}`; | ||
}; | ||
|
||
return <div>{formatTime(elapsedTime)}</div>; | ||
}; | ||
|
||
export default ResettingStopwatch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.