Set debug stream default account from transaction account
This commit is contained in:
@@ -10,7 +10,7 @@ interface ISelect<T = string> {
|
|||||||
value: T;
|
value: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
const streamState = proxy({
|
export const streamState = proxy({
|
||||||
selectedAccount: null as ISelect | null,
|
selectedAccount: null as ISelect | null,
|
||||||
logs: [] as ILog[],
|
logs: [] as ILog[],
|
||||||
socket: undefined as WebSocket | undefined,
|
socket: undefined as WebSocket | undefined,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import transactionsData from "../../content/transactions.json";
|
|||||||
import state from "../../state";
|
import state from "../../state";
|
||||||
import { sendTransaction } from "../../state/actions";
|
import { sendTransaction } from "../../state/actions";
|
||||||
import { getSplit, saveSplit } from "../../state/actions/persistSplits";
|
import { getSplit, saveSplit } from "../../state/actions/persistSplits";
|
||||||
|
import { streamState } from "../../components/DebugStream";
|
||||||
|
|
||||||
const DebugStream = dynamic(() => import("../../components/DebugStream"), {
|
const DebugStream = dynamic(() => import("../../components/DebugStream"), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@@ -182,6 +183,11 @@ const Transaction: FC<Props> = ({ header, ...props }) => {
|
|||||||
setTxIsLoading(false);
|
setTxIsLoading(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleSetAccount = useCallback((acc: typeof accountOptions[0]) => {
|
||||||
|
setSelectedAccount(acc)
|
||||||
|
streamState.selectedAccount = acc
|
||||||
|
}, [])
|
||||||
|
|
||||||
const usualFields = ["TransactionType", "Amount", "Account", "Destination"];
|
const usualFields = ["TransactionType", "Amount", "Account", "Destination"];
|
||||||
const otherFields = Object.keys(txFields).filter(
|
const otherFields = Object.keys(txFields).filter(
|
||||||
(k) => !usualFields.includes(k)
|
(k) => !usualFields.includes(k)
|
||||||
@@ -239,7 +245,7 @@ const Transaction: FC<Props> = ({ header, ...props }) => {
|
|||||||
css={{ width: "70%" }}
|
css={{ width: "70%" }}
|
||||||
options={accountOptions}
|
options={accountOptions}
|
||||||
value={selectedAccount}
|
value={selectedAccount}
|
||||||
onChange={(acc) => setSelectedAccount(acc as any)}
|
onChange={acc => handleSetAccount(acc as any)}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
{txFields.Amount !== undefined && (
|
{txFields.Amount !== undefined && (
|
||||||
|
|||||||
Reference in New Issue
Block a user