Merged in bug-fixing-19-MAR (pull request #47)

Bug fixing 19 MAR

Approved-by: Tiago Ribeiro
This commit is contained in:
João Ramos
2024-03-22 11:17:43 +00:00
committed by Tiago Ribeiro
10 changed files with 32 additions and 9 deletions

Binary file not shown.

BIN
public/manuals/student.pdf Normal file

Binary file not shown.

BIN
public/manuals/teacher.pdf Normal file

Binary file not shown.

View File

@@ -84,7 +84,7 @@ export default function Navbar({user, path, navDisabled = false, focusMode = fal
{showExpirationDate() && ( {showExpirationDate() && (
<Link <Link
href={disablePaymentPage ? "/payment" : ""} href={user.subscriptionExpirationDate && disablePaymentPage ? "/payment" : ""}
data-tip="Expiry date" data-tip="Expiry date"
className={clsx( className={clsx(
"flex w-fit cursor-pointer justify-center rounded-full border px-6 py-2 text-sm font-normal focus:outline-none", "flex w-fit cursor-pointer justify-center rounded-full border px-6 py-2 text-sm font-normal focus:outline-none",

View File

@@ -116,8 +116,12 @@ export default function Sidebar({path, navDisabled = false, focusMode = false, u
/> />
</> </>
)} )}
<Nav disabled={disableNavigation} Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" isMinimized={isMinimized} /> {(userType || "") !== 'agent' && (
<Nav disabled={disableNavigation} Icon={BsClockHistory} label="Record" path={path} keyPath="/record" isMinimized={isMinimized} /> <>
<Nav disabled={disableNavigation} Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" isMinimized={isMinimized} />
<Nav disabled={disableNavigation} Icon={BsClockHistory} label="Record" path={path} keyPath="/record" isMinimized={isMinimized} />
</>
)}
{["admin", "developer", "agent", "corporate"].includes(userType || "") && ( {["admin", "developer", "agent", "corporate"].includes(userType || "") && (
<Nav <Nav
disabled={disableNavigation} disabled={disableNavigation}
@@ -164,8 +168,12 @@ export default function Sidebar({path, navDisabled = false, focusMode = false, u
<Nav disabled={disableNavigation} Icon={MdSpaceDashboard} label="Dashboard" path={path} keyPath="/" isMinimized={true} /> <Nav disabled={disableNavigation} Icon={MdSpaceDashboard} label="Dashboard" path={path} keyPath="/" isMinimized={true} />
<Nav disabled={disableNavigation} Icon={BsFileEarmarkText} label="Exams" path={path} keyPath="/exam" isMinimized={true} /> <Nav disabled={disableNavigation} Icon={BsFileEarmarkText} label="Exams" path={path} keyPath="/exam" isMinimized={true} />
<Nav disabled={disableNavigation} Icon={BsPencil} label="Exercises" path={path} keyPath="/exercises" isMinimized={true} /> <Nav disabled={disableNavigation} Icon={BsPencil} label="Exercises" path={path} keyPath="/exercises" isMinimized={true} />
<Nav disabled={disableNavigation} Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" isMinimized={true} /> {(userType || "") !== 'agent' && (
<Nav disabled={disableNavigation} Icon={BsClockHistory} label="Record" path={path} keyPath="/record" isMinimized={true} /> <>
<Nav disabled={disableNavigation} Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" isMinimized={true} />
<Nav disabled={disableNavigation} Icon={BsClockHistory} label="Record" path={path} keyPath="/record" isMinimized={true} />
</>
)}
{userType !== "student" && ( {userType !== "student" && (
<Nav disabled={disableNavigation} Icon={BsShieldFill} label="Settings" path={path} keyPath="/settings" isMinimized={true} /> <Nav disabled={disableNavigation} Icon={BsShieldFill} label="Settings" path={path} keyPath="/settings" isMinimized={true} />
)} )}

View File

@@ -25,7 +25,13 @@ const thresholds = [
level: "High A2/Low B1", level: "High A2/Low B1",
label: "Pre-Intermediate", label: "Pre-Intermediate",
minValue: 8, minValue: 8,
maxValue: 12, maxValue: 11,
},
{
level: "High B1/Low B2",
label: "Intermediate",
minValue: 12,
maxValue: 15,
}, },
{ {
level: "High B2/Low C1", level: "High B2/Low C1",

View File

@@ -10,7 +10,7 @@ export const RadialResult = ({module, score, total, png}: ModuleScore) => (
<Text style={[styles.textColor, styles.textBold, {fontSize: 10}]}>{module}</Text> <Text style={[styles.textColor, styles.textBold, {fontSize: 10}]}>{module}</Text>
<Image src={png} style={styles.image64}></Image> <Image src={png} style={styles.image64}></Image>
<View style={[styles.textColor, styles.radialResultContainer]}> <View style={[styles.textColor, styles.radialResultContainer]}>
<Text style={styles.textBold}>{score.toFixed(2)}</Text> <Text style={styles.textBold}>{Math.floor(score)}</Text>
<Text style={{fontSize: 8}}>out of 9.0</Text> <Text style={{fontSize: 8}}>out of 9.0</Text>
</View> </View>
</View> </View>

View File

@@ -370,7 +370,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
studentsData={studentsData} studentsData={studentsData}
showLevel={showLevel} showLevel={showLevel}
summaryPNG={overallPNG} summaryPNG={overallPNG}
summaryScore={`${(overallResult * 100).toFixed(0)}%`} summaryScore={`${Math.floor(overallResult * 100)}%`}
groupScoreSummary={groupScoreSummary} groupScoreSummary={groupScoreSummary}
passportId={demographicInformation?.passport_id || ""} passportId={demographicInformation?.passport_id || ""}
/>, />,

View File

@@ -286,7 +286,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
logo={"public/logo_title.png"} logo={"public/logo_title.png"}
qrcode={qrcode} qrcode={qrcode}
summaryPNG={overallPNG} summaryPNG={overallPNG}
summaryScore={`${(overallResult * 100).toFixed(0)}%`} summaryScore={`${Math.floor(overallResult * 100)}%`}
passportId={demographicInformation?.passport_id || ""} passportId={demographicInformation?.passport_id || ""}
/>, />,
); );

View File

@@ -276,6 +276,8 @@ function UserProfile({user, mutateUser}: Props) {
</div> </div>
); );
const manualDownloadLink = ['student', 'teacher', 'corporate'].includes(user.type) ? `/manuals/${user.type}.pdf` : '';
return ( return (
<Layout user={user}> <Layout user={user}>
<section className="w-full flex flex-col gap-4 md:gap-8 px-4 py-8"> <section className="w-full flex flex-col gap-4 md:gap-8 px-4 py-8">
@@ -535,6 +537,13 @@ function UserProfile({user, mutateUser}: Props) {
/> />
</div> </div>
)} )}
{manualDownloadLink && (
<a href={manualDownloadLink} className="max-w-[200px] self-end w-full" download>
<Button color="purple" variant="outline" className="max-w-[200px] self-end w-full">
Download Manual
</Button>
</a>
)}
</div> </div>
</div> </div>
<div className="flex flex-col gap-4 mt-8 mb-20"> <div className="flex flex-col gap-4 mt-8 mb-20">