This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement send over lightning and intraledger (#20)
* feat: add the generic parse payment destination logic under a galoy-client folder (which will be a package later) * feat: implement the send screen, ln-invoice works * feat: make a sendFixedAmount component and add reset button * feat: add action to handle no-amount invoices * feat: implement sending over intraledger Co-authored-by: Samer Buna <[email protected]>
- Loading branch information
Showing
42 changed files
with
1,188 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ChangeEvent, useState, memo, useEffect } from "react" | ||
import { useDebouncedCallback } from "use-debounce" | ||
|
||
export type OnInputValueChange = (value: string) => void | ||
|
||
type Props = { | ||
onChange?: OnInputValueChange | ||
onDebouncedChange?: OnInputValueChange | ||
[prop: string]: unknown | ||
} | ||
|
||
type InputObject = { | ||
value: string | ||
debouncedValue?: string | ||
typing: boolean | ||
} | ||
|
||
const DebouncedInput = ({ onChange, onDebouncedChange, ...inputProps }: Props) => { | ||
const [input, setInput] = useState<InputObject>({ value: "", typing: false }) | ||
|
||
const setDebouncedInputValue = useDebouncedCallback((debouncedValue) => { | ||
setInput((currInput) => ({ ...currInput, debouncedValue, typing: false })) | ||
}, 1000) | ||
|
||
useEffect(() => { | ||
if (input.typing) { | ||
setDebouncedInputValue(input.value) | ||
} | ||
return () => setDebouncedInputValue.cancel() | ||
}, [setDebouncedInputValue, input.typing, input.value]) | ||
|
||
useEffect(() => { | ||
if (onDebouncedChange && input.debouncedValue !== undefined) { | ||
onDebouncedChange(input.debouncedValue) | ||
} | ||
}, [onDebouncedChange, input.debouncedValue]) | ||
|
||
const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
const newValue = event.target.value | ||
if (onChange) { | ||
onChange(newValue) | ||
} | ||
setInput({ value: newValue, typing: true }) | ||
} | ||
|
||
return <input value={input.value} onChange={handleOnChange} {...inputProps} /> | ||
} | ||
|
||
export default memo(DebouncedInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import config from "server/config" | ||
import config from "store/config" | ||
|
||
type Props = { error: string | Error } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.