tap phone button in keypad to "paste" latest recipient
This commit is contained in:
parent
3d1c545892
commit
e77e7d17e0
@ -7,13 +7,16 @@ import { Transition } from "@headlessui/react";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faBackspace, faPhoneAlt as faPhone } from "@fortawesome/pro-solid-svg-icons";
|
||||
|
||||
import { Direction } from "db";
|
||||
import Layout from "../../core/layouts/layout";
|
||||
import Keypad from "../components/keypad";
|
||||
import useRequireOnboarding from "../../core/hooks/use-require-onboarding";
|
||||
import usePhoneCalls from "../hooks/use-phone-calls";
|
||||
|
||||
const KeypadPage: BlitzPage = () => {
|
||||
useRequireOnboarding();
|
||||
const router = useRouter();
|
||||
const [phoneCalls] = usePhoneCalls();
|
||||
const [phoneNumber, setPhoneNumber] = useAtom(phoneNumberAtom);
|
||||
const removeDigit = useAtom(pressBackspaceAtom)[1];
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
@ -71,11 +74,17 @@ const KeypadPage: BlitzPage = () => {
|
||||
</div>
|
||||
|
||||
<Keypad onDigitPressProps={onDigitPressProps} onZeroPressProps={onZeroPressProps}>
|
||||
<Link href={Routes.OutgoingCall({ recipient: encodeURI(phoneNumber) })}>
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (phoneNumber === "") {
|
||||
// TODO setPhoneNumber(lastCallRecipient);
|
||||
const lastCall = phoneCalls[0];
|
||||
if (lastCall) {
|
||||
const lastCallRecipient =
|
||||
lastCall.direction === Direction.Inbound ? lastCall.from : lastCall.to;
|
||||
setPhoneNumber(lastCallRecipient);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await router.push(Routes.OutgoingCall({ recipient: encodeURI(phoneNumber) }));
|
||||
@ -85,7 +94,6 @@ const KeypadPage: BlitzPage = () => {
|
||||
>
|
||||
<FontAwesomeIcon className="w-6 h-6" icon={faPhone} color="white" size="lg" />
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
|
Loading…
Reference in New Issue
Block a user