Skip to content

Commit

Permalink
Fix currency input (twentyhq#7469)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp authored and harshit078 committed Oct 14, 2024
1 parent 22f0fb3 commit 78d5815
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FieldCurrencyValue } from '@/object-record/record-field/types/FieldMeta
import { SETTINGS_FIELD_CURRENCY_CODES } from '@/settings/data-model/constants/SettingsFieldCurrencyCodes';
import { formatAmount } from '~/utils/format/formatAmount';
import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';

type CurrencyDisplayProps = {
currencyValue: FieldCurrencyValue | null | undefined;
Expand All @@ -29,10 +30,9 @@ export const CurrencyDisplay = ({ currencyValue }: CurrencyDisplayProps) => {
? SETTINGS_FIELD_CURRENCY_CODES[currencyValue?.currencyCode]?.Icon
: null;

const amountToDisplay =
currencyValue?.amountMicros != null
? currencyValue?.amountMicros / 1000000
: null;
const amountToDisplay = isUndefinedOrNull(currencyValue?.amountMicros)
? null
: currencyValue?.amountMicros / 1000000;

if (!shouldDisplayCurrency) {
return <StyledEllipsisDisplay>{0}</StyledEllipsisDisplay>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const CurrencyInput = ({
placeholder={placeholder}
autoFocus={autoFocus}
value={value}
unmask
/>
</StyledContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const shouldSeedWorkspaceFavorite = (
objectMetadataMap,
): boolean =>
objectMetadataId !==
objectMetadataMap[STANDARD_OBJECT_IDS.workflowVersion].id &&
objectMetadataId !== objectMetadataMap[STANDARD_OBJECT_IDS.workflowRun].id;
objectMetadataMap[STANDARD_OBJECT_IDS.workflowVersion]?.id &&
objectMetadataId !== objectMetadataMap[STANDARD_OBJECT_IDS.workflowRun]?.id;

0 comments on commit 78d5815

Please sign in to comment.