updates on the redirection and dispatch aligments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { AlertCircle, Check, Loader2, Eye, EyeOff, CheckCircle2 } from 'lucide-react';
|
||||
import { DOORMILE_WORDMARK_URL } from '@/assets/brand';
|
||||
@@ -28,10 +28,18 @@ const FEATURES = ['Real-time fleet visibility', 'AI-optimised dispatch routes',
|
||||
export default function Login() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { login } = useAuth();
|
||||
const { login, isAuthenticated } = useAuth();
|
||||
|
||||
const from = location.state?.from;
|
||||
const returnTo = typeof from === 'string' && from.startsWith('/doormile') ? from : '/doormile/control-x';
|
||||
const returnTo = typeof from === 'string' && from.startsWith('/doormile') && from !== '/doormile/control-x'
|
||||
? from
|
||||
: '/doormile/home';
|
||||
|
||||
useEffect(() => {
|
||||
if (isAuthenticated) {
|
||||
navigate('/doormile/home', { replace: true });
|
||||
}
|
||||
}, [isAuthenticated, navigate]);
|
||||
|
||||
const [form, setForm] = useState({ email: '', password: '', remember: true });
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
|
||||
@@ -553,50 +553,46 @@
|
||||
Design language: matches the Compare-button family — soft white card,
|
||||
indigo border + halo on hover/focus, subtle lift on interaction.
|
||||
──────────────────────────────────────────────────────────────── */
|
||||
/* Date picker chip - compact (32px), single-row, responsive */
|
||||
.dispatch-container .date-chip {
|
||||
position: relative;
|
||||
/* anchors .date-cal-popover */
|
||||
display: inline-flex;
|
||||
align-items: stretch;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
height: 32px;
|
||||
max-height: 32px;
|
||||
background: #ffffff;
|
||||
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
|
||||
0 4px 12px rgba(15, 23, 42, 0.06);
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease,
|
||||
transform 0.18s ease;
|
||||
border: 1px solid rgba(15, 23, 42, 0.12);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip.is-open {
|
||||
border-color: #000000;
|
||||
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2),
|
||||
0 12px 30px rgba(0, 0, 0, 0.22);
|
||||
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.14);
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip:hover {
|
||||
border-color: rgba(0, 0, 0, 0.45);
|
||||
box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06),
|
||||
0 8px 22px rgba(0, 0, 0, 0.15);
|
||||
transform: translateY(-1px);
|
||||
border-color: rgba(0, 0, 0, 0.35);
|
||||
box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip:focus-within {
|
||||
border-color: #000000;
|
||||
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2),
|
||||
0 8px 22px rgba(0, 0, 0, 0.22);
|
||||
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* Center card — visible chrome the operator reads. Renders as a <button>
|
||||
that toggles the custom calendar popover. Native focus ring is replaced
|
||||
by the parent's focus-within shadow. */
|
||||
.dispatch-container .date-chip-main {
|
||||
appearance: none;
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 18px;
|
||||
gap: 6px;
|
||||
height: 100%;
|
||||
padding: 0 8px;
|
||||
cursor: pointer;
|
||||
min-width: 0;
|
||||
background: transparent;
|
||||
@@ -604,6 +600,7 @@
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-main:focus {
|
||||
@@ -611,70 +608,70 @@
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-main:hover {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
background: rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 5px;
|
||||
background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
|
||||
color: #262626;
|
||||
font-size: 15px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
||||
color: #334155;
|
||||
font-size: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
line-height: 1.1;
|
||||
gap: 2px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
gap: 5px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
color: #94a3b8;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-today-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 1px 6px;
|
||||
padding: 1px 5px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(135deg, #000000, #3A3A3A);
|
||||
background: #0f172a;
|
||||
color: #ffffff;
|
||||
font-size: 9px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.06em;
|
||||
font-size: 8.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-value {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
letter-spacing: 0.01em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-full {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-short {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dispatch-container .date-chip-chevron {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #94a3b8;
|
||||
font-size: 18px;
|
||||
font-size: 15px;
|
||||
margin-left: 2px;
|
||||
transition: color 0.18s ease, transform 0.18s ease;
|
||||
}
|
||||
@@ -683,8 +680,6 @@
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
/* Chevron flips up when the popover is open — same micro-interaction every
|
||||
dropdown in the UI uses, so the operator instantly knows the state. */
|
||||
.dispatch-container .date-chip-chevron.is-open {
|
||||
color: #262626;
|
||||
transform: rotate(180deg);
|
||||
@@ -696,7 +691,7 @@
|
||||
up at the chip; same shadow language as the order-popup. */
|
||||
.dispatch-container .date-cal-popover {
|
||||
position: absolute;
|
||||
top: calc(100% + 10px);
|
||||
top: calc(100% + 6px);
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
width: 304px;
|
||||
@@ -921,7 +916,9 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
width: 24px;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 0;
|
||||
border-left: 1px solid rgba(15, 23, 42, 0.06);
|
||||
border-right: 1px solid rgba(15, 23, 42, 0.06);
|
||||
@@ -10732,3 +10729,29 @@
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
/* Date picker chip responsive utilities */
|
||||
@media (max-width: 1280px) {
|
||||
.dispatch-container .date-chip-full {
|
||||
display: none !important;
|
||||
}
|
||||
.dispatch-container .date-chip-short {
|
||||
display: inline !important;
|
||||
}
|
||||
.dispatch-container .date-chip-main {
|
||||
padding: 0 6px;
|
||||
gap: 4px;
|
||||
}
|
||||
.dispatch-container .date-chip-nav {
|
||||
width: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.dispatch-container .date-chip-nav {
|
||||
display: none !important;
|
||||
}
|
||||
.dispatch-container .date-chip-main {
|
||||
border-radius: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3584,12 +3584,6 @@ const Dispatch = ({
|
||||
</span>
|
||||
Live
|
||||
</button>
|
||||
<button type="button" className={`dtt-tab ${topView === 'analysis' ? 'active' : ''}`} onClick={() => setTopView('analysis')}>
|
||||
<span className="dtt-icon">
|
||||
<MdInsights />
|
||||
</span>
|
||||
Analysis
|
||||
</button>
|
||||
{shouldFetchLive && viewMode !== 'rider-info' && (
|
||||
<div className="relative inline-flex items-center ml-1" ref={batchMenuRef}>
|
||||
<button
|
||||
@@ -3784,8 +3778,17 @@ const Dispatch = ({
|
||||
<MdCalendarToday />
|
||||
</span>
|
||||
<span className="date-chip-text">
|
||||
<span className="date-chip-label">Date{isToday && <span className="date-chip-today-pill">Today</span>}</span>
|
||||
<span className="date-chip-value">{picked.isValid() ? picked.format('ddd, MMM D, YYYY') : '—'}</span>
|
||||
{isToday && <span className="date-chip-today-pill">Today</span>}
|
||||
<span className="date-chip-value">
|
||||
{picked.isValid() ? (
|
||||
<>
|
||||
<span className="date-chip-full">{picked.format('ddd, MMM D, YYYY')}</span>
|
||||
<span className="date-chip-short">{picked.format('MMM D, YYYY')}</span>
|
||||
</>
|
||||
) : (
|
||||
'—'
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
<span className={`date-chip-chevron${datePickerOpen ? ' is-open' : ''}`} aria-hidden="true">
|
||||
<MdExpandMore />
|
||||
|
||||
Reference in New Issue
Block a user