diff --git a/.vscode/settings.json b/.vscode/settings.json index a681c9e..6889f44 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,4 +2,4 @@ "editor.formatOnSave": true, "editor.insertSpaces": true, "editor.tabSize": 2 -} \ No newline at end of file +} diff --git a/src/home/RegisteredView.jsx b/src/home/RegisteredView.jsx index 6849d9f..0480050 100644 --- a/src/home/RegisteredView.jsx +++ b/src/home/RegisteredView.jsx @@ -13,11 +13,13 @@ import { JoinExistingCallModal } from "./JoinExistingCallModal"; import { useHistory } from "react-router-dom"; import { Headline, Title } from "../typography/Typography"; import { Form } from "../form/Form"; +import { useShouldShowPtt } from "../useShouldShowPtt"; export function RegisteredView({ client }) { const [loading, setLoading] = useState(false); const [error, setError] = useState(); const history = useHistory(); + const shouldShowPtt = useShouldShowPtt(); const onSubmit = useCallback( (e) => { e.preventDefault(); @@ -98,14 +100,16 @@ export function RegisteredView({ client }) { {loading ? "Loading..." : "Go"} - - - + {shouldShowPtt && ( + + + + )} {error && ( {error.message} diff --git a/src/home/UnauthenticatedView.jsx b/src/home/UnauthenticatedView.jsx index b39bfc7..8243510 100644 --- a/src/home/UnauthenticatedView.jsx +++ b/src/home/UnauthenticatedView.jsx @@ -15,8 +15,10 @@ import { Form } from "../form/Form"; import styles from "./UnauthenticatedView.module.css"; import commonStyles from "./common.module.css"; import { generateRandomName } from "../auth/generateRandomName"; +import { useShouldShowPtt } from "../useShouldShowPtt"; export function UnauthenticatedView() { + const shouldShowPtt = useShouldShowPtt(); const [loading, setLoading] = useState(false); const [error, setError] = useState(); const [{ privacyPolicyUrl, recaptchaKey }, register] = @@ -112,14 +114,16 @@ export function UnauthenticatedView() { autoComplete="off" /> - - - + {shouldShowPtt && ( + + + + )} By clicking "Go", you agree to our{" "} Terms and conditions diff --git a/src/useShouldShowPtt.js b/src/useShouldShowPtt.js new file mode 100644 index 0000000..606a689 --- /dev/null +++ b/src/useShouldShowPtt.js @@ -0,0 +1,6 @@ +import { useLocation } from "react-router-dom"; + +export function useShouldShowPtt() { + const { hash } = useLocation(); + return hash.startsWith("#ptt"); +}