removed the all location button inthe dispatch page and the rdierlogs page only show the active riders

This commit is contained in:
2026-06-05 09:33:41 +05:30
parent b78730a9a5
commit 174ea5e8f2
2 changed files with 21 additions and 52 deletions

View File

@@ -2788,43 +2788,6 @@ const Dispatch = ({
<div className="logo">
<div className="logo-badge">D</div>
<div className="logo-name">Dispatch</div>
{appLocations && appLocations.length > 0 && (
<div className="logo-city-wrap" ref={locationMenuRef}>
<button
type="button"
className={`logo-city ${locationMenuOpen ? 'open' : ''}`}
onClick={() => setLocationMenuOpen((v) => !v)}
aria-haspopup="listbox"
aria-expanded={locationMenuOpen}
title="Switch hub"
>
<MdPlace />
<span className="logo-city-text">{locationName || 'All locations'}</span>
<MdExpandMore className="logo-city-caret" />
</button>
{locationMenuOpen && (
<div className="logo-city-menu" role="listbox">
{appLocations.map((loc) => {
const isActive = String(loc.applocationid) === String(selectedAppLocationId);
return (
<button
key={loc.applocationid}
type="button"
role="option"
aria-selected={isActive}
className={`logo-city-option ${isActive ? 'active' : ''}`}
onClick={() => handleLocationPick(loc.applocationid)}
>
<MdPlace className="logo-city-option-icon" />
<span>{loc.locationname}</span>
{isActive && <span className="logo-city-option-check"></span>}
</button>
);
})}
</div>
)}
</div>
)}
</div>
{/* Header right-cluster: total-orders pill, date picker. Sits to the

View File

@@ -117,9 +117,16 @@ const RidersLogs = () => {
refetchInterval: 5 * 60 * 1000
});
// Only active riders are surfaced on this page — inactive riders are filtered
// out entirely before they reach the list, selection, counts, or map.
const activeRiders = React.useMemo(
() => (riders || []).filter((r) => r.status === 'active'),
[riders]
);
useEffect(() => {
setSelectedRiders(riders);
}, [riders]);
setSelectedRiders(activeRiders);
}, [activeRiders]);
useEffect(() => {
setOpen(isDesktop);
@@ -140,10 +147,9 @@ const RidersLogs = () => {
return () => document.removeEventListener('keydown', handleKeyPress);
}, []);
// Counts shown in the drawer header.
const totalRiders = riders?.length || 0;
const activeCount = (riders || []).filter((r) => r.status === 'active').length;
const inactiveCount = totalRiders - activeCount;
// Counts shown in the drawer header (active riders only).
const totalRiders = activeRiders.length;
const activeCount = totalRiders;
const isAllSelected = totalRiders > 0 && selectedRiders?.length === totalRiders;
return (
@@ -195,8 +201,11 @@ const RidersLogs = () => {
sx={{
position: 'sticky',
top: 0,
zIndex: 2,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
zIndex: 5,
// Solid white base UNDER the translucent brand gradient so the
// scrolling rider list never shows through the sticky header.
backgroundColor: '#fff',
backgroundImage: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
borderBottom: `1px solid ${DT.borderSubtle}`,
p: 1.75
}}
@@ -250,9 +259,6 @@ const RidersLogs = () => {
<SoftPill color={C_ACTIVE} icon={<MdCheckCircle size={11} />}>
Active · {activeCount}
</SoftPill>
<SoftPill color={C_INACTIVE} icon={<MdHighlightOff size={11} />}>
Inactive · {inactiveCount}
</SoftPill>
</Stack>
{/* Pill search */}
@@ -301,7 +307,7 @@ const RidersLogs = () => {
<Box
onClick={() => {
if (!isAllSelected) {
setSelectedRiders(riders);
setSelectedRiders(activeRiders);
}
}}
sx={{
@@ -328,7 +334,7 @@ const RidersLogs = () => {
checked={isAllSelected}
onChange={(e) => {
if (e.target.checked) {
setSelectedRiders(riders);
setSelectedRiders(activeRiders);
}
}}
sx={{
@@ -380,7 +386,7 @@ const RidersLogs = () => {
</Stack>
</ListItem>
))
: riders?.map((row) => {
: activeRiders.map((row) => {
const isSelected = selectedRiders?.length === 1 && selectedRiders[0]?.userid === row?.userid;
const statusColor = row.status === 'active' ? C_ACTIVE : C_INACTIVE;
const initial = (row.firstname || row.username || '?').charAt(0).toUpperCase();
@@ -422,7 +428,7 @@ const RidersLogs = () => {
if (e.target.checked) {
setSelectedRiders([row]);
} else {
setSelectedRiders(riders);
setSelectedRiders(activeRiders);
}
}}
sx={{