Skip to content

Commit

Permalink
Update StoresListMap to use realtime data for expected wait time and …
Browse files Browse the repository at this point in the history
…current status
  • Loading branch information
joao-vasconcelos committed Jan 6, 2025
1 parent 5f2bc57 commit 6f650ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion frontend/components/stores/StoresListGroups/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { StoresListEmpty } from '@/components/stores/StoresListEmpty';
import StoresListGroupItem from '@/components/stores/StoresListGroupItem';
import StoresListItemSkeleton from '@/components/stores/StoresListGroupItemSkeleton';
import { useStoresListContext } from '@/contexts/StoresList.context';
// import collator from '@/utils/collator';
import { useTranslations } from 'next-intl';
import { useMemo } from 'react';

Expand Down
6 changes: 3 additions & 3 deletions frontend/components/stores/StoresListMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export default function Component() {
const allStoresFeatureCollection: FeatureCollection<Geometry, GeoJsonProperties> | null = useMemo(() => {
if (!storesListContext.data.raw.length) return null;
const formattedFeatures: Feature<Geometry, GeoJsonProperties>[] = storesListContext.data.raw.map((storeItem) => {
const expectedWaitTimeInMinutes = Math.round(storeItem.expected_wait_time / 60);
const textValue = storeItem.current_status !== 'closed' ? t('expected_wait_time', { count: expectedWaitTimeInMinutes }) : '';
const expectedWaitTimeInMinutes = Math.round((storeItem.realtime?.expected_wait_time ?? 0) / 60);
const textValue = storeItem.realtime?.current_status !== 'closed' ? t('expected_wait_time', { count: expectedWaitTimeInMinutes }) : '';
return {
geometry: {
coordinates: [storeItem.lon, storeItem.lat],
type: 'Point',
},
properties: {
current_status: storeItem.current_status,
current_status: storeItem.realtime?.current_status,
store_id: storeItem.id,
text_value: textValue,
},
Expand Down

0 comments on commit 6f650ee

Please sign in to comment.