MOB-722 DRY match button type

This commit is contained in:
sepeterson
2025-12-12 10:57:22 -06:00
parent 4dea79d970
commit 48f49da1c7
3 changed files with 8 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import AdditionalSuggestionsScroll
from "./AdditionalSuggestions/AdditionalSuggestionsScroll";
import EmptyMapSection from "./EmptyMapSection";
import IconicSuggestionsScroll from "./IconicSuggestions/IconicSuggestionsScroll";
import type { MatchButtonAction } from "./MatchContainer";
import MatchHeader from "./MatchHeader";
import PhotosSection from "./PhotosSection";
import SaveDiscardButtons from "./SaveDiscardButtons";
@@ -30,7 +31,7 @@ export const matchCardClassBottom
type Props = {
observation: RealmObservation,
obsPhotos: RealmObservationPhoto[],
handleSaveOrDiscardPress: ( action: string ) => void,
handleSaveOrDiscardPress: ( action: MatchButtonAction ) => void,
navToTaxonDetails: ( photo?: ApiPhoto ) => void,
isFetchingLocation: boolean,
handleAddLocationPressed: ( ) => void,

View File

@@ -59,6 +59,8 @@ interface State {
orderedSuggestions: ApiSuggestion[];
}
export type MatchButtonAction = "save" | "discard";
type Action =
| { type: "SET_UPLOAD_PARAMS"; scoreImageParams: ImageParamsType }
| { type: "SET_ONLINE_FETCH_STATUS"; onlineFetchStatus: FETCH_STATUSES }
@@ -497,7 +499,7 @@ const MatchContainer = ( ) => {
navigation.push( "TaxonDetails", navParams );
};
const handleSaveOrDiscardPress = async ( action: string ) => {
const handleSaveOrDiscardPress = async ( action: MatchButtonAction ) => {
if ( action === "save" ) {
updateObservationKeys( {
taxon: taxon || iconicTaxon,

View File

@@ -6,13 +6,15 @@ import React from "react";
import { useTranslation } from "sharedHooks";
import { getShadow } from "styles/global";
import type { MatchButtonAction } from "./MatchContainer";
const DROP_SHADOW = getShadow( {
offsetHeight: -3,
shadowOpacity: 0.2
} );
type Props = {
handlePress: ( action: string ) => void
handlePress: ( action: MatchButtonAction ) => void
}
const SaveDiscardButtons = ( {