Refresh login and dashboard layouts
This commit is contained in:
parent
61c0b1c276
commit
aca7efc1ff
|
|
@ -24,7 +24,6 @@ import { useTeamPermissions } from "../../hooks/useTeamPermissions";
|
|||
import { hasRatingsPermission } from "../../lib/ratingsPermissions";
|
||||
import { hasPersonaPermission } from "../../lib/personasPermissions";
|
||||
import { hasActivityLogPermission } from "../../lib/activityLogPermissions";
|
||||
import { hasExportPermission } from "../../lib/exportPermissions";
|
||||
import { SidebarNavGroup } from "./SidebarNavGroup";
|
||||
import { useAdminAccess } from "../../hooks/useAdminAccess";
|
||||
import { isNavEntryAllowedForTeamRole } from "../../lib/adminAccess";
|
||||
|
|
@ -110,13 +109,6 @@ const navEntries: NavEntry[] = [
|
|||
|
||||
{ kind: "section", label: "Operations" },
|
||||
{ kind: "link", label: "Payments", to: "/payments", icon: CreditCard },
|
||||
{
|
||||
kind: "link",
|
||||
label: "Subscriptions export",
|
||||
to: "/subscriptions/export",
|
||||
icon: CreditCard,
|
||||
permission: "subscriptions.export",
|
||||
},
|
||||
{
|
||||
kind: "link",
|
||||
label: "Activity log",
|
||||
|
|
@ -326,19 +318,11 @@ export function Sidebar({
|
|||
) {
|
||||
return null;
|
||||
}
|
||||
if (
|
||||
entry.permission === "subscriptions.export" &&
|
||||
!permissionsLoading &&
|
||||
!hasExportPermission("subscriptions.export", permissions)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (
|
||||
entry.permission &&
|
||||
entry.permission !== "ratings.list_by_target" &&
|
||||
entry.permission !== "personas.list" &&
|
||||
entry.permission !== "activity_logs.list" &&
|
||||
entry.permission !== "subscriptions.export" &&
|
||||
!permissionsLoading &&
|
||||
!hasPermission(entry.permission)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const chartTooltipStyle = {
|
|||
|
||||
function DashboardSectionTitle({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<h2 className="text-xs font-semibold uppercase tracking-wider text-grayScale-400">{children}</h2>
|
||||
<h2 className="flex items-center gap-3 text-[11px] font-bold uppercase tracking-[0.16em] text-grayScale-400 after:h-px after:flex-1 after:bg-grayScale-100">{children}</h2>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -193,13 +193,15 @@ export function DashboardPage() {
|
|||
|
||||
return (
|
||||
<SensitiveRevealProvider>
|
||||
<div className="mx-auto w-full min-w-0 max-w-[1280px] px-2 pb-8 sm:px-4">
|
||||
<div className="mb-7 flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<div className="mb-1 text-xs font-semibold uppercase tracking-wide text-grayScale-400">
|
||||
<div className="mx-auto w-full min-w-0 max-w-[1600px] px-3 pb-10 sm:px-6 2xl:px-8">
|
||||
<div className="relative mb-6 flex flex-wrap items-center justify-between gap-5 overflow-hidden rounded-2xl border border-grayScale-200/70 bg-gradient-to-r from-white via-white to-brand-50/60 px-5 py-5 shadow-sm sm:px-7 sm:py-6">
|
||||
<div className="pointer-events-none absolute -right-12 -top-24 h-64 w-64 rounded-full bg-brand-100/40 blur-3xl" />
|
||||
<div className="relative min-w-0">
|
||||
<div className="mb-1.5 flex items-center gap-2 text-[11px] font-bold uppercase tracking-[0.18em] text-brand-600">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-brand-500" />
|
||||
Dashboard
|
||||
</div>
|
||||
<h1 className="text-3xl font-semibold tracking-tight text-grayScale-900">
|
||||
<h1 className="text-2xl font-semibold tracking-tight text-grayScale-900 sm:text-3xl">
|
||||
Welcome back, {userFirstName || localStorage.getItem("user_first_name") || "there"}
|
||||
</h1>
|
||||
<p className="mt-1.5 text-sm text-grayScale-500">
|
||||
|
|
@ -207,7 +209,7 @@ export function DashboardPage() {
|
|||
{dashboard ? ` · Updated ${generatedAt}` : ""}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="relative flex flex-wrap items-center gap-3">
|
||||
<Link
|
||||
to="/analytics"
|
||||
className="text-xs font-semibold text-brand-600 transition-colors hover:text-brand-500"
|
||||
|
|
@ -230,7 +232,7 @@ export function DashboardPage() {
|
|||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="mb-6 rounded-2xl border border-grayScale-100 bg-white px-5 pt-4 shadow-sm">
|
||||
<div className="mb-5 flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-grayScale-100 bg-white px-4 pt-3 shadow-sm sm:px-5">
|
||||
<div className="-mb-px flex gap-6">
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -267,7 +269,7 @@ export function DashboardPage() {
|
|||
|
||||
{/* Stat Cards */}
|
||||
{activeStatTab === "primary" && (
|
||||
<div className="mb-8 grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
<div className="mb-6 grid gap-3 sm:grid-cols-2 md:grid-cols-3">
|
||||
<StatCard
|
||||
icon={Users}
|
||||
label="Total Users"
|
||||
|
|
@ -298,7 +300,7 @@ export function DashboardPage() {
|
|||
|
||||
{/* Secondary Stats */}
|
||||
{activeStatTab === "secondary" && subscriptionMetrics && (
|
||||
<div className="mb-8 grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
<div className="mb-6 grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<StatCard
|
||||
icon={CreditCard}
|
||||
label="Total Subscriptions"
|
||||
|
|
@ -360,8 +362,9 @@ export function DashboardPage() {
|
|||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-8">
|
||||
<section className="space-y-4">
|
||||
<div className="space-y-6">
|
||||
<div className="grid items-start gap-6 xl:grid-cols-2">
|
||||
<section className="min-w-0 space-y-3">
|
||||
<DashboardSectionTitle>Growth</DashboardSectionTitle>
|
||||
<Card className={cn(analyticsSoftCardClass)}>
|
||||
<CardHeader className="pb-2 pt-5">
|
||||
|
|
@ -441,12 +444,17 @@ export function DashboardPage() {
|
|||
</Card>
|
||||
</section>
|
||||
|
||||
<section className="space-y-4">
|
||||
<section className="min-w-0 space-y-3">
|
||||
<DashboardSectionTitle>Revenue & subscriptions</DashboardSectionTitle>
|
||||
<div className="grid gap-4">
|
||||
<RevenueTrendCard paymentMethod={filters.payment_method} />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
<section className="space-y-3">
|
||||
<DashboardSectionTitle>Subscription health</DashboardSectionTitle>
|
||||
<div className="grid gap-4 xl:grid-cols-3">
|
||||
<ActivePlansBreakdownCard
|
||||
data={labelCountsToPieSlices(
|
||||
(dashboard.subscriptions.active_by_plan?.length
|
||||
|
|
@ -468,9 +476,6 @@ export function DashboardPage() {
|
|||
0
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
{subscriptionStatusData.length > 0 ? (
|
||||
<DonutBreakdownCard
|
||||
title="Subscription Status"
|
||||
|
|
@ -479,11 +484,11 @@ export function DashboardPage() {
|
|||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="space-y-4">
|
||||
<section className="space-y-3">
|
||||
<DashboardSectionTitle>Catalog & feedback</DashboardSectionTitle>
|
||||
<div className="grid grid-cols-1 items-start gap-4">
|
||||
<Card className={cn(analyticsSoftCardClass)}>
|
||||
<CardHeader className="pb-2 pt-5">
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
@ -508,7 +513,7 @@ export function DashboardPage() {
|
|||
No subscription plans found
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
{subscriptionPlans.map((plan) => (
|
||||
<div
|
||||
key={plan.id}
|
||||
|
|
@ -642,6 +647,7 @@ export function DashboardPage() {
|
|||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -233,30 +233,36 @@ export function LoginPage() {
|
|||
const googleClientId = import.meta.env.VITE_GOOGLE_CLIENT_ID;
|
||||
|
||||
return (
|
||||
<div className="relative flex h-dvh overflow-y-auto">
|
||||
<div className="relative flex min-h-dvh overflow-y-auto bg-[#f4f2ec]">
|
||||
{/* Decorative left panel */}
|
||||
<div className="hidden lg:flex lg:w-1/2 xl:w-[55%] items-center justify-center bg-gradient-to-br from-brand-600 via-brand-500 to-brand-400 relative">
|
||||
<div className="hidden lg:flex lg:w-1/2 xl:w-[55%] items-center justify-center bg-[#163d35] relative">
|
||||
{/* Abstract decorative shapes */}
|
||||
<div className="absolute inset-0 overflow-hidden">
|
||||
<div className="absolute -left-20 -top-20 h-96 w-96 rounded-full bg-white/5" />
|
||||
<div className="absolute -bottom-32 -right-16 h-[500px] w-[500px] rounded-full bg-white/5" />
|
||||
<div className="absolute left-1/3 top-1/4 h-64 w-64 rounded-full bg-white/5" />
|
||||
<div className="absolute -left-20 -top-20 h-96 w-96 rounded-full border border-white/10" />
|
||||
<div className="absolute -bottom-32 -right-16 h-[500px] w-[500px] rounded-full border border-white/10" />
|
||||
<div className="absolute left-1/3 top-1/4 h-64 w-64 rounded-full bg-[#d3a76a]/10 blur-3xl" />
|
||||
<div className="absolute bottom-1/4 left-1/4 h-48 w-48 rotate-45 rounded-3xl bg-white/[0.03]" />
|
||||
</div>
|
||||
|
||||
<div className="relative z-10 max-w-md px-12 text-center">
|
||||
<div className="relative z-10 max-w-lg px-12 text-left">
|
||||
{/* Brand logo */}
|
||||
<BrandLogo variant="light" className="mx-auto mb-8 h-16" />
|
||||
<p className="text-base leading-relaxed text-white/70">
|
||||
<BrandLogo variant="light" className="mb-20 h-14" />
|
||||
<p className="mb-5 text-xs font-semibold uppercase tracking-[0.28em] text-[#e4c28f]">The academy, in sync</p>
|
||||
<h2 className="max-w-md text-5xl font-semibold leading-[1.08] tracking-tight text-white xl:text-6xl">Make room for better learning.</h2>
|
||||
<p className="mt-6 max-w-sm text-base leading-relaxed text-white/65">
|
||||
Manage your academy, track student progress, and streamline
|
||||
operations — all from one powerful dashboard.
|
||||
</p>
|
||||
<div className="mt-14 flex items-center gap-3 text-sm text-white/70">
|
||||
<span className="h-2 w-2 rounded-full bg-[#d3a76a]" />
|
||||
<span>Rezina Academy · Admin workspace</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right panel – login form */}
|
||||
<div className="flex w-full flex-col items-center justify-center bg-white px-6 py-12 lg:w-1/2 xl:w-[45%]">
|
||||
<div className="w-full max-w-[420px]">
|
||||
<div className="flex w-full flex-col items-center justify-center bg-[#f4f2ec] px-6 py-12 lg:w-1/2 xl:w-[45%]">
|
||||
<div className="w-full max-w-[420px] rounded-[28px] border border-[#e8e5dc] bg-white px-7 py-9 shadow-[0_24px_70px_rgba(36,48,40,0.08)] sm:px-10 sm:py-11">
|
||||
{/* Mobile-only logo */}
|
||||
<div className="mb-10 flex justify-center lg:hidden">
|
||||
<BrandLogo />
|
||||
|
|
@ -264,13 +270,13 @@ export function LoginPage() {
|
|||
|
||||
{/* Header */}
|
||||
<div className="mb-10">
|
||||
<p className="mb-1.5 text-sm font-medium uppercase tracking-widest text-brand-400">
|
||||
<p className="mb-2 text-xs font-semibold uppercase tracking-[0.2em] text-[#8b704d]">
|
||||
Admin Portal
|
||||
</p>
|
||||
<h1 className="mb-2 text-3xl font-bold tracking-tight text-grayScale-600">
|
||||
<h1 className="mb-2 text-3xl font-semibold tracking-tight text-[#24352f]">
|
||||
Welcome back
|
||||
</h1>
|
||||
<p className="text-sm leading-relaxed text-grayScale-400">
|
||||
<p className="text-sm leading-relaxed text-[#78817b]">
|
||||
Sign in to your account to continue
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -307,7 +313,7 @@ export function LoginPage() {
|
|||
type="button"
|
||||
onClick={handleGoogleClick}
|
||||
disabled={googleLoading || !googleReady}
|
||||
className="group mb-6 flex w-full items-center justify-center gap-3 rounded-[6px] border border-grayScale-200 bg-white px-4 py-3 text-sm font-medium text-grayScale-600 transition-all duration-200 hover:border-grayScale-300 hover:bg-grayScale-100 hover:shadow-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
className="group mb-6 flex w-full items-center justify-center gap-3 rounded-xl border border-[#e5e7e2] bg-white px-4 py-3 text-sm font-medium text-[#34443d] transition-all duration-200 hover:border-[#a9b9ac] hover:bg-[#f8faf7] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#31644f]/30 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{googleLoading ? (
|
||||
<SpinnerIcon className="h-5 w-5" />
|
||||
|
|
@ -336,7 +342,7 @@ export function LoginPage() {
|
|||
<div>
|
||||
<Label
|
||||
htmlFor="email"
|
||||
className="mb-1.5 block text-sm font-medium text-grayScale-600"
|
||||
className="mb-1.5 block text-sm font-medium text-[#34443d]"
|
||||
>
|
||||
Email address
|
||||
</Label>
|
||||
|
|
@ -363,13 +369,13 @@ export function LoginPage() {
|
|||
<div className="mb-1.5 flex items-center justify-between">
|
||||
<Label
|
||||
htmlFor="password"
|
||||
className="block text-sm font-medium text-grayScale-600"
|
||||
className="block text-sm font-medium text-[#34443d]"
|
||||
>
|
||||
Password
|
||||
</Label>
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
className="text-xs font-medium text-brand-500 transition-colors hover:text-brand-600"
|
||||
className="text-xs font-semibold text-[#31644f] transition-colors hover:text-[#214b39]"
|
||||
>
|
||||
Forgot password?
|
||||
</Link>
|
||||
|
|
@ -404,7 +410,7 @@ export function LoginPage() {
|
|||
|
||||
<Button
|
||||
type="submit"
|
||||
className="mt-2 h-11 w-full rounded-[6px] text-sm font-semibold tracking-wide"
|
||||
className="mt-2 h-12 w-full rounded-xl bg-[#244f3e] text-sm font-semibold tracking-wide text-white shadow-[0_8px_18px_rgba(36,79,62,0.18)] transition hover:bg-[#1c4434]"
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Signing in…" : "Sign in"}
|
||||
|
|
@ -412,7 +418,7 @@ export function LoginPage() {
|
|||
</form>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="mt-10 text-center text-xs text-grayScale-400">
|
||||
<div className="mt-9 border-t border-[#eeeee9] pt-6 text-center text-xs text-grayScale-400">
|
||||
<p>© {new Date().getFullYear()} Rezina Academy · All rights reserved</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user