MindCheck Bot commited on
Commit ·
13681f1
1
Parent(s): 2cbe320
Update UI score display to 1-4 scale
Browse files
mindcheck-web/src/app/result/page.tsx
CHANGED
|
@@ -98,9 +98,9 @@ function ResultContent() {
|
|
| 98 |
<>
|
| 99 |
<header className="bg-surface border-b border-outline-variant w-full top-0 sticky z-50">
|
| 100 |
<div className="flex justify-between items-center h-16 px-gutter max-w-container-max mx-auto">
|
| 101 |
-
<Link href="/" className="
|
| 102 |
<div className="font-section-heading text-section-heading hidden md:block">Screening Results</div>
|
| 103 |
-
<Link href="/chat" className="px-[20px] py-[12px] bg-transparent border border-primary text-primary rounded hover:bg-surface-container transition-colors">
|
| 104 |
Start Screening
|
| 105 |
</Link>
|
| 106 |
</div>
|
|
@@ -125,9 +125,9 @@ function ResultContent() {
|
|
| 125 |
{/* TopNavBar */}
|
| 126 |
<header className="bg-surface border-b border-outline-variant w-full top-0 sticky z-50">
|
| 127 |
<div className="flex justify-between items-center h-16 px-gutter max-w-container-max mx-auto">
|
| 128 |
-
<Link href="/" className="
|
| 129 |
<div className="font-section-heading text-section-heading hidden md:block">Screening Results</div>
|
| 130 |
-
<Link href="/chat" className="px-[20px] py-[12px] bg-transparent border border-primary text-primary rounded hover:bg-surface-container transition-colors">
|
| 131 |
Restart Screening
|
| 132 |
</Link>
|
| 133 |
</div>
|
|
@@ -143,7 +143,7 @@ function ResultContent() {
|
|
| 143 |
<h1 className="font-section-heading text-section-heading text-on-surface">Your Result</h1>
|
| 144 |
<div className="flex items-center gap-4 mt-2">
|
| 145 |
<div className="flex items-baseline">
|
| 146 |
-
<span className="text-[56px] font-bold text-primary leading-none tracking-tight">
|
| 147 |
{Math.round(result.total_score)}
|
| 148 |
</span>
|
| 149 |
<span className="text-2xl text-on-surface-variant ml-1 font-medium">/{maxScore}</span>
|
|
@@ -166,17 +166,18 @@ function ResultContent() {
|
|
| 166 |
|
| 167 |
{/* Bar Chart Section */}
|
| 168 |
<section
|
| 169 |
-
className="bg-surface-lowest border-[0.5px] border-outline-variant rounded-lg p-section-padding bg-white"
|
| 170 |
style={{ animation: "fadeSlideIn 0.6s ease-out 0.1s both" }}
|
| 171 |
>
|
| 172 |
<h2 className="font-body-md text-body-md font-semibold mb-6">Score per question</h2>
|
| 173 |
<div className="flex flex-col gap-4">
|
| 174 |
{result.scores.map((score, i) => {
|
| 175 |
const name = result.itemShortNames?.[i] || SHORT_NAMES[i] || `Q${i + 1}`;
|
| 176 |
-
const
|
|
|
|
| 177 |
return (
|
| 178 |
<div key={i} className="flex items-center gap-4 group">
|
| 179 |
-
<div className="w-[140px] truncate text-on-surface-variant text-sm" title={name}>
|
| 180 |
{name}
|
| 181 |
</div>
|
| 182 |
<div className="flex-grow h-2.5 bg-surface-container rounded-full overflow-hidden flex">
|
|
@@ -185,8 +186,8 @@ function ResultContent() {
|
|
| 185 |
style={{ width: `${pct}%`, transitionDelay: `${i * 80}ms` }}
|
| 186 |
/>
|
| 187 |
</div>
|
| 188 |
-
<div className={`w-6 text-right font-medium ${
|
| 189 |
-
{
|
| 190 |
</div>
|
| 191 |
</div>
|
| 192 |
);
|
|
@@ -240,7 +241,7 @@ function ResultContent() {
|
|
| 240 |
|
| 241 |
{/* Recommendation Card */}
|
| 242 |
<div
|
| 243 |
-
className="bg-white border-[0.5px] border-outline-variant border-l-4 border-l-primary rounded-lg p-section-padding flex flex-col gap-stack-sm"
|
| 244 |
style={{ animation: "fadeSlideIn 0.5s ease-out 0.3s both" }}
|
| 245 |
>
|
| 246 |
<h3 className="font-body-md text-body-md font-semibold">Recommended Next Steps</h3>
|
|
|
|
| 98 |
<>
|
| 99 |
<header className="bg-surface border-b border-outline-variant w-full top-0 sticky z-50">
|
| 100 |
<div className="flex justify-between items-center h-16 px-gutter max-w-container-max mx-auto">
|
| 101 |
+
<Link href="/" className="text-lg md:text-hero-lg md:font-hero-lg font-bold text-primary">MindCheck</Link>
|
| 102 |
<div className="font-section-heading text-section-heading hidden md:block">Screening Results</div>
|
| 103 |
+
<Link href="/chat" className="text-sm px-3 py-2 md:px-[20px] md:py-[12px] bg-transparent border border-primary text-primary rounded hover:bg-surface-container transition-colors">
|
| 104 |
Start Screening
|
| 105 |
</Link>
|
| 106 |
</div>
|
|
|
|
| 125 |
{/* TopNavBar */}
|
| 126 |
<header className="bg-surface border-b border-outline-variant w-full top-0 sticky z-50">
|
| 127 |
<div className="flex justify-between items-center h-16 px-gutter max-w-container-max mx-auto">
|
| 128 |
+
<Link href="/" className="text-lg md:text-hero-lg md:font-hero-lg font-bold text-primary">MindCheck</Link>
|
| 129 |
<div className="font-section-heading text-section-heading hidden md:block">Screening Results</div>
|
| 130 |
+
<Link href="/chat" className="text-sm px-3 py-2 md:px-[20px] md:py-[12px] bg-transparent border border-primary text-primary rounded hover:bg-surface-container transition-colors">
|
| 131 |
Restart Screening
|
| 132 |
</Link>
|
| 133 |
</div>
|
|
|
|
| 143 |
<h1 className="font-section-heading text-section-heading text-on-surface">Your Result</h1>
|
| 144 |
<div className="flex items-center gap-4 mt-2">
|
| 145 |
<div className="flex items-baseline">
|
| 146 |
+
<span className="text-[40px] md:text-[56px] font-bold text-primary leading-none tracking-tight">
|
| 147 |
{Math.round(result.total_score)}
|
| 148 |
</span>
|
| 149 |
<span className="text-2xl text-on-surface-variant ml-1 font-medium">/{maxScore}</span>
|
|
|
|
| 166 |
|
| 167 |
{/* Bar Chart Section */}
|
| 168 |
<section
|
| 169 |
+
className="bg-surface-lowest border-[0.5px] border-outline-variant rounded-lg p-4 md:p-section-padding bg-white"
|
| 170 |
style={{ animation: "fadeSlideIn 0.6s ease-out 0.1s both" }}
|
| 171 |
>
|
| 172 |
<h2 className="font-body-md text-body-md font-semibold mb-6">Score per question</h2>
|
| 173 |
<div className="flex flex-col gap-4">
|
| 174 |
{result.scores.map((score, i) => {
|
| 175 |
const name = result.itemShortNames?.[i] || SHORT_NAMES[i] || `Q${i + 1}`;
|
| 176 |
+
const displayScore = score + 1;
|
| 177 |
+
const pct = Math.min((displayScore / 4) * 100, 100);
|
| 178 |
return (
|
| 179 |
<div key={i} className="flex items-center gap-4 group">
|
| 180 |
+
<div className="w-[100px] md:w-[140px] truncate text-on-surface-variant text-sm" title={name}>
|
| 181 |
{name}
|
| 182 |
</div>
|
| 183 |
<div className="flex-grow h-2.5 bg-surface-container rounded-full overflow-hidden flex">
|
|
|
|
| 186 |
style={{ width: `${pct}%`, transitionDelay: `${i * 80}ms` }}
|
| 187 |
/>
|
| 188 |
</div>
|
| 189 |
+
<div className={`w-6 text-right font-medium ${displayScore === 1 ? "text-outline" : ""}`}>
|
| 190 |
+
{displayScore.toFixed(1)}
|
| 191 |
</div>
|
| 192 |
</div>
|
| 193 |
);
|
|
|
|
| 241 |
|
| 242 |
{/* Recommendation Card */}
|
| 243 |
<div
|
| 244 |
+
className="bg-white border-[0.5px] border-outline-variant border-l-4 border-l-primary rounded-lg p-4 md:p-section-padding flex flex-col gap-stack-sm"
|
| 245 |
style={{ animation: "fadeSlideIn 0.5s ease-out 0.3s both" }}
|
| 246 |
>
|
| 247 |
<h3 className="font-body-md text-body-md font-semibold">Recommended Next Steps</h3>
|