merge new_starr_app@qas history into apps/web

git-subtree-dir: apps/web
git-subtree-mainline: eaa6d2276a
git-subtree-split: 459af9d46a
This commit is contained in:
2026-08-24 12:21:16 +08:00
699 changed files with 103969 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import React from 'react'
const Auth = () => {
return (
<div>
Auth Page
</div>
)
}
export default Auth
@@ -0,0 +1,173 @@
/***********************************************************************************************************************************************************************
* File Name: ChangePasswordPage.jsx
* Type of Program: Frontend Page
* Description: Forced password change page shown after first login when
* must_change_password is true. Redirects to the user's dashboard
* on success and clears the flag via the backend.
* Author: rgrgogu
* Date Created: May 23, 2026
***********************************************************************************************************************************************************************/
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { useAuth } from '@/contexts/AuthContext';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Eye, EyeOff, LoaderCircle, ShieldCheck } from 'lucide-react';
import { cn } from '@/lib/utils';
import api from '@/utils/api.util';
import { toast } from 'sonner';
// ─── Schema ───────────────────────────────────────────────────────────────────
const schema = z
.object({
new_password: z
.string()
.min(8, 'Password must be at least 8 characters.')
.regex(/[A-Z]/, 'Must contain at least one uppercase letter.')
.regex(/[a-z]/, 'Must contain at least one lowercase letter.')
.regex(/[0-9]/, 'Must contain at least one number.')
.regex(/[^A-Za-z0-9]/, 'Must contain at least one special character.'),
confirm_password: z.string().min(1, 'Please confirm your password.'),
})
.refine((d) => d.new_password === d.confirm_password, {
path: ['confirm_password'],
message: 'Passwords do not match.',
});
// ─── Field wrapper ─────────────────────────────────────────────────────────────
function Field({ label, error, children }) {
return (
<div className="flex flex-col gap-1.5">
<label className="text-sm font-medium">{label}</label>
{children}
{error && <p className="text-sm text-destructive">{error}</p>}
</div>
);
}
// ─── Password input with toggle ───────────────────────────────────────────────
function PasswordInput({ visible, onToggle, ...props }) {
return (
<div className="relative">
<Input
type={visible ? 'text' : 'password'}
className="pr-10"
{...props}
/>
<Button
type="button"
size="sm"
variant="ghost"
onClick={onToggle}
className="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
>
{visible ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
</Button>
</div>
);
}
// ─── Page ─────────────────────────────────────────────────────────────────────
export default function ChangePassword() {
const navigate = useNavigate();
const { user, setUser } = useAuth();
const [showNew, setShowNew] = useState(false);
const [showConfirm, setShowConfirm] = useState(false);
const {
register,
handleSubmit,
formState: { errors, isSubmitting },
} = useForm({
resolver: zodResolver(schema),
defaultValues: { new_password: '', confirm_password: '' },
});
const onSubmit = async ({ new_password }) => {
try {
await api.post('/auth/change-password', { new_password });
// Update local user state so must_change_password is cleared
setUser((prev) => ({ ...prev, must_change_password: false }));
toast('Password changed successfully. Welcome!');
// Redirect to the correct dashboard
switch (user?.acc_type) {
case 'admin': navigate('/admin'); break;
case 'staff': navigate('/staff'); break;
case 'client': navigate('/client'); break;
default: navigate('/');
}
} catch (err) {
toast(err?.response?.data?.message || 'Could not change password.');
}
};
return (
<div className="min-h-screen flex items-center justify-center bg-background px-4">
<div className="w-full max-w-md space-y-6">
{/* Header */}
<div className="flex flex-col items-center gap-2 text-center">
<div className="h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center">
<ShieldCheck className="h-6 w-6 text-primary" />
</div>
<h1 className="text-2xl font-bold tracking-tight">Set your password</h1>
<p className="text-sm text-muted-foreground">
Your account requires a new password before you can continue.
</p>
</div>
{/* Form */}
<form
onSubmit={handleSubmit(onSubmit)}
className="border border-border rounded-xl p-6 bg-card space-y-4"
>
<Field label="New Password" error={errors.new_password?.message}>
<PasswordInput
visible={showNew}
onToggle={() => setShowNew((v) => !v)}
placeholder="Enter new password"
disabled={isSubmitting}
{...register('new_password')}
/>
</Field>
<Field label="Confirm Password" error={errors.confirm_password?.message}>
<PasswordInput
visible={showConfirm}
onToggle={() => setShowConfirm((v) => !v)}
placeholder="Confirm new password"
disabled={isSubmitting}
{...register('confirm_password')}
/>
</Field>
{/* Password rules hint */}
<ul className="text-xs text-muted-foreground space-y-0.5 pl-4 list-disc">
<li>At least 8 characters</li>
<li>One uppercase &amp; one lowercase letter</li>
<li>One number and one special character</li>
</ul>
<Button type="submit" className="w-full" disabled={isSubmitting}>
{isSubmitting ? (
<span className="flex items-center gap-2">
<LoaderCircle className="size-4 animate-spin" />
Saving…
</span>
) : (
'Set Password & Continue'
)}
</Button>
</form>
</div>
</div>
);
}
@@ -0,0 +1,56 @@
/***********************************************************************************************************************************************************************
* File Name: ForgotPassword.jsx
* Type of Program: Frontend Page
* Description: Forgot-password page. Route: /forgot-password
* Module: User Credentials
* Author: lash0000
* Date Created: Jul. 4, 2026
***********************************************************************************************************************************************************************/
import { Link } from 'react-router-dom'
import { ForgotPasswordForm } from '../components/ForgotPasswordForm'
import { AuthThemeToggle } from '../components/AuthThemeToggle'
import { MetadataProvider } from '@/contexts/MetadataContext'
export default function ForgotPassword() {
return (
<MetadataProvider
value={{
title: 'Forgot Password - Philproperties',
description: 'Reset your account password.',
keywords: 'forgot password, reset password, philproperties',
ogTitle: 'Forgot Password - Philproperties',
ogDescription: 'Reset your account password.',
}}
>
<div className="relative grid min-h-svh lg:grid-cols-2">
<AuthThemeToggle className="absolute top-4 right-4 z-10" />
<div className="flex flex-col gap-4 p-6 md:p-10">
<div className="flex justify-center">
<Link to="/" className="flex items-center gap-2 font-medium">
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 block dark:hidden">
<img src="/philpro-white.png" alt="Philproperties" />
</div>
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 hidden dark:block">
<img src="/philpro-dark.png" alt="Philproperties" />
</div>
</Link>
</div>
<div className="flex flex-1 items-center justify-center">
<div className="w-full max-w-sm">
<ForgotPasswordForm />
</div>
</div>
</div>
<div className="relative hidden lg:block">
<img
src="https://cq5as7pc73.ufs.sh/f/pHNnzIw3VjcgzIbC8SR4stTZRKXP3cfbD6e2p9jmdAUQBuox"
alt="Philproperties"
className="absolute inset-0 h-full w-full object-cover rounded-3xl p-2"
/>
</div>
</div>
</MetadataProvider>
)
}
+282
View File
@@ -0,0 +1,282 @@
/***********************************************************************************************************************************************************************
* File Name: Intro.jsx
* Type of Program: Frontend Page
* Description: "Tell us about yourself" onboarding page shown once to every new user
* (system-registered or Google OAuth) before they reach the dashboard.
* Skips rendering and redirects if user.needs_intro is already false.
* On submit: PUT /client/profile → clears needs_intro → navigate /dashboard.
* Author: lash0000
* Date Created: Jun. 23, 2026
***********************************************************************************************************************************************************************/
import { useState } from 'react'
import { Navigate, useNavigate, Link } from 'react-router-dom'
import { isValidPhoneNumber, parsePhoneNumber } from 'react-phone-number-input'
import { useAuth } from '@/contexts/AuthContext'
import { useDetectedCountry } from '@/hooks/useDetectedCountry'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { PhoneInput } from '@/components/ui/phone-input'
import { Label } from '@/components/ui/label'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { resolveAssetSrc } from '@/utils/media.util'
import { Loader2 } from 'lucide-react'
import { toast } from 'sonner'
import { Toaster } from '@/components/ui/sonner'
import api from '@/utils/api.util'
// ─── Helpers ──────────────────────────────────────────────────────────────────
function getInitials(given = '', last = '') {
const g = given.trim()[0]?.toUpperCase() ?? ''
const l = last.trim()[0]?.toUpperCase() ?? ''
return g + l || '?'
}
// ─── Component ────────────────────────────────────────────────────────────────
export default function IntroPage() {
const navigate = useNavigate()
const { user, setUser } = useAuth()
// Already completed intro — send straight to dashboard
if (!user?.needs_intro) return <Navigate to="/dashboard" replace />
const pi = user?.personal_info ?? {}
// ── Form state seeded from existing personal_info (Google already has name) ──
const [givenName, setGivenName] = useState(pi.name?.given_name ?? '')
const [middleName, setMiddleName] = useState(pi.name?.middle_name ?? '')
const [lastName, setLastName] = useState(pi.name?.last_name ?? '')
const [extensionName, setExtensionName] = useState(pi.name?.extension_name ?? '')
const [dateOfBirth, setDateOfBirth] = useState(pi.date_of_birth ?? '')
const [occupation, setOccupation] = useState(pi.occupation ?? '')
const [phone, setPhone] = useState(
pi.phone_number?.[0]?.full_number ? `+${pi.phone_number[0].full_number}` : ''
)
const [loading, setLoading] = useState(false)
const [errors, setErrors] = useState({})
const detectedCountry = useDetectedCountry()
// ── Derived ────────────────────────────────────────────────────────────────
const avatarUrl = resolveAssetSrc(pi.avatar) ?? ''
const initials = getInitials(givenName, lastName)
const displayEmail = user?.email ?? ''
// ── Validation ─────────────────────────────────────────────────────────────
const validate = () => {
const e = {}
if (!givenName.trim()) e.givenName = 'First name is required.'
if (!lastName.trim()) e.lastName = 'Last name is required.'
if (!occupation.trim()) e.occupation = 'Occupation is required.'
if (!dateOfBirth) {
e.dateOfBirth = 'Date of birth is required.'
} else {
const age = (Date.now() - new Date(dateOfBirth)) / (1000 * 60 * 60 * 24 * 365.25)
if (isNaN(age) || age < 13 || age > 120) e.dateOfBirth = 'Please enter a valid date of birth.'
}
if (!phone.trim()) {
e.phone = 'Phone number is required.'
} else if (!isValidPhoneNumber(phone)) {
e.phone = 'Invalid phone number.'
}
return e
}
// ── Submit ─────────────────────────────────────────────────────────────────
const handleSubmit = async (e) => {
e.preventDefault()
const errs = validate()
if (Object.keys(errs).length) {
setErrors(errs)
return
}
setErrors({})
setLoading(true)
const fullName = [givenName, middleName, lastName, extensionName].filter(Boolean).join(' ')
const personal_info = {
name: {
given_name: givenName,
middle_name: middleName,
last_name: lastName,
extension_name: extensionName,
full_name: fullName,
},
date_of_birth: dateOfBirth,
occupation,
phone_number: phone.trim()
? (() => {
const parsed = parsePhoneNumber(phone)
return [{
number: parsed.nationalNumber,
country_code: parsed.countryCallingCode,
full_number: `${parsed.countryCallingCode}${parsed.nationalNumber}`,
phone_type: 'mobile',
}]
})()
: (pi.phone_number ?? []),
// Preserve existing avatar and addresses
...(pi.avatar ? { avatar: pi.avatar } : {}),
...(pi.addresses ? { addresses: pi.addresses } : {}),
}
try {
const { data } = await api.put('/client/profile', { personal_info })
// Merge the full returned user object — needs_intro will now be false
setUser(prev => ({ ...prev, ...data.data }))
navigate('/dashboard')
} catch (err) {
toast(
err?.response?.data?.message ?? 'Could not save your info. Please try again.'
)
} finally {
setLoading(false)
}
}
// ── Render ─────────────────────────────────────────────────────────────────
return (
<>
<Toaster position="bottom-right" richColors />
<div className="min-h-svh bg-muted flex items-center justify-center p-6">
<div className="w-full max-w-lg">
{/* Logo */}
<div className="flex justify-center mb-8">
<Link to="/">
<img src="/philpro-white.png" alt="Philproperties" className="w-44 dark:hidden" />
<img src="/philpro-dark.png" alt="Philproperties" className="w-44 hidden dark:block" />
</Link>
</div>
{/* Card */}
<div className="bg-card rounded-2xl border shadow-sm p-8 space-y-6">
{/* Header */}
<div className="flex flex-col items-center gap-3 text-center">
<Avatar className="h-16 w-16">
<AvatarImage src={avatarUrl} />
<AvatarFallback className="text-lg font-semibold">{initials}</AvatarFallback>
</Avatar>
<div>
<h1 className="text-xl font-bold tracking-tight">Tell us about yourself</h1>
<p className="text-sm text-muted-foreground mt-1">
{displayEmail} &nbsp;·&nbsp; This info appears on your profile.
</p>
</div>
</div>
{/* Form */}
<form onSubmit={handleSubmit} className="space-y-4">
{/* Name row */}
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label className="text-xs">First name <span className="text-destructive">*</span></Label>
<Input
value={givenName}
onChange={e => setGivenName(e.target.value)}
placeholder="Juan"
disabled={loading}
/>
{errors.givenName && <p className="text-xs text-destructive">{errors.givenName}</p>}
</div>
<div className="space-y-1.5">
<Label className="text-xs">Last name <span className="text-destructive">*</span></Label>
<Input
value={lastName}
onChange={e => setLastName(e.target.value)}
placeholder="Dela Cruz"
disabled={loading}
/>
{errors.lastName && <p className="text-xs text-destructive">{errors.lastName}</p>}
</div>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label className="text-xs">
Middle name <span className="text-xs font-normal text-muted-foreground">(optional)</span>
</Label>
<Input
value={middleName}
onChange={e => setMiddleName(e.target.value)}
placeholder="Santos"
disabled={loading}
/>
</div>
<div className="space-y-1.5">
<Label className="text-xs">
Extension <span className="text-xs font-normal text-muted-foreground">(optional)</span>
</Label>
<Input
value={extensionName}
onChange={e => setExtensionName(e.target.value)}
placeholder="Jr., Sr., III"
disabled={loading}
/>
</div>
</div>
{/* Date of birth */}
<div className="space-y-1.5">
<Label className="text-xs">Date of birth <span className="text-destructive">*</span></Label>
<Input
type="date"
value={dateOfBirth}
onChange={e => setDateOfBirth(e.target.value)}
max={new Date().toISOString().split('T')[0]}
disabled={loading}
/>
{errors.dateOfBirth && <p className="text-xs text-destructive">{errors.dateOfBirth}</p>}
</div>
{/* Occupation */}
<div className="space-y-1.5">
<Label className="text-xs">Occupation <span className="text-destructive">*</span></Label>
<Input
value={occupation}
onChange={e => setOccupation(e.target.value)}
placeholder="e.g. Real Estate Broker"
disabled={loading}
/>
{errors.occupation && <p className="text-xs text-destructive">{errors.occupation}</p>}
</div>
{/* Phone */}
<div className="space-y-1.5">
<Label className="text-xs">
Phone number <span className="text-destructive">*</span>
</Label>
<PhoneInput
value={phone}
onChange={setPhone}
international
defaultCountry={detectedCountry}
disabled={loading}
/>
{errors.phone && <p className="text-xs text-destructive">{errors.phone}</p>}
</div>
<Button type="submit" className="w-full" disabled={loading}>
{loading
? <><Loader2 className="size-4 animate-spin" /> Saving...</>
: "Let's get started →"
}
</Button>
</form>
</div>
</div>
</div>
</>
)
}
+52
View File
@@ -0,0 +1,52 @@
import { Link } from 'react-router-dom'
import { LoginForm } from "../components/LoginForm";
import { AuthThemeToggle } from "../components/AuthThemeToggle";
import { MetadataProvider } from "@/contexts/MetadataContext";
export default function Login() {
return (
<MetadataProvider
value={{
title: "Login - Philproperties",
description: "Kindly login to access our online course platform.",
keywords: "login, philproperties, training, onboarding, real-estate",
ogTitle: "Login - Philproperties",
ogDescription: "Kindly login to access our online course platform.",
}}
>
<div className="relative grid min-h-svh lg:grid-cols-2">
<AuthThemeToggle className="absolute top-4 right-4 z-10" />
<div className="flex flex-col gap-4 p-6 md:p-10">
<div className="flex justify-center">
<Link to="/" className="flex items-center gap-2 font-medium">
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 block dark:hidden">
<img
src="/philpro-white.png"
alt="Image"
/>
</div>
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 hidden dark:block">
<img
src="/philpro-dark.png"
alt="Image"
/>
</div>
</Link>
</div>
<div className="flex flex-1 items-center justify-center">
<div className="w-full max-w-sm">
<LoginForm />
</div>
</div>
</div>
<div className="relative hidden lg:block">
<img
src="https://cq5as7pc73.ufs.sh/f/pHNnzIw3VjcgzIbC8SR4stTZRKXP3cfbD6e2p9jmdAUQBuox"
alt="Image"
className="absolute inset-0 h-full w-full object-cover rounded-3xl p-2"
/>
</div>
</div>
</MetadataProvider>
)
}
@@ -0,0 +1,189 @@
/***********************************************************************************************************************************************************************
* File Name: OAuthCallback.jsx
* Type of Program: Frontend Page
* Description: Landing page after the backend completes Google OIDC.
*
* The backend redirects here with NO query params — the outcome (otpRequired/
* email, ban details, or an error code) never touches the URL. Instead, this
* page fetches it from GET /auth/google/result, a single-use endpoint that
* reads a short-lived signed cookie the callback controller set.
*
* OTP path → result = { otpRequired: true, email }. No refresh cookie was
* set yet. Renders the shared OtpVerifyForm; once verified,
* AuthContext has user/tokens set and we navigate to the
* account's home route ourselves.
*
* Trusted path → result = {} (nothing pending) — this device already cleared
* an OTP recently, so the backend set the real refresh cookie
* directly. This page calls restoreSession() to pull the
* access token from it, then navigates to the account's home
* route.
*
* Error path → result = { error: <code>, ... }. No refresh cookie was set,
* so the user stays on this page to see the error.
*
* Author: Kenneth Obsequio (@lash0000)
* Date Created: Jun. 21, 2026
* Date Modified: Jul. 6, 2026 — outcome moved from URL params to /auth/google/result
***********************************************************************************************************************************************************************/
import { useEffect, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import { LoaderCircle, ShieldBan, UserX, AlertTriangle, RefreshCw, Clock } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useAuth } from '@/contexts/AuthContext'
import { useDateFormat } from '@/hooks/useDateFormat'
import { getRoleHomePath } from '@/utils/roleRedirect.util'
import { OtpVerifyForm } from '@/modules/auth/components/OtpVerifyForm'
import api from '@/utils/api.util'
const ERROR_MAP = {
access_denied: { icon: UserX, message: 'You cancelled the Google sign-in.' },
account_deactivated: { icon: UserX, message: 'Your account has been deactivated. Please contact support.' },
session_expired: { icon: Clock, message: 'The sign-in session expired. Please try again.' },
state_mismatch: { icon: AlertTriangle, message: 'Security check failed. Please try signing in again.' },
auth_failed: { icon: RefreshCw, message: 'Google sign-in failed. Please try again.' },
}
export default function OAuthCallback() {
const navigate = useNavigate()
const { restoreSession } = useAuth()
const { fmtDateTime } = useDateFormat()
// null = still resolving; otherwise the parsed /auth/google/result payload.
const [result, setResult] = useState(null)
useEffect(() => {
let cancelled = false
;(async () => {
let pending = {}
try {
const { data } = await api.get('/auth/google/result')
pending = data.data ?? {}
} catch {
// network hiccup — fall through to the trusted-device path below
}
if (pending.otpRequired || pending.error) {
if (!cancelled) setResult(pending)
return
}
// Nothing pending → trusted-device fast path. The refresh cookie was
// already set by the backend; restoreSession() just picks it up.
const { success, user } = await restoreSession()
if (cancelled) return
navigate(success ? getRoleHomePath(user) : '/login', {
replace: true,
state: success && pending.justLinkedGoogle ? { justLinkedGoogle: true } : undefined,
})
})()
return () => { cancelled = true }
}, [])
const error = result?.error
const otpRequired = !!result?.otpRequired
const email = result?.email
if (otpRequired && email) {
return (
<div className="flex min-h-svh items-center justify-center p-6">
<div className="w-full max-w-sm">
<OtpVerifyForm
email={email}
onSuccess={(user) => navigate(getRoleHomePath(user), {
replace: true,
state: result?.justLinkedGoogle ? { justLinkedGoogle: true } : undefined,
})}
title="Verify your sign-in"
description={`We sent a 6-digit code to ${email} to finish signing in with Google. It expires in 10 minutes.`}
/>
</div>
</div>
)
}
if (error === 'account_banned') {
const reason = result.reason
const banType = result.ban_type
const expiresAt = result.expires_at
const expiryText = expiresAt ? fmtDateTime(expiresAt) : null
return (
<div className="min-h-svh flex items-center justify-center bg-muted/40 px-4">
<div className="flex flex-col items-center text-center gap-6 max-w-md w-full">
<div className="flex items-center justify-center w-20 h-20 rounded-full bg-destructive/10">
<ShieldBan className="size-10 text-destructive" />
</div>
<div className="space-y-2">
<h1 className="text-2xl font-semibold tracking-tight">Account Suspended</h1>
<p className="text-sm text-muted-foreground text-balance">
Your account has been suspended and you cannot access the platform at this time.
</p>
</div>
{(reason || banType) && (
<div className="w-full rounded-lg border bg-card p-4 text-left flex flex-col gap-3">
{reason && (
<div>
<p className="text-xs text-muted-foreground uppercase tracking-wide font-medium mb-0.5">Reason</p>
<p className="text-sm">{reason}</p>
</div>
)}
{banType === 'temporary' && expiryText && (
<div>
<p className="text-xs text-muted-foreground uppercase tracking-wide font-medium mb-0.5">Suspended Until</p>
<p className="text-sm">{expiryText}</p>
</div>
)}
{banType === 'permanent' && (
<div>
<p className="text-xs text-muted-foreground uppercase tracking-wide font-medium mb-0.5">Duration</p>
<p className="text-sm">Permanent</p>
</div>
)}
</div>
)}
<p className="text-sm text-muted-foreground">
If you believe this is a mistake, please reach out to your administrator for assistance.
</p>
<Button asChild variant="outline" size="sm">
<Link to="/login">Back to Login</Link>
</Button>
</div>
</div>
)
}
if (error) {
const { icon: Icon, message } = ERROR_MAP[error] ?? { icon: AlertTriangle, message: 'An unexpected error occurred. Please try again.' }
return (
<div className="flex min-h-svh items-center justify-center p-6">
<div className="flex flex-col items-center gap-4 text-center max-w-sm">
<div className="flex items-center justify-center w-12 h-12 rounded-full bg-muted">
<Icon className="size-5 text-muted-foreground" />
</div>
<p className="text-sm text-destructive font-medium">{message}</p>
<Button asChild variant="outline" size="sm">
<Link to="/login">Back to Login</Link>
</Button>
</div>
</div>
)
}
return (
<div className="flex min-h-svh items-center justify-center">
<div className="flex flex-col items-center gap-3">
<LoaderCircle className="size-6 animate-spin text-muted-foreground" />
<p className="text-sm text-muted-foreground">Signing you in...</p>
</div>
</div>
)
}
@@ -0,0 +1,70 @@
/***********************************************************************************************************************************************************************
* File Name: Register.jsx
* Type of Program: Frontend Page
* Description: Registration page. Accepts optional ?group_code= query param to
* auto-enroll new users into a user group on verification.
* Route: /register or /register?group_code=XXXX
* Module: User Credentials
* Author: lash0000
* Date Created: May 23, 2026
***********************************************************************************************************************************************************************
* Change History:
* DATE AUTHOR LOG NUMBER DESCRIPTION
* May 23, 2026 lash0000 001 Initial creation - STAR Phase 1 Project
***********************************************************************************************************************************************************************/
import { Link } from 'react-router-dom'
import { RegisterForm } from '../components/RegisterForm'
import { AuthThemeToggle } from '../components/AuthThemeToggle'
import { MetadataProvider } from '@/contexts/MetadataContext'
// TODO: flip to true once the hero banner asset is ready; grid auto-centers the
// left panel while this is false so no other classes need to change either way.
const SHOW_BANNER = false
export default function Register() {
return (
<MetadataProvider
value={{
title: 'Register - Philproperties',
description: 'Create an account to access our online course platform.',
keywords: 'register, signup, philproperties, training, onboarding, real-estate',
ogTitle: 'Register - Philproperties',
ogDescription: 'Create an account to access our online course platform.',
}}
>
<div className={`relative grid min-h-svh ${SHOW_BANNER ? 'lg:grid-cols-2' : ''}`}>
<AuthThemeToggle className="absolute top-4 right-4 z-10" />
{/* ── Left panel ── */}
<div className="flex flex-col gap-4 p-6 md:p-10">
<div className="flex justify-center">
<Link to="/" className="flex items-center gap-2 font-medium">
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 block dark:hidden">
<img src="/philpro-white.png" alt="Philproperties" />
</div>
<div className="xs:w-40 sm:w-48 md:w-56 2xl:w-64 hidden dark:block">
<img src="/philpro-dark.png" alt="Philproperties" />
</div>
</Link>
</div>
<div className="flex flex-1 items-center justify-center">
<div className="w-full max-w-xl">
<RegisterForm />
</div>
</div>
</div>
{/* ── Right panel — hero image ── */}
{SHOW_BANNER && (
<div className="relative hidden lg:block">
<img
src="https://cq5as7pc73.ufs.sh/f/pHNnzIw3VjcgzIbC8SR4stTZRKXP3cfbD6e2p9jmdAUQBuox"
alt="Philproperties"
className="absolute inset-0 h-full w-full object-cover rounded-3xl p-2"
/>
</div>
)}
</div>
</MetadataProvider>
)
}