Login page: split layout with symbolic brand panel, white transparent logo, copyright footer
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d28802994a
commit
cc0cde3219
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
|
|
@ -9,6 +9,8 @@ import { useThemeMode } from '@/providers/ThemeProvider';
|
||||||
* variants (white-text version for dark) when brand assets are available - only this file changes.
|
* variants (white-text version for dark) when brand assets are available - only this file changes.
|
||||||
*/
|
*/
|
||||||
const SRC = { ar: '/brand/nafith-ar.gif', en: '/brand/nafith-en.jpg' } as const;
|
const SRC = { ar: '/brand/nafith-ar.gif', en: '/brand/nafith-en.jpg' } as const;
|
||||||
|
// White-mark versions with a transparent background (made from the originals: white -> transparent, the rest -> white) for dark surfaces.
|
||||||
|
const SRC_ON_DARK = { ar: '/brand/nafith-ar-white.png', en: '/brand/nafith-en-white.png' } as const;
|
||||||
const SIZE ={ ar: { w: 375, h: 81 }, en: { w: 176, h: 43 } } as const;
|
const SIZE ={ ar: { w: 375, h: 81 }, en: { w: 176, h: 43 } } as const;
|
||||||
|
|
||||||
export function Logo({ height = 36, on }: { height?: number; on?: 'dark' | 'light' }) {
|
export function Logo({ height = 36, on }: { height?: number; on?: 'dark' | 'light' }) {
|
||||||
|
|
@ -21,10 +23,9 @@ export function Logo({ height = 36, on }: { height?: number; on?: 'dark' | 'ligh
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'inline-flex', alignItems: 'center', lineHeight: 0,
|
display: 'inline-flex', alignItems: 'center', lineHeight: 0,
|
||||||
...(surface === 'dark' ? { bgcolor: '#fff', borderRadius: 1, px: 1, py: 0.5 } : {}),
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img src={SRC[lang]} alt="Nafith" width={width} height={height} style={{ display: 'block' }} />
|
<img src={(surface === 'dark' ? SRC_ON_DARK : SRC)[lang]}alt="Nafith" width={width} height={height} style={{ display: 'block' }} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ export const ui = {
|
||||||
// login
|
// login
|
||||||
'login.title': { en: 'Sign in', ar: 'تسجيل الدخول' },
|
'login.title': { en: 'Sign in', ar: 'تسجيل الدخول' },
|
||||||
'login.subtitle': { en: 'Enter your account details to continue', ar: 'أدخل بيانات حسابك للمتابعة' },
|
'login.subtitle': { en: 'Enter your account details to continue', ar: 'أدخل بيانات حسابك للمتابعة' },
|
||||||
|
'login.copyright': { en: 'All rights reserved to Nafith Logistics Services Company', ar: 'جميع الحقوق محفوظة لشركة نافذ للخدمات اللوجستية' },
|
||||||
|
'login.heroTitle': { en: 'Nafith Trucks System', ar: 'نظام نافذ للشاحنات' },
|
||||||
'login.username': { en: 'Username', ar: 'اسم المستخدم' },
|
'login.username': { en: 'Username', ar: 'اسم المستخدم' },
|
||||||
'login.password': { en: 'Password', ar: 'كلمة المرور' },
|
'login.password': { en: 'Password', ar: 'كلمة المرور' },
|
||||||
'login.submit': { en: 'Sign in', ar: 'دخول' },
|
'login.submit': { en: 'Sign in', ar: 'دخول' },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
import { Box } from '@mui/material';
|
||||||
|
import { Logo } from '@/components/Logo';
|
||||||
|
|
||||||
|
const WHITE = '#ffffff';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flat, translucent truck silhouette (facing right in its own coordinates, ground at y = 62; mirrored by the caller).
|
||||||
|
* Cab with a window cut-out, a tanker barrel or a grain box with a heaped load, three trailer wheels, two tractor wheels.
|
||||||
|
*/
|
||||||
|
function SymbolTruck({ kind, opacity }: { kind: 'tanker' | 'grain'; opacity: number }) {
|
||||||
|
return (
|
||||||
|
<g fill={WHITE} fillOpacity={opacity}>
|
||||||
|
{/* cab, window cut out */}
|
||||||
|
<path fillRule="evenodd" d="M0 8 Q0 0 8 0 H34 Q42 0 46 8 L58 32 V56 H0 Z M12 8 H32 Q36 8 38 13 L46 30 H12 Z" />
|
||||||
|
<rect x="-6" y="56" width="66" height="5" rx="2" />
|
||||||
|
{kind === 'tanker' ? (
|
||||||
|
<>
|
||||||
|
<rect x="-168" y="10" width="164" height="44" rx="22" />
|
||||||
|
<rect x="-146" y="4" width="16" height="7" rx="3" />
|
||||||
|
<rect x="-96" y="4" width="16" height="7" rx="3" />
|
||||||
|
<rect x="-46" y="4" width="16" height="7" rx="3" />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<rect x="-168" y="22" width="164" height="32" rx="3" />
|
||||||
|
<path d="M-164 24 Q-136 -2 -108 16 Q-80 -6 -52 14 Q-26 2 -8 24 Z" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<rect x="-168" y="54" width="226" height="6" rx="2" />
|
||||||
|
{/* wheels: three on the trailer, two on the tractor */}
|
||||||
|
{[-132, -100, -68, 8, 42].map((x) => <circle key={x} cx={x} cy="56" r="11" fillOpacity={Math.min(0.6, opacity + 0.14)} />)}
|
||||||
|
</g>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Symbolic background scene: soft blocks and a gantry in the distance, a dashed road and two flat truck silhouettes (a fuel tanker
|
||||||
|
* and a grain hauler) heading left, the reading direction. Everything is white at low opacity, so it reads as texture, not as artwork.
|
||||||
|
*/
|
||||||
|
function Scene() {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
aria-hidden="true"
|
||||||
|
sx={{ position: 'absolute', insetInline: 0, bottom: 0, height: '58%', zIndex: 0, pointerEvents: 'none' }}
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 800 460" preserveAspectRatio="xMidYMax meet" style={{ width: '100%', height: '100%', display: 'block' }}>
|
||||||
|
{/* distant blocks (silos, containers) */}
|
||||||
|
<g fill={WHITE}>
|
||||||
|
<rect x="40" y="170" width="120" height="200" fillOpacity="0.05" />
|
||||||
|
<rect x="170" y="230" width="90" height="140" fillOpacity="0.07" />
|
||||||
|
<rect x="600" y="120" width="110" height="250" fillOpacity="0.05" />
|
||||||
|
<rect x="690" y="200" width="100" height="170" fillOpacity="0.08" />
|
||||||
|
<rect x="480" y="250" width="90" height="120" fillOpacity="0.06" />
|
||||||
|
</g>
|
||||||
|
{/* gantry */}
|
||||||
|
<g stroke={WHITE} strokeOpacity="0.16" strokeWidth="5" fill="none">
|
||||||
|
<line x1="330" y1="60" x2="330" y2="372" />
|
||||||
|
<line x1="470" y1="60" x2="470" y2="372" />
|
||||||
|
<line x1="300" y1="60" x2="500" y2="60" />
|
||||||
|
<line x1="400" y1="60" x2="400" y2="130" strokeWidth="3" />
|
||||||
|
</g>
|
||||||
|
<rect x="378" y="124" width="44" height="22" fillOpacity="0.18" fill={WHITE} />
|
||||||
|
|
||||||
|
{/* road */}
|
||||||
|
<rect x="0" y="372" width="800" height="88" fill={WHITE} fillOpacity="0.07" />
|
||||||
|
<line x1="0" y1="388" x2="800" y2="388" stroke={WHITE} strokeOpacity="0.2" strokeWidth="3" />
|
||||||
|
<line x1="0" y1="428" x2="800" y2="428" stroke={WHITE} strokeOpacity="0.35" strokeWidth="4" strokeDasharray="34 26" />
|
||||||
|
|
||||||
|
{/* back lane: tanker; front lane: grain hauler (both mirrored to head left) */}
|
||||||
|
<g transform="translate(103 291) scale(-1.5 1.5)"><SymbolTruck kind="tanker" opacity={0.13} /></g>
|
||||||
|
<g transform="translate(471 308) scale(-1.85 1.85)"><SymbolTruck kind="grain" opacity={0.2} /></g>
|
||||||
|
</svg>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Brand panel of the login page (md and up): gradient, symbolic road scene and the logo. */
|
||||||
|
export function LoginHero() {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: { xs: 'none', md: 'flex' }, flex: 1.1,
|
||||||
|
color: '#fff', position: 'relative', overflow: 'hidden',
|
||||||
|
background: 'linear-gradient(145deg, #072b45 0%, #0b6ea8 60%, #1a8fd1 100%)',
|
||||||
|
'&::before': {
|
||||||
|
content: '""', position: 'absolute', width: 520, height: 520, borderRadius: '50%', insetInlineEnd: -180, top: -200,
|
||||||
|
background: 'radial-gradient(closest-side, rgba(209,162,51,0.35), rgba(209,162,51,0))',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Scene />
|
||||||
|
<Box sx={{ position: 'absolute', zIndex: 1, top: 32, insetInlineStart: 48 }}><Logo height={48} on="dark" /></Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
import { useState, type FormEvent } from 'react';
|
import { useState, type FormEvent } from 'react';
|
||||||
import { Navigate, useLocation } from 'react-router-dom';
|
import { Navigate, useLocation } from 'react-router-dom';
|
||||||
import { Alert, Box, Button, Card, CardContent, IconButton, InputAdornment, Stack, TextField, Typography } from '@mui/material';
|
import { Alert, Box, Button, Card, CardContent, IconButton, InputAdornment, Stack, TextField, Typography, useTheme } from '@mui/material';
|
||||||
import VisibilityIcon from '@mui/icons-material/Visibility';
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
||||||
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
||||||
import { ApiError } from '@/api/client';
|
import { ApiError } from '@/api/client';
|
||||||
import { Logo } from '@/components/Logo';
|
import { Logo } from '@/components/Logo';
|
||||||
import { useUi } from '@/i18n/useUi';
|
import { useUi } from '@/i18n/useUi';
|
||||||
import { useAuth } from '@/providers/AuthProvider';
|
import { useAuth } from '@/providers/AuthProvider';
|
||||||
|
import { LoginHero } from './LoginHero';
|
||||||
import { ThemeToggle } from './Toggles';
|
import { ThemeToggle } from './Toggles';
|
||||||
|
|
||||||
/** Pre-login page: uses ONLY the built-in ui table (no server captions exist before sign-in). */
|
/** Pre-login page: uses ONLY the built-in ui table (no server captions exist before sign-in). */
|
||||||
export function LoginPage() {
|
export function LoginPage() {
|
||||||
const { t } = useUi();
|
const { t } = useUi();
|
||||||
|
const theme = useTheme();
|
||||||
const { status, login } = useAuth();
|
const { status, login } = useAuth();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [username, setUsername] = useState('');
|
const [username, setUsername] = useState('');
|
||||||
|
|
@ -41,18 +43,22 @@ export function LoginPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ minHeight: '100vh', display: 'flex', flexDirection: 'column', bgcolor: 'background.default' }}>
|
// the brand panel (first child) sits on the physical right in both directions (the RTL style plugin would flip a "direction" rule)
|
||||||
|
<Box sx={{ minHeight: '100vh', display: 'flex', flexDirection: theme.direction === 'rtl' ? 'row' : 'row-reverse', bgcolor: 'background.default' }}>
|
||||||
|
<LoginHero />
|
||||||
|
<Box sx={{ flex: 1, display: 'flex', flexDirection: 'column', minWidth: 0 }}>
|
||||||
<Stack direction="row" spacing={0.5} sx={{ alignItems: 'center', justifyContent: 'flex-end', p: 1.5, color: 'text.primary' }}>
|
<Stack direction="row" spacing={0.5} sx={{ alignItems: 'center', justifyContent: 'flex-end', p: 1.5, color: 'text.primary' }}>
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box sx={{ flex: 1, display: 'grid', placeItems: 'center', p: 2 }}>
|
<Box sx={{ flex: 1, display: 'grid', placeItems: 'center', p: 2 }}>
|
||||||
<Card sx={{ width: '100%', maxWidth: 420 }} variant="outlined">
|
<Card sx={{ width: '100%', maxWidth: { xs: 420, md: 520 }, borderRadius: 3, boxShadow: { xs: 'none', md: '0 10px 40px rgba(11,58,92,0.12)' }, borderColor: { md: 'transparent' } }} variant="outlined">
|
||||||
<CardContent sx={{ p: { xs: 3, sm: 4 } }}>
|
<CardContent sx={{ p: { xs: 3, sm: 4, md: 6 }, pt: { md: 5 } }}>
|
||||||
<Stack spacing={3} component="form" onSubmit={submit} noValidate>
|
<Stack spacing={{ xs: 3, md: 3.5 }} component="form" onSubmit={submit} noValidate>
|
||||||
<Box sx={{ textAlign: 'center' }}>
|
<Box sx={{ textAlign: 'center' }}>
|
||||||
<Logo height={44} />
|
{/* on wide screens the logo is in the brand panel */}
|
||||||
<Typography variant="h5" sx={{ mt: 2 }}>{t('login.title')}</Typography>
|
<Box sx={{ display: { xs: 'block', md: 'none' } }}><Logo height={44} /></Box>
|
||||||
<Typography variant="body2" color="text.secondary">{t('login.subtitle')}</Typography>
|
<Typography variant="h4" sx={{ mt: { xs: 2, md: 0 }, fontWeight: 400 }}>{t('login.heroTitle')}</Typography>
|
||||||
|
<Typography color="text.secondary" sx={{ mt: 2, fontSize: { md: 16 } }}>{t('login.subtitle')}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
{error && <Alert severity="error" role="alert">{error}</Alert>}
|
{error && <Alert severity="error" role="alert">{error}</Alert>}
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -82,7 +88,8 @@ export function LoginPage() {
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography variant="caption" color="text.secondary" align="center" sx={{ p: 2 }}>{t('app.name')}</Typography>
|
<Typography variant="caption" color="text.secondary" align="center" sx={{ p: 2 }}>{t('login.copyright')} - {new Date().getFullYear()}</Typography>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue