Skip to content

Commit

Permalink
Fix DEP port name in map vessel card logbook
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Apr 8, 2024
1 parent 1aba0b7 commit 1ffc86d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ data class LogbookMessage(
}

message.departurePort?.let { departurePortLocode ->
message.departurePortName = allPorts.find { it.locode === departurePortLocode }?.name
message.departurePortName = allPorts.find { it.locode == departurePortLocode }?.name
}

message.speciesOnboard.forEach { catch ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getValueOrDash(value?: string | number) {
return value
}

export function getDatetimeOrDash(dateTimeUtc?: string) {
export function getDatetimeOrDash(dateTimeUtc: string | undefined) {
if (!dateTimeUtc) {
return <NoValue>-</NoValue>
}
Expand All @@ -27,7 +27,7 @@ export function getDatetimeOrDash(dateTimeUtc?: string) {
)
}

export function getCodeWithNameOrDash(code?: string | null, codeName?: string | null) {
export function getCodeWithNameOrDash(code: string | null | undefined, codeName: string | null | undefined) {
if (!code && !codeName) {
return <NoValue>-</NoValue>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import { getLogbookTripSummary, getUniqueGears } from '../utils'
import type { LogbookTripSummary } from '../types'
import type { Promisable } from 'type-fest'

type LogbookSummaryProps = {
type LogbookSummaryProps = Readonly<{
navigation: {
goToLastTrip: () => Promisable<void>
goToNextTrip: () => Promisable<void>
goToPreviousTrip: () => Promisable<void>
}
showLogbookMessages: (messageType?: string) => Promisable<void>
}
}>
export function LogbookSummary({ navigation, showLogbookMessages }: LogbookSummaryProps) {
const dispatch = useMainAppDispatch()
const selectedVessel = useMainAppSelector(state => state.vessel.selectedVessel)
Expand All @@ -43,7 +43,7 @@ export function LogbookSummary({ navigation, showLogbookMessages }: LogbookSumma
const isLastVoyage = useMainAppSelector(state => state.fishingActivities.isLastVoyage)
const tripNumber = useMainAppSelector(state => state.fishingActivities.tripNumber)

const { data: lastLogbookTrips } = useGetLastLogbookTripsQuery(selectedVessel?.internalReferenceNumber || skipToken)
const { data: lastLogbookTrips } = useGetLastLogbookTripsQuery(selectedVessel?.internalReferenceNumber ?? skipToken)

const getVesselLogbook = useGetLogbookUseCase()

Expand All @@ -59,7 +59,7 @@ export function LogbookSummary({ navigation, showLogbookMessages }: LogbookSumma
lastLogbookTrips?.map(trip => ({
label: `Marée n°${trip}`,
value: trip
})) || [],
})) ?? [],
[lastLogbookTrips]
)

Expand Down Expand Up @@ -156,7 +156,7 @@ export function LogbookSummary({ navigation, showLogbookMessages }: LogbookSumma
onChange={getLogbookTrip}
options={lastLogbookTripsOptions}
searchable
value={tripNumber || undefined}
value={tripNumber ?? undefined}
/>
<NextTrip
data-cy="vessel-fishing-next-trip"
Expand Down Expand Up @@ -186,7 +186,7 @@ export function LogbookSummary({ navigation, showLogbookMessages }: LogbookSumma
isNotAcknowledged={
!!logbookTrip.dep.log.acknowledge && logbookTrip.dep.log.acknowledge?.isSuccess === false
}
rejectionCause={logbookTrip.dep.log.acknowledge?.rejectionCause || undefined}
rejectionCause={logbookTrip.dep.log.acknowledge?.rejectionCause ?? undefined}
showLogbookMessages={showLogbookMessages}
/>
) : (
Expand Down

0 comments on commit 1ffc86d

Please sign in to comment.