Created
December 10, 2025 19:29
-
-
Save broguinn/1d13249544e5325e415a543ad2a05680 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/instant-gate-support/page.tsx b/apps/command-center/src/app/dashboard/gate-events/auto-recognition/instant-gate-support/page.tsx | |
| index cabf6454..94ee32c7 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,6 +41,8 @@ const getYardsQuery = gql(` | |
| id | |
| yards { | |
| id | |
| + shouldAIAnalize | |
| + fullName | |
| ...yardVehicleRecognitionFilters | |
| } | |
| } | |
| @@ -134,12 +134,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 +275,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..89003f35 100644 | |
| --- a/apps/parking-web/src/app/(default)/(authed)/history/page.tsx | |
| +++ b/apps/parking-web/src/app/(default)/(authed)/history/page.tsx | |
| @@ -21,7 +21,7 @@ const getYardsGateViewComputerVision = gql(` | |
| query getYardsGateViewComputeVision($includeGatekeeper: Boolean, $includeOwned: Boolean, $yardCustomerId: ID) { | |
| yards(includeGatekeeper: $includeGatekeeper, includeOwned: $includeOwned, yardCustomerId: $yardCustomerId) { | |
| id | |
| - ...yardVehicleRecognitionFilters | |
| + ...yardVehicleDetectionGrid | |
| } | |
| } | |
| `); | |
| diff --git a/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx b/packages/shared/src/components/VehicleRecognitionHistory/_components/VehicleDetectionGrid.tsx | |
| index 1733f426..5e11a5c6 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,13 @@ const query = gql(` | |
| } | |
| `); | |
| +const yardsFragment = gql(` | |
| + fragment yardVehicleDetectionGrid on Yard { | |
| + id | |
| + ...yardVehicleRecognitionFilters | |
| + } | |
| +`); | |
| + | |
| function serializeFilters(filters: FilterState): string { | |
| return JSON.stringify({ | |
| yard: filters.yard, | |
| @@ -69,7 +73,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 +162,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 +179,7 @@ export const VehicleDetectionGrid = forwardRef<VehicleDetectionGridRef, VehicleD | |
| } | |
| } | |
| } | |
| - }, [yards, filters.yard, setFilters, isParkingWeb, yardPreference]); | |
| + }, [filters.yard, setFilters, isParkingWeb, yardPreference, yardsData]); | |
| const { | |
| data: connectionQueryData, | |
| @@ -242,7 +245,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