Merge pull request #5221 from matrix-org/t3chguy/fix/15180
UI Feature Flag: Share dialog QR code and social iconspull/21833/head
commit
5f324b19f0
|
@ -71,9 +71,12 @@ limitations under the License.
|
||||||
margin-right: 64px;
|
margin-right: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_ShareDialog_qrcode_container + .mx_ShareDialog_social_container {
|
||||||
|
width: 299px;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_ShareDialog_social_container {
|
.mx_ShareDialog_social_container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 299px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ShareDialog_social_icon {
|
.mx_ShareDialog_social_icon {
|
||||||
|
|
|
@ -32,6 +32,8 @@ import {copyPlaintext, selectText} from "../../../utils/strings";
|
||||||
import StyledCheckbox from '../elements/StyledCheckbox';
|
import StyledCheckbox from '../elements/StyledCheckbox';
|
||||||
import AccessibleTooltipButton from '../elements/AccessibleTooltipButton';
|
import AccessibleTooltipButton from '../elements/AccessibleTooltipButton';
|
||||||
import { IDialogProps } from "./IDialogProps";
|
import { IDialogProps } from "./IDialogProps";
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
const socials = [
|
const socials = [
|
||||||
{
|
{
|
||||||
|
@ -197,6 +199,35 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
|
||||||
const matrixToUrl = this.getUrl();
|
const matrixToUrl = this.getUrl();
|
||||||
const encodedUrl = encodeURIComponent(matrixToUrl);
|
const encodedUrl = encodeURIComponent(matrixToUrl);
|
||||||
|
|
||||||
|
const showQrCode = SettingsStore.getValue(UIFeature.ShareQRCode);
|
||||||
|
const showSocials = SettingsStore.getValue(UIFeature.ShareSocial);
|
||||||
|
|
||||||
|
let qrSocialSection;
|
||||||
|
if (showQrCode || showSocials) {
|
||||||
|
qrSocialSection = <>
|
||||||
|
<hr />
|
||||||
|
<div className="mx_ShareDialog_split">
|
||||||
|
{ showQrCode && <div className="mx_ShareDialog_qrcode_container">
|
||||||
|
<QRCode data={matrixToUrl} width={256} />
|
||||||
|
</div> }
|
||||||
|
{ showSocials && <div className="mx_ShareDialog_social_container">
|
||||||
|
{ socials.map((social) => (
|
||||||
|
<a
|
||||||
|
rel="noreferrer noopener"
|
||||||
|
target="_blank"
|
||||||
|
key={social.name}
|
||||||
|
title={social.name}
|
||||||
|
href={social.url(encodedUrl)}
|
||||||
|
className="mx_ShareDialog_social_icon"
|
||||||
|
>
|
||||||
|
<img src={social.img} alt={social.name} height={64} width={64} />
|
||||||
|
</a>
|
||||||
|
)) }
|
||||||
|
</div> }
|
||||||
|
</div>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
return <BaseDialog
|
return <BaseDialog
|
||||||
title={title}
|
title={title}
|
||||||
|
@ -220,27 +251,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{ checkbox }
|
{ checkbox }
|
||||||
<hr />
|
{ qrSocialSection }
|
||||||
|
|
||||||
<div className="mx_ShareDialog_split">
|
|
||||||
<div className="mx_ShareDialog_qrcode_container">
|
|
||||||
<QRCode data={matrixToUrl} width={256} />
|
|
||||||
</div>
|
|
||||||
<div className="mx_ShareDialog_social_container">
|
|
||||||
{ socials.map((social) => (
|
|
||||||
<a
|
|
||||||
rel="noreferrer noopener"
|
|
||||||
target="_blank"
|
|
||||||
key={social.name}
|
|
||||||
title={social.name}
|
|
||||||
href={social.url(encodedUrl)}
|
|
||||||
className="mx_ShareDialog_social_icon"
|
|
||||||
>
|
|
||||||
<img src={social.img} alt={social.name} height={64} width={64} />
|
|
||||||
</a>
|
|
||||||
)) }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>;
|
</BaseDialog>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,4 +643,12 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
[UIFeature.ShareQRCode]: {
|
||||||
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
[UIFeature.ShareSocial]: {
|
||||||
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,4 +23,6 @@ export enum UIFeature {
|
||||||
Registration = "UIFeature.registration",
|
Registration = "UIFeature.registration",
|
||||||
PasswordReset = "UIFeature.passwordReset",
|
PasswordReset = "UIFeature.passwordReset",
|
||||||
Deactivate = "UIFeature.deactivate",
|
Deactivate = "UIFeature.deactivate",
|
||||||
|
ShareQRCode = "UIFeature.shareQrCode",
|
||||||
|
ShareSocial = "UIFeature.shareSocial",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue