diff --git a/apps/fishing-map/features/search/SearchDownload.tsx b/apps/fishing-map/features/search/SearchDownload.tsx index 68caa9aafc..7608dfde25 100644 --- a/apps/fishing-map/features/search/SearchDownload.tsx +++ b/apps/fishing-map/features/search/SearchDownload.tsx @@ -18,7 +18,7 @@ function SearchDownload() { const vesselsParsed = vesselsSelected.map((vessel) => { return { name: formatInfoField(getVesselProperty(vessel, 'shipname'), 'shipname'), - ssvid: getVesselProperty(vessel, 'ssvid'), + mmsi: getVesselProperty(vessel, 'ssvid'), imo: getVesselProperty(vessel, 'imo'), 'call sign': getVesselProperty(vessel, 'callsign'), flag: t(`flags:${getVesselProperty(vessel, 'flag')}` as any), @@ -42,7 +42,7 @@ function SearchDownload() { label: JSON.stringify( vesselsParsed.map((vessel) => ({ name: vessel.name, - mmsi: vessel.ssvid, + mmsi: vessel.mmsi, imo: vessel.imo, callsign: vessel['call sign'], owner: vessel.owner, diff --git a/apps/fishing-map/features/search/advanced/SearchAdvancedFilters.tsx b/apps/fishing-map/features/search/advanced/SearchAdvancedFilters.tsx index a58c73483e..ac34a66675 100644 --- a/apps/fishing-map/features/search/advanced/SearchAdvancedFilters.tsx +++ b/apps/fishing-map/features/search/advanced/SearchAdvancedFilters.tsx @@ -81,6 +81,16 @@ function AdvancedFilterInputField({ const value = searchFilters[field] || '' const invalid = searchFilterErrors[field] + const PLACEHOLDER_BY_FIELD: Record = useMemo( + () => ({ + ssvid: '123456789, 987654321, ...', + imo: '1234567, 7654321, ...', + callsign: 'A1BC2, X2YZ, ...', + owner: t('search.placeholderFilterMultiple', 'One or more values (comma separated)'), + }), + [t] + ) + return ( ) } diff --git a/apps/fishing-map/features/search/search.slice.ts b/apps/fishing-map/features/search/search.slice.ts index 99234cdaac..5dd90402ef 100644 --- a/apps/fishing-map/features/search/search.slice.ts +++ b/apps/fishing-map/features/search/search.slice.ts @@ -22,6 +22,7 @@ import { getRelatedDatasetByType, isFieldInFieldsAllowed } from 'features/datase import { IdentityVesselData, VesselDataIdentity } from 'features/vessel/vessel.slice' import { getVesselId, getVesselIdentities } from 'features/vessel/vessel.utils' import { VesselSearchState } from 'features/search/search.types' +import { ADVANCED_SEARCH_FIELDS } from 'features/search/advanced/advanced-search.utils' export type VesselLastIdentity = Omit & { dataset: Dataset | string @@ -98,9 +99,12 @@ export const fetchVesselSearchThunk = createAsyncThunk( const filter = (filters as any)[cleanField] if (filter && isInFieldsAllowed) { let value = filter - // Supports searching by multiple values separated by comma in owners - if (field === 'owner' && value?.includes(', ')) { - value = (value as string).split(', ') + // Supports searching by multiple values separated by comma + if (ADVANCED_SEARCH_FIELDS.includes(field as any) && value?.includes(',')) { + value = (value as string) + .split(',') + .map((v) => v.trim()) + .filter(Boolean) } return { key: field as AdvancedSearchQueryFieldKey, value } } diff --git a/apps/fishing-map/features/vessel/vessel.utils.ts b/apps/fishing-map/features/vessel/vessel.utils.ts index e88de19c29..aa63f908b3 100644 --- a/apps/fishing-map/features/vessel/vessel.utils.ts +++ b/apps/fishing-map/features/vessel/vessel.utils.ts @@ -62,10 +62,10 @@ export function getLatestIdentityPrioritised(vessel: IdentityVessel | IdentityVe const latestSelfReportesIdentity = getVesselIdentity(vessel, { identitySource: VesselIdentitySourceEnum.SelfReported, }) - const identity = latestRegistryIdentity || latestSelfReportesIdentity - const identitySource = latestRegistryIdentity - ? VesselIdentitySourceEnum.Registry - : VesselIdentitySourceEnum.SelfReported + const identity = latestSelfReportesIdentity || latestRegistryIdentity + const identitySource = latestSelfReportesIdentity + ? VesselIdentitySourceEnum.SelfReported + : VesselIdentitySourceEnum.Registry const geartypes = getVesselProperty(vessel, 'geartypes', { identitySource, identityId: identity?.id, diff --git a/apps/fishing-map/public/locales/source/translations.json b/apps/fishing-map/public/locales/source/translations.json index 9c9f4781eb..cacf625c12 100644 --- a/apps/fishing-map/public/locales/source/translations.json +++ b/apps/fishing-map/public/locales/source/translations.json @@ -702,6 +702,7 @@ "notValidFilter": "At least one of your selected sources doesn't allow one of your filters", "notValidFilterSelection": "At least one of your selected sources doesn't allow one of your filters", "placeholder": "Type to search vessels", + "placeholderFilterMultiple": "One or more values (comma separated)", "result_one": "result", "result_other": "results", "searching": "Searching more than 100K vessels ...",