Update frontend/src/pages/StudentDashboard.jsx
Browse files
frontend/src/pages/StudentDashboard.jsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import { useEffect, useState } from "react";
|
| 3 |
import api from "../api/client";
|
| 4 |
import { useNavigate } from "react-router-dom";
|
|
|
|
| 5 |
|
| 6 |
export default function StudentDashboard() {
|
| 7 |
const [profile, setProfile] = useState({ email: "", name: "" });
|
|
@@ -60,28 +61,11 @@ export default function StudentDashboard() {
|
|
| 60 |
|
| 61 |
return (
|
| 62 |
<div className="min-h-screen bg-slate-50 text-slate-900">
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
<
|
| 68 |
-
<img
|
| 69 |
-
src="/karate-logo.svg" // change to /karate-logo.png if you use PNG
|
| 70 |
-
alt="Dojo logo"
|
| 71 |
-
className="h-8 w-8 rounded-full border border-slate-200 object-contain"
|
| 72 |
-
/>
|
| 73 |
-
<div>
|
| 74 |
-
<div className="text-sm font-semibold tracking-tight">
|
| 75 |
-
Karate Student Portal
|
| 76 |
-
</div>
|
| 77 |
-
<div className="text-xs text-slate-500">
|
| 78 |
-
Welcome back, {profile.name}. Train hard, stay consistent.
|
| 79 |
-
</div>
|
| 80 |
-
</div>
|
| 81 |
-
</div>
|
| 82 |
-
|
| 83 |
-
{/* RIGHT: email + logout */}
|
| 84 |
-
<div className="flex items-center gap-3">
|
| 85 |
<span className="text-xs px-3 py-1 rounded-full bg-slate-100 text-slate-700">
|
| 86 |
{profile.email}
|
| 87 |
</span>
|
|
@@ -91,14 +75,13 @@ export default function StudentDashboard() {
|
|
| 91 |
>
|
| 92 |
Log out
|
| 93 |
</button>
|
| 94 |
-
</
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
|
| 99 |
{/* Main content */}
|
| 100 |
<main className="max-w-6xl mx-auto px-4 py-8 space-y-6">
|
| 101 |
-
{/* Available membership plans
|
| 102 |
<section className="bg-white border border-slate-200 rounded-2xl p-5 shadow-sm">
|
| 103 |
<div className="flex items-center justify-between mb-2">
|
| 104 |
<div className="text-sm font-semibold">
|
|
@@ -111,8 +94,8 @@ export default function StudentDashboard() {
|
|
| 111 |
|
| 112 |
{plans.length === 0 ? (
|
| 113 |
<p className="text-sm text-slate-500">
|
| 114 |
-
No public plans are available right now. Please check back later
|
| 115 |
-
ask at the front desk.
|
| 116 |
</p>
|
| 117 |
) : (
|
| 118 |
<div className="grid gap-3 md:grid-cols-3">
|
|
@@ -121,7 +104,9 @@ export default function StudentDashboard() {
|
|
| 121 |
key={plan.id}
|
| 122 |
className="border border-slate-200 rounded-xl p-4 bg-slate-50"
|
| 123 |
>
|
| 124 |
-
<div className="text-sm font-semibold mb-1">
|
|
|
|
|
|
|
| 125 |
<div className="text-xs text-slate-500 mb-2">
|
| 126 |
{plan.description || "Karate membership plan."}
|
| 127 |
</div>
|
|
@@ -131,14 +116,23 @@ export default function StudentDashboard() {
|
|
| 131 |
/ {plan.billing_period}
|
| 132 |
</span>
|
| 133 |
</div>
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
</div>
|
| 143 |
))}
|
| 144 |
</div>
|
|
@@ -209,13 +203,14 @@ export default function StudentDashboard() {
|
|
| 209 |
<div className="flex items-center justify-between mb-3">
|
| 210 |
<div className="text-sm font-semibold">Your memberships</div>
|
| 211 |
<div className="text-[11px] text-slate-400">
|
| 212 |
-
{memberships.length} record
|
|
|
|
| 213 |
</div>
|
| 214 |
</div>
|
| 215 |
|
| 216 |
{memberships.length === 0 ? (
|
| 217 |
<p className="text-sm text-slate-500">
|
| 218 |
-
You don't have an active membership yet.
|
| 219 |
to get started.
|
| 220 |
</p>
|
| 221 |
) : (
|
|
|
|
| 2 |
import { useEffect, useState } from "react";
|
| 3 |
import api from "../api/client";
|
| 4 |
import { useNavigate } from "react-router-dom";
|
| 5 |
+
import AppHeader from "../components/AppHeader";
|
| 6 |
|
| 7 |
export default function StudentDashboard() {
|
| 8 |
const [profile, setProfile] = useState({ email: "", name: "" });
|
|
|
|
| 61 |
|
| 62 |
return (
|
| 63 |
<div className="min-h-screen bg-slate-50 text-slate-900">
|
| 64 |
+
<AppHeader
|
| 65 |
+
title="Karate Student Portal"
|
| 66 |
+
subtitle={`Welcome back, ${profile.name}. Train hard, stay consistent.`}
|
| 67 |
+
right={
|
| 68 |
+
<>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
<span className="text-xs px-3 py-1 rounded-full bg-slate-100 text-slate-700">
|
| 70 |
{profile.email}
|
| 71 |
</span>
|
|
|
|
| 75 |
>
|
| 76 |
Log out
|
| 77 |
</button>
|
| 78 |
+
</>
|
| 79 |
+
}
|
| 80 |
+
/>
|
|
|
|
| 81 |
|
| 82 |
{/* Main content */}
|
| 83 |
<main className="max-w-6xl mx-auto px-4 py-8 space-y-6">
|
| 84 |
+
{/* Available membership plans */}
|
| 85 |
<section className="bg-white border border-slate-200 rounded-2xl p-5 shadow-sm">
|
| 86 |
<div className="flex items-center justify-between mb-2">
|
| 87 |
<div className="text-sm font-semibold">
|
|
|
|
| 94 |
|
| 95 |
{plans.length === 0 ? (
|
| 96 |
<p className="text-sm text-slate-500">
|
| 97 |
+
No public plans are available right now. Please check back later
|
| 98 |
+
or ask at the front desk.
|
| 99 |
</p>
|
| 100 |
) : (
|
| 101 |
<div className="grid gap-3 md:grid-cols-3">
|
|
|
|
| 104 |
key={plan.id}
|
| 105 |
className="border border-slate-200 rounded-xl p-4 bg-slate-50"
|
| 106 |
>
|
| 107 |
+
<div className="text-sm font-semibold mb-1">
|
| 108 |
+
{plan.name}
|
| 109 |
+
</div>
|
| 110 |
<div className="text-xs text-slate-500 mb-2">
|
| 111 |
{plan.description || "Karate membership plan."}
|
| 112 |
</div>
|
|
|
|
| 116 |
/ {plan.billing_period}
|
| 117 |
</span>
|
| 118 |
</div>
|
| 119 |
+
{plan.stripe_link ? (
|
| 120 |
+
<a
|
| 121 |
+
href={plan.stripe_link}
|
| 122 |
+
target="_blank"
|
| 123 |
+
rel="noopener noreferrer"
|
| 124 |
+
className="inline-flex items-center justify-center w-full text-xs font-medium rounded-lg bg-blue-600 text-white py-2 hover:bg-blue-700"
|
| 125 |
+
>
|
| 126 |
+
Pay with Stripe
|
| 127 |
+
</a>
|
| 128 |
+
) : (
|
| 129 |
+
<button
|
| 130 |
+
disabled
|
| 131 |
+
className="inline-flex items-center justify-center w-full text-xs font-medium rounded-lg bg-slate-200 text-slate-500 py-2 cursor-not-allowed"
|
| 132 |
+
>
|
| 133 |
+
Stripe link not set
|
| 134 |
+
</button>
|
| 135 |
+
)}
|
| 136 |
</div>
|
| 137 |
))}
|
| 138 |
</div>
|
|
|
|
| 203 |
<div className="flex items-center justify-between mb-3">
|
| 204 |
<div className="text-sm font-semibold">Your memberships</div>
|
| 205 |
<div className="text-[11px] text-slate-400">
|
| 206 |
+
{memberships.length} record
|
| 207 |
+
{memberships.length === 1 ? "" : "s"}
|
| 208 |
</div>
|
| 209 |
</div>
|
| 210 |
|
| 211 |
{memberships.length === 0 ? (
|
| 212 |
<p className="text-sm text-slate-500">
|
| 213 |
+
You don't have an active membership yet. Pick a plan above
|
| 214 |
to get started.
|
| 215 |
</p>
|
| 216 |
) : (
|