diff --git a/.eslintrc b/.eslintrc index 22f85f7..2b3a352 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,42 +1,42 @@ { - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "settings": { - "react": { - "version": "17" - } - }, - "rules": { - "sort-keys-fix/sort-keys-fix": "warn", - "@typescript-eslint/ban-ts-comment": 0, - "@typescript-eslint/explicit-module-boundary-types": 0, - "@typescript-eslint/no-explicit-any": 0, - "@typescript-eslint/no-namespace": 0, - "@typescript-eslint/no-var-requires": 0, - "eqeqeq": ["error", "smart"] - }, - "extends": [ - "plugin:react/recommended", - "prettier", - "plugin:jest/recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "env": { - "amd": true, - "browser": true, - "es6": true, - "node": true, - "jest": true - }, - "globals": { - "React": true, - "__VERSION__": true - }, - "plugins": ["@typescript-eslint", "jest", "prettier", "react-hooks", "react", "sort-keys-fix"] + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } + }, + "settings": { + "react": { + "version": "17" + } + }, + "rules": { + "sort-keys-fix/sort-keys-fix": "warn", + "@typescript-eslint/ban-ts-comment": 0, + "@typescript-eslint/explicit-module-boundary-types": 0, + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-namespace": 0, + "@typescript-eslint/no-var-requires": 0, + "eqeqeq": ["error", "smart"] + }, + "extends": [ + "plugin:react/recommended", + "prettier", + "plugin:jest/recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "env": { + "amd": true, + "browser": true, + "es6": true, + "node": true, + "jest": true + }, + "globals": { + "React": true, + "__VERSION__": true + }, + "plugins": ["@typescript-eslint", "jest", "prettier", "react-hooks", "react", "sort-keys-fix"] } diff --git a/frontend/src/pages/dashboard/entry-row.tsx b/frontend/src/pages/dashboard/entry-row.tsx index a149963..beb15d9 100644 --- a/frontend/src/pages/dashboard/entry-row.tsx +++ b/frontend/src/pages/dashboard/entry-row.tsx @@ -1,10 +1,10 @@ -import { Comment, Posting, isComment } from 'pta-tools'; - import React, { FC } from 'react'; +import { Comment, Posting, isComment } from 'pta-tools'; + import AsyncAutocomplete from 'atoms/async-autocomplete'; -import { Autocomplete, Button, Group, Space, TextInput, createStyles } from '@mantine/core'; +import { Button, Chip, Chips, Group, Space, TextInput, createStyles } from '@mantine/core'; const useStyles = createStyles(theme => { return { @@ -24,11 +24,12 @@ const useStyles = createStyles(theme => { const EntryRow: FC<{ amountPlaceholder: string | null; canDelete: boolean; + commodities: string[]; description: string | undefined; entry: Posting | Comment; removeRow: () => void; updateRow: (field: string, value: string) => void; -}> = ({ amountPlaceholder, canDelete, entry, removeRow, updateRow, description }) => { +}> = ({ amountPlaceholder, canDelete, entry, removeRow, updateRow, description, commodities }) => { const { classes } = useStyles(); if (isComment(entry)) { return null; @@ -55,14 +56,21 @@ const EntryRow: FC<{ style={{ flex: 2 }} onChange={event => updateRow('amount', event.currentTarget.value)} /> - updateRow('commodity', value)} - /> + + { + updateRow('commodity', val); + }}> + {commodities.map(c => ( + + {c} + + ))} + + {canDelete ? (