Merge pull request #308 from vector-im/dbkr/ptt_enable_flag
Put PTT behind 'feature flag'
This commit is contained in:
commit
d930ab869a
4 changed files with 31 additions and 17 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -2,4 +2,4 @@
|
|||
"editor.formatOnSave": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"}
|
||||
</Button>
|
||||
</FieldRow>
|
||||
<FieldRow className={styles.fieldRow}>
|
||||
<InputField
|
||||
id="ptt"
|
||||
name="ptt"
|
||||
label="Push to Talk"
|
||||
type="checkbox"
|
||||
/>
|
||||
</FieldRow>
|
||||
{shouldShowPtt && (
|
||||
<FieldRow className={styles.fieldRow}>
|
||||
<InputField
|
||||
id="ptt"
|
||||
name="ptt"
|
||||
label="Push to Talk"
|
||||
type="checkbox"
|
||||
/>
|
||||
</FieldRow>
|
||||
)}
|
||||
{error && (
|
||||
<FieldRow className={styles.fieldRow}>
|
||||
<ErrorMessage>{error.message}</ErrorMessage>
|
||||
|
|
|
@ -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"
|
||||
/>
|
||||
</FieldRow>
|
||||
<FieldRow>
|
||||
<InputField
|
||||
id="ptt"
|
||||
name="ptt"
|
||||
label="Push to Talk"
|
||||
type="checkbox"
|
||||
/>
|
||||
</FieldRow>
|
||||
{shouldShowPtt && (
|
||||
<FieldRow>
|
||||
<InputField
|
||||
id="ptt"
|
||||
name="ptt"
|
||||
label="Push to Talk"
|
||||
type="checkbox"
|
||||
/>
|
||||
</FieldRow>
|
||||
)}
|
||||
<Caption>
|
||||
By clicking "Go", you agree to our{" "}
|
||||
<Link href={privacyPolicyUrl}>Terms and conditions</Link>
|
||||
|
|
6
src/useShouldShowPtt.js
Normal file
6
src/useShouldShowPtt.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { useLocation } from "react-router-dom";
|
||||
|
||||
export function useShouldShowPtt() {
|
||||
const { hash } = useLocation();
|
||||
return hash.startsWith("#ptt");
|
||||
}
|
Loading…
Add table
Reference in a new issue