Merge remote-tracking branch 'origin/main' into dbkr/postmessage_ptt_2

This commit is contained in:
David Baker
2022-07-08 19:41:01 +01:00
5 changed files with 3171 additions and 3565 deletions

View File

@@ -42,7 +42,7 @@
"mermaid": "^8.13.8", "mermaid": "^8.13.8",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"pako": "^2.0.4", "pako": "^2.0.4",
"postcss-preset-env": "^6.7.0", "postcss-preset-env": "^7",
"re-resizable": "^6.9.0", "re-resizable": "^6.9.0",
"react": "^17.0.0", "react": "^17.0.0",
"react-dom": "^17.0.0", "react-dom": "^17.0.0",

View File

@@ -71,7 +71,11 @@ type ClientProviderState = Omit<
"changePassword" | "logout" | "setClient" "changePassword" | "logout" | "setClient"
> & { error?: Error }; > & { error?: Error };
export const ClientProvider: FC = ({ children }) => { interface Props {
children: JSX.Element;
}
export const ClientProvider: FC<Props> = ({ children }) => {
const history = useHistory(); const history = useHistory();
const [ const [
{ loading, isAuthenticated, isPasswordlessUser, client, userName, error }, { loading, isAuthenticated, isPasswordlessUser, client, userName, error },

View File

@@ -121,8 +121,10 @@ export const Button = forwardRef<HTMLButtonElement, Props>(
{...mergeProps(rest, filteredButtonProps)} {...mergeProps(rest, filteredButtonProps)}
ref={buttonRef} ref={buttonRef}
> >
{children} <>
{variant === "dropdown" && <ArrowDownIcon />} {children}
{variant === "dropdown" && <ArrowDownIcon />}
</>
</button> </button>
); );
} }

View File

@@ -57,13 +57,17 @@ export const PTTButton: React.FC<Props> = ({
const buttonRef = useRef<HTMLButtonElement>(); const buttonRef = useRef<HTMLButtonElement>();
const [activeTouchId, setActiveTouchId] = useState<number | null>(null); const [activeTouchId, setActiveTouchId] = useState<number | null>(null);
const [buttonHeld, setButtonHeld] = useState(false);
const hold = useCallback(() => { const hold = useCallback(() => {
// This update is delayed so the user only sees it if latency is significant // This update is delayed so the user only sees it if latency is significant
if (buttonHeld) return;
setButtonHeld(true);
enqueueNetworkWaiting(true, 100); enqueueNetworkWaiting(true, 100);
startTalking(); startTalking();
}, [enqueueNetworkWaiting, startTalking]); }, [enqueueNetworkWaiting, startTalking, buttonHeld]);
const unhold = useCallback(() => { const unhold = useCallback(() => {
setButtonHeld(false);
setNetworkWaiting(false); setNetworkWaiting(false);
stopTalking(); stopTalking();
}, [setNetworkWaiting, stopTalking]); }, [setNetworkWaiting, stopTalking]);

6716
yarn.lock

File diff suppressed because it is too large Load Diff