Created
December 10, 2025 20:20
-
-
Save broguinn/de873e62eaf5285678c5a8b7724bef9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/apps/command-center/src/app/dashboard/gate-events/auto-recognition/history/page.tsx b/apps/command-center/src/app/dashboard/gate-events/auto-recognition/history/page.tsx | |
| index dd96fc51..464af5a5 100644 | |
| --- a/apps/command-center/src/app/dashboard/gate-events/auto-recognition/history/page.tsx | |
| +++ b/apps/command-center/src/app/dashboard/gate-events/auto-recognition/history/page.tsx | |
| @@ -23,6 +23,7 @@ const GetYardsVehicleRecognition = gql(` | |
| yards { | |
| id | |
| ...yardVehicleRecognitionFilters | |
| + ...yardVehicleDetectionGrid | |
| } | |
| } | |
| } | |
| diff --git a/apps/command-center/src/app/dashboard/gate-events/auto-recognition/instant-gate-support/page.tsx b/apps/command-center/src/app/dashboard/gate-events/auto-recognition/instant-gate-support/page.tsx | |
| index cabf6454..6b1e6f31 100644 | |
| --- a/apps/command-center/src/app/dashboard/gate-events/auto-recognition/instant-gate-support/page.tsx | |
| +++ b/apps/command-center/src/app/dashboard/gate-events/auto-recognition/instant-gate-support/page.tsx | |
| @@ -2,14 +2,17 @@ | |
| import { Iconify } from 'minimal'; | |
| import { useQueryState } from 'nuqs'; | |
| +import { gql } from '@/src/generated'; | |
| +import { useQuery } from '@apollo/client'; | |
| import { paths } from '@/src/routes/paths'; | |
| import { HOST_API } from '@/src/config-global'; | |
| import { useAuthContext } from '@/src/auth/hooks'; | |
| +import { | |
| + YardType, | |
| +} from '@/src/generated/graphql'; | |
| import { useErrorHandler } from '@/src/hooks/use-error'; | |
| -import { useQuery, TypedDocumentNode } from '@apollo/client'; | |
| import CustomerView from '@/src/sections/customer/CustomerView'; | |
| import React, { useRef, useMemo, useState, useEffect } from 'react'; | |
| -import { gql, FragmentType, getFragmentData } from '@/src/generated'; | |
| import { WERNER_CUSTOMER_ID, HUB_GROUP_CUSTOMER_ID } from '@/src/constants'; | |
| import ReservationsGrid from '@/src/sections/reservations/ReservationsGrid'; | |
| import { useStoredYardPreference } from 'shared/dist/hooks/use-stored-yard'; | |
| @@ -19,11 +22,6 @@ import { | |
| VehicleDetectionGridRef, | |
| VehicleRecognitionConfigProvider, | |
| } from 'shared'; | |
| -import { | |
| - YardType, | |
| - YardVehicleRecognitionFiltersFragment, | |
| - YardVehicleRecognitionFiltersFragmentDoc, | |
| -} from '@/src/generated/graphql'; | |
| import { Box, Button, styled } from '@mui/material'; | |
| @@ -43,7 +41,10 @@ const getYardsQuery = gql(` | |
| id | |
| yards { | |
| id | |
| + shouldAIAnalize | |
| + fullName | |
| ...yardVehicleRecognitionFilters | |
| + ...yardVehicleDetectionGrid | |
| } | |
| } | |
| } | |
| @@ -134,12 +135,7 @@ export default function InstantGateSupport() { | |
| const vehicleDetectionGridRef = useRef<VehicleDetectionGridRef>(null); | |
| const { data: yardData } = useQuery(getYardsQuery); | |
| - const yardsFragment: Array< | |
| - FragmentType<TypedDocumentNode<YardVehicleRecognitionFiltersFragment>> | |
| - > = yardData?.viewer?.yards || []; | |
| - const yards = yardsFragment.map((yf) => | |
| - getFragmentData(YardVehicleRecognitionFiltersFragmentDoc, yf) | |
| - ); | |
| + const yards = yardData?.viewer?.yards || []; | |
| const firstYard = yards.find((yard) => yard.shouldAIAnalize); | |
| useEffect(() => { | |
| @@ -280,7 +276,7 @@ export default function InstantGateSupport() { | |
| defaultYardId={filters?.yardId || undefined} | |
| defaultLaneId={filters?.selectedLaneId || undefined} | |
| defaultStartDate={vehicleDetectionStartDate} | |
| - yards={yardsFragment} | |
| + yards={yards} | |
| /> | |
| </VehicleRecognitionConfigProvider> | |
| )} | |
| diff --git a/apps/parking-web/src/app/(default)/(authed)/history/page.tsx b/apps/parking-web/src/app/(default)/(authed)/history/page.tsx | |
| index 6992f117..feb1097f 100644 | |
| --- a/apps/parking-web/src/app/(default)/(authed)/history/page.tsx | |
| +++ b/apps/parking-web/src/app/(default)/(authed)/history/page.tsx | |
| @@ -21,6 +21,7 @@ const getYardsGateViewComputerVision = gql(` | |
| query getYardsGateViewComputeVision($includeGatekeeper: Boolean, $includeOwned: Boolean, $yardCustomerId: ID) { | |
| yards(includeGatekeeper: $includeGatekeeper, includeOwned: $includeOwned, yardCustomerId: $yardCustomerId) { | |
| id | |
| + ...yardVehicleDetectionGrid | |
| ...yardVehicleRecognitionFilters | |
| } | |
| } | |
| diff --git a/apps/parking-web/src/components/VehicleDetectionGrid.tsx b/apps/parking-web/src/components/VehicleDetectionGrid.tsx | |
| index 43de7183..4c258ebb 100644 | |
| --- a/apps/parking-web/src/components/VehicleDetectionGrid.tsx | |
| +++ b/apps/parking-web/src/components/VehicleDetectionGrid.tsx | |
| @@ -5,14 +5,14 @@ import { TypedDocumentNode } from '@apollo/client'; | |
| import { VehicleDetectionGrid as SharedVehicleDetectionGrid } from 'shared'; | |
| import { FragmentType } from '../generated'; | |
| -import { YardVehicleRecognitionFiltersFragment } from '../generated/graphql'; | |
| +import { YardVehicleDetectionGridFragment, YardVehicleRecognitionFiltersFragment } from '../generated/graphql'; | |
| interface ParkingVehicleDetectionGridProps { | |
| hideFilters?: boolean; | |
| defaultYardId?: string; | |
| defaultLaneType?: string; | |
| defaultStartDate?: Date; | |
| - yards: Array<FragmentType<TypedDocumentNode<YardVehicleRecognitionFiltersFragment>>>; | |
| + yards: Array<FragmentType<TypedDocumentNode<YardVehicleDetectionGridFragment>> & FragmentType<TypedDocumentNode<YardVehicleRecognitionFiltersFragment>>>; | |
| } | |
| export const VehicleDetectionGrid: React.FC<ParkingVehicleDetectionGridProps> = (props) => ( | |
| diff --git a/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx b/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx | |
| index 1733f426..ed04669d 100644 | |
| --- a/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx | |
| +++ b/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx | |
| @@ -3,6 +3,7 @@ import { useQueryState } from 'nuqs'; | |
| import { useSnackbar } from 'notistack'; | |
| import { subMilliseconds } from 'date-fns'; | |
| import { useQuery, ApolloQueryResult, TypedDocumentNode } from '@apollo/client'; | |
| +import { YardVehicleRecognitionFiltersFragment } from '@shared/generated/graphql'; | |
| import React, { | |
| useRef, | |
| useMemo, | |
| @@ -11,10 +12,6 @@ import React, { | |
| useCallback, | |
| useImperativeHandle, | |
| } from 'react'; | |
| -import { | |
| - YardVehicleRecognitionFiltersFragment, | |
| - YardVehicleRecognitionFiltersFragmentDoc, | |
| -} from '@shared/generated/graphql'; | |
| import { Box } from '@mui/material'; | |
| @@ -46,6 +43,12 @@ const query = gql(` | |
| } | |
| `); | |
| +const yardsFragment = gql(` | |
| + fragment yardVehicleDetectionGrid on Yard { | |
| + id | |
| + } | |
| +`); | |
| + | |
| function serializeFilters(filters: FilterState): string { | |
| return JSON.stringify({ | |
| yard: filters.yard, | |
| @@ -69,7 +72,7 @@ interface VehicleDetectionGridProps { | |
| defaultLaneId?: string; | |
| defaultStartDate?: Date; | |
| isParkingWeb?: boolean; | |
| - yards: Array<FragmentType<TypedDocumentNode<YardVehicleRecognitionFiltersFragment>>>; | |
| + yards: Array<FragmentType<typeof yardsFragment> & FragmentType<TypedDocumentNode<YardVehicleRecognitionFiltersFragment>>>; | |
| } | |
| export interface VehicleDetectionGridRef { | |
| @@ -158,13 +161,12 @@ export const VehicleDetectionGrid = forwardRef<VehicleDetectionGridRef, VehicleD | |
| }; | |
| }, [stringifiedFilters]); | |
| + const yardsData = getFragmentData(yardsFragment, yards); | |
| + | |
| // Auto-select the first yard if there's only one and no yard is currently selected | |
| // For parking web, always select the first yard if no yard is selected | |
| useEffect(() => { | |
| - if (yards && yards.length > 0 && !filters.yard) { | |
| - const yardsData = yards.map((yf) => | |
| - getFragmentData(YardVehicleRecognitionFiltersFragmentDoc, yf) | |
| - ); | |
| + if (yardsData && yardsData.length > 0 && !filters.yard) { | |
| if (isParkingWeb || yardsData.length === 1) { | |
| setFilters((prev) => ({ ...prev, yard: yardsData[0].id })); | |
| } else if (yardPreference) { | |
| @@ -176,7 +178,7 @@ export const VehicleDetectionGrid = forwardRef<VehicleDetectionGridRef, VehicleD | |
| } | |
| } | |
| } | |
| - }, [yards, filters.yard, setFilters, isParkingWeb, yardPreference]); | |
| + }, [filters.yard, setFilters, isParkingWeb, yardPreference, yardsData]); | |
| const { | |
| data: connectionQueryData, | |
| @@ -242,7 +244,7 @@ export const VehicleDetectionGrid = forwardRef<VehicleDetectionGridRef, VehicleD | |
| <GridFilters | |
| filters={filters} | |
| updateFilters={updateFilters} | |
| - yardFragments={yards || []} | |
| + yardFragments={yards} | |
| refetch={handleRefetch} | |
| isParkingWeb={isParkingWeb} | |
| /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment