updates on the redirection and dispatch aligments

This commit is contained in:
2026-09-21 13:39:06 +05:30
parent 7992208361
commit 1bfbdb59ef
3 changed files with 98 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import { AlertCircle, Check, Loader2, Eye, EyeOff, CheckCircle2 } from 'lucide-react'; import { AlertCircle, Check, Loader2, Eye, EyeOff, CheckCircle2 } from 'lucide-react';
import { DOORMILE_WORDMARK_URL } from '@/assets/brand'; 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() { export default function Login() {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const { login } = useAuth(); const { login, isAuthenticated } = useAuth();
const from = location.state?.from; 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 [form, setForm] = useState({ email: '', password: '', remember: true });
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);

View File

@@ -553,50 +553,46 @@
Design language: matches the Compare-button family — soft white card, Design language: matches the Compare-button family — soft white card,
indigo border + halo on hover/focus, subtle lift on interaction. indigo border + halo on hover/focus, subtle lift on interaction.
──────────────────────────────────────────────────────────────── */ ──────────────────────────────────────────────────────────────── */
/* Date picker chip - compact (32px), single-row, responsive */
.dispatch-container .date-chip { .dispatch-container .date-chip {
position: relative; position: relative;
/* anchors .date-cal-popover */
display: inline-flex; display: inline-flex;
align-items: stretch; align-items: center;
gap: 0; gap: 0;
height: 32px;
max-height: 32px;
background: #ffffff; background: #ffffff;
border: 1px solid rgba(15, 23, 42, 0.08); border: 1px solid rgba(15, 23, 42, 0.12);
border-radius: 5px; border-radius: 8px;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 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;
transition: border-color 0.18s ease, box-shadow 0.18s ease, flex-shrink: 0;
transform 0.18s ease; box-sizing: border-box;
} }
.dispatch-container .date-chip.is-open { .dispatch-container .date-chip.is-open {
border-color: #000000; border-color: #000000;
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2), box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.14);
0 12px 30px rgba(0, 0, 0, 0.22);
} }
.dispatch-container .date-chip:hover { .dispatch-container .date-chip:hover {
border-color: rgba(0, 0, 0, 0.45); border-color: rgba(0, 0, 0, 0.35);
box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
0 8px 22px rgba(0, 0, 0, 0.15);
transform: translateY(-1px);
} }
.dispatch-container .date-chip:focus-within { .dispatch-container .date-chip:focus-within {
border-color: #000000; border-color: #000000;
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2), box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
0 8px 22px rgba(0, 0, 0, 0.22);
} }
/* 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 { .dispatch-container .date-chip-main {
appearance: none; appearance: none;
position: relative; position: relative;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 10px; gap: 6px;
padding: 8px 18px; height: 100%;
padding: 0 8px;
cursor: pointer; cursor: pointer;
min-width: 0; min-width: 0;
background: transparent; background: transparent;
@@ -604,6 +600,7 @@
color: inherit; color: inherit;
font: inherit; font: inherit;
text-align: left; text-align: left;
box-sizing: border-box;
} }
.dispatch-container .date-chip-main:focus { .dispatch-container .date-chip-main:focus {
@@ -611,70 +608,70 @@
} }
.dispatch-container .date-chip-main:hover { .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 { .dispatch-container .date-chip-icon {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 28px; width: 20px;
height: 28px; height: 20px;
border-radius: 5px; border-radius: 4px;
background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%); background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
color: #262626; color: #334155;
font-size: 15px; font-size: 12px;
flex-shrink: 0; flex-shrink: 0;
} }
.dispatch-container .date-chip-text { .dispatch-container .date-chip-text {
display: flex; display: flex;
flex-direction: column; flex-direction: row;
align-items: flex-start; align-items: center;
line-height: 1.1; line-height: 1;
gap: 2px; gap: 5px;
min-width: 0; min-width: 0;
} }
.dispatch-container .date-chip-label { .dispatch-container .date-chip-label {
display: inline-flex; display: none;
align-items: center;
gap: 6px;
font-size: 10px;
font-weight: 800;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.08em;
} }
.dispatch-container .date-chip-today-pill { .dispatch-container .date-chip-today-pill {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
padding: 1px 6px; padding: 1px 5px;
border-radius: 999px; border-radius: 999px;
background: linear-gradient(135deg, #000000, #3A3A3A); background: #0f172a;
color: #ffffff; color: #ffffff;
font-size: 9px; font-size: 8.5px;
font-weight: 800; font-weight: 700;
letter-spacing: 0.06em; letter-spacing: 0.04em;
text-transform: uppercase; text-transform: uppercase;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
} }
.dispatch-container .date-chip-value { .dispatch-container .date-chip-value {
font-size: 13px; font-size: 12px;
font-weight: 700; font-weight: 600;
color: #0f172a; color: #0f172a;
letter-spacing: 0.01em; letter-spacing: 0.01em;
white-space: nowrap; white-space: nowrap;
} }
.dispatch-container .date-chip-full {
display: inline;
}
.dispatch-container .date-chip-short {
display: none;
}
.dispatch-container .date-chip-chevron { .dispatch-container .date-chip-chevron {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #94a3b8; color: #94a3b8;
font-size: 18px; font-size: 15px;
margin-left: 2px; margin-left: 2px;
transition: color 0.18s ease, transform 0.18s ease; transition: color 0.18s ease, transform 0.18s ease;
} }
@@ -683,8 +680,6 @@
color: #262626; 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 { .dispatch-container .date-chip-chevron.is-open {
color: #262626; color: #262626;
transform: rotate(180deg); transform: rotate(180deg);
@@ -696,7 +691,7 @@
up at the chip; same shadow language as the order-popup. */ up at the chip; same shadow language as the order-popup. */
.dispatch-container .date-cal-popover { .dispatch-container .date-cal-popover {
position: absolute; position: absolute;
top: calc(100% + 10px); top: calc(100% + 6px);
right: 0; right: 0;
z-index: 1000; z-index: 1000;
width: 304px; width: 304px;
@@ -921,7 +916,9 @@
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 34px; width: 24px;
height: 100%;
box-sizing: border-box;
border: 0; border: 0;
border-left: 1px solid rgba(15, 23, 42, 0.06); border-left: 1px solid rgba(15, 23, 42, 0.06);
border-right: 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; scrollbar-width: none;
-ms-overflow-style: 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;
}
}

View File

@@ -3584,12 +3584,6 @@ const Dispatch = ({
</span> </span>
Live Live
</button> </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' && ( {shouldFetchLive && viewMode !== 'rider-info' && (
<div className="relative inline-flex items-center ml-1" ref={batchMenuRef}> <div className="relative inline-flex items-center ml-1" ref={batchMenuRef}>
<button <button
@@ -3784,8 +3778,17 @@ const Dispatch = ({
<MdCalendarToday /> <MdCalendarToday />
</span> </span>
<span className="date-chip-text"> <span className="date-chip-text">
<span className="date-chip-label">Date{isToday && <span className="date-chip-today-pill">Today</span>}</span> {isToday && <span className="date-chip-today-pill">Today</span>}
<span className="date-chip-value">{picked.isValid() ? picked.format('ddd, MMM D, YYYY') : '—'}</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>
<span className={`date-chip-chevron${datePickerOpen ? ' is-open' : ''}`} aria-hidden="true"> <span className={`date-chip-chevron${datePickerOpen ? ' is-open' : ''}`} aria-hidden="true">
<MdExpandMore /> <MdExpandMore />