Skip to content

Commit

Permalink
save csv inOutMode settings
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-fidd committed Oct 3, 2024
1 parent 327887b commit c420fad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,6 @@ export function ImportTransactionsModal({ options }) {
const [filetype, setFileType] = useState(null);
const [fieldMappings, setFieldMappings] = useState(null);
const [splitMode, setSplitMode] = useState(false);
const [inOutMode, setInOutMode] = useState(false);
const [outValue, setOutValue] = useState('');
const [flipAmount, setFlipAmount] = useState(false);
const [multiplierEnabled, setMultiplierEnabled] = useState(false);
const [reconcile, setReconcile] = useState(true);
Expand All @@ -876,6 +874,12 @@ export function ImportTransactionsModal({ options }) {
const [skipLines, setSkipLines] = useState(
parseInt(prefs[`csv-skip-lines-${accountId}`], 10) || 0,
);
const [inOutMode, setInOutMode] = useState(
String(prefs[`csv-in-out-mode-${accountId}`]) === 'true',
);
const [outValue, setOutValue] = useState(
prefs[`csv-out-value-${accountId}`] ?? '',
);
const [hasHeaderRow, setHasHeaderRow] = useState(
String(prefs[`csv-has-header-${accountId}`]) !== 'false',
);
Expand Down Expand Up @@ -1344,6 +1348,8 @@ export function ImportTransactionsModal({ options }) {
savePrefs({ [`csv-delimiter-${accountId}`]: delimiter });
savePrefs({ [`csv-has-header-${accountId}`]: String(hasHeaderRow) });
savePrefs({ [`csv-skip-lines-${accountId}`]: String(skipLines) });
savePrefs({ [`csv-in-out-mode-${accountId}`]: String(inOutMode) });
savePrefs({ [`csv-out-value-${accountId}`]: String(outValue) });
}

if (filetype === 'csv' || filetype === 'qif') {
Expand Down
2 changes: 2 additions & 0 deletions packages/loot-core/src/types/prefs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type SyncedPrefs = Partial<
| `csv-mappings-${string}`
| `csv-delimiter-${string}`
| `csv-skip-lines-${string}`
| `csv-in-out-mode-${string}`
| `csv-out-value-${string}`
| `csv-has-header-${string}`
| `ofx-fallback-missing-payee-${string}`
| `flip-amount-${string}-${'csv' | 'qif'}`
Expand Down

0 comments on commit c420fad

Please sign in to comment.