styling pass

This commit is contained in:
Paul Miller
2023-04-15 11:01:40 -05:00
parent d36adad34c
commit 3c94312a9f
17 changed files with 230 additions and 179 deletions

View File

@@ -18,7 +18,7 @@ function SingleDigitButton(props: { character: string, onClick: (c: string) => v
);
}
export function AmountEditable(props: { amountSats: number | bigint, setAmountSats: (s: string) => void }) {
export function AmountEditable(props: { amountSats: string, setAmountSats: (s: string) => void, onSave?: () => void }) {
const [isFullscreen, setIsFullscreen] = createSignal(false);
function toggleFullscreen() {
@@ -26,7 +26,7 @@ export function AmountEditable(props: { amountSats: number | bigint, setAmountSa
}
// TODO: validate this doesn't need to be reactive and can be "initialAmountSats"
const [displayAmount, setDisplayAmount] = createSignal(props.amountSats.toString() || "0");
const [displayAmount, setDisplayAmount] = createSignal(props.amountSats || "0");
let inputRef!: HTMLInputElement;
@@ -113,7 +113,8 @@ export function AmountEditable(props: { amountSats: number | bigint, setAmountSa
const [state, _] = useMegaStore()
async function getPrice() {
return await state.node_manager?.get_bitcoin_price()
// return await state.node_manager?.get_bitcoin_price()
return 30000
}
const [price] = createResource(getPrice)
@@ -130,6 +131,10 @@ export function AmountEditable(props: { amountSats: number | bigint, setAmountSa
} else {
props.setAmountSats(displayAmount());
toggleFullscreen();
// This is so the parent can focus the next input if it wants to
if (props.onSave) {
props.onSave();
}
}
}