Adds a Search Filter for the NanoBank App transfer funds dropdown input (#19783)

* nanobank search input

* bumps nanobank version from 1.0 to 1.1
This commit is contained in:
Sirryan2002
2022-12-01 21:43:33 +01:00
committed by GitHub
parent e36351f538
commit fa4fe1668a
3 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
name = "NanoBank"
icon = "fas fa-university"
notify_icon = "comments"
title = "NanoBank 1.0"
title = "NanoBank 1.1"
template = "pda_nanobank"
update = PDA_APP_UPDATE_SLOW //we want to avoid iterating through the data lists constantly
@@ -1,8 +1,7 @@
import { filter } from 'common/collections';
import { createSearch } from 'common/string';
import { useBackend, useLocalState } from "../../backend";
import { Box, Button, Dropdown, Icon, Input, LabeledList, Section, Tabs, Table, Divider, Flex } from "../../components";
import { FlexItem } from '../../components/Flex';
import { TableRow } from '../../components/Table';
export const pda_nanobank = (props, context) => {
const { act, data } = useBackend(context);
@@ -91,6 +90,7 @@ const Transfer = (props, context) => {
const { requests, available_accounts, money } = data;
const [selectedAccount, setSelectedAccount] = useLocalState(context, 'selectedAccount');
const [transferAmount, setTransferAmount] = useLocalState(context, 'transferAmount');
const [searchText, setSearchText] = useLocalState(context, 'searchText', '');
let accountMap = []
available_accounts.map(account => (
@@ -101,10 +101,22 @@ const Transfer = (props, context) => {
<>
<LabeledList>
<LabeledList.Item label="Account">
<Input
placeholder="Search by account name"
onInput={(e, value) => setSearchText(value)}
/>
<Dropdown
mt={0.6}
width="190px"
options={available_accounts.map((account) => account.name)}
options={available_accounts
.filter(
createSearch(searchText, (account) => {
return (
account.name
);
})
)
.map((account) => account.name)}
selected={available_accounts.filter(account => account.UID === selectedAccount)[0]?.name}
onSelected={(val) => setSelectedAccount(accountMap[val])} />
</LabeledList.Item>
File diff suppressed because one or more lines are too long