Skip to content

A local-first personal finance app

fix inconsistent widths of bank sync field mapping selects on mobile (#6007)

Matt Fiddaman9a3e33c0d7bc
diff --git a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
index ce769d52da..6299f19fe4 100644
--- a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
+++ b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
@@ -207,7 +207,6 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) {
fields={fields}
mapping={mapping}
setMapping={setMapping}
- selectMinWidth={300}
/>
<Text style={{ fontSize: 15, margin: '1em 0 .5em 0' }}>
diff --git a/packages/desktop-client/src/components/banksync/FieldMapping.tsx b/packages/desktop-client/src/components/banksync/FieldMapping.tsx
index 31798fdea6..83d28c05a5 100644
--- a/packages/desktop-client/src/components/banksync/FieldMapping.tsx
+++ b/packages/desktop-client/src/components/banksync/FieldMapping.tsx
@@ -38,7 +38,6 @@ type FieldMappingProps = {
fields: MappableFieldWithExample[];
mapping: Map<string, string>;
setMapping: (field: string, value: string) => void;
- selectMinWidth?: number;
isMobile?: boolean;
};
@@ -48,7 +47,6 @@ export function FieldMapping({
fields,
mapping,
setMapping,
- selectMinWidth = 50,
isMobile = false,
}: FieldMappingProps) {
const { t } = useTranslation();
@@ -61,7 +59,6 @@ export function FieldMapping({
const equalsIconWidth = 12;
const calculatedSelectWidth = Math.max(
- selectMinWidth,
...fields.flatMap(field =>
field.syncFields.map(({ field }) => field.length * 8 + 30),
),
@@ -77,6 +74,11 @@ export function FieldMapping({
const commonCellStyle = { height: '100%', border: 0 };
const iconCellStyle = { ...commonCellStyle };
+ const selectStyle = {
+ minWidth: isMobile ? '10ch' : '30ch',
+ maxWidth: isMobile ? '15ch' : '50ch',
+ };
+
return (
<>
<Select
@@ -118,7 +120,7 @@ export function FieldMapping({
<Cell
value={t('Bank field')}
width={calculatedSelectWidth}
- style={{ paddingLeft: 0 }}
+ style={{ paddingLeft: 0, ...selectStyle }}
/>
<Cell value="" width={equalsCellWidth} style={{ padding: 0 }} />
<Cell
@@ -170,7 +172,11 @@ export function FieldMapping({
</View>
</Cell>
- <Cell width={calculatedSelectWidth} style={iconCellStyle} plain>
+ <Cell
+ width={calculatedSelectWidth}
+ style={{ ...iconCellStyle, ...selectStyle }}
+ plain
+ >
<Select
aria-label={t('Synced field to map to {{field}}', {
field: field.actualField,
@@ -181,7 +187,7 @@ export function FieldMapping({
])}
value={mapping.get(field.actualField)}
style={{
- width: calculatedSelectWidth,
+ width: '100%',
}}
onChange={newValue => {
if (newValue) setMapping(field.actualField, newValue);
diff --git a/upcoming-release-notes/6007.md b/upcoming-release-notes/6007.md
new file mode 100644
index 0000000000..873785418b
--- /dev/null
+++ b/upcoming-release-notes/6007.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Fix inconsistent widths of bank sync field mapping selects on mobile