/* Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import * as React from 'react'; import * as PropTypes from 'prop-types'; import BaseDialog from './BaseDialog'; import { _t } from '../../../languageHandler'; import DialogButtons from '../elements/DialogButtons'; export enum RebrandDialogKind { NAG, ONE_TIME, }; interface IProps { onFinished: () => void; kind: RebrandDialogKind, targetUrl?: string, } export default class RebrandDialog extends React.PureComponent { private onDoneClick = () => { this.props.onFinished(true); } private onGoToElementClick = () => { this.props.onFinished(true); } private onRemindMeLaterClick = () => { this.props.onFinished(false); } private getPrettyTargetUrl() { const u = new URL(this.props.targetUrl); let ret = u.host; if (u.pathname !== '/') ret += u.pathname; return ret; } getBodyText() { if (this.props.kind === RebrandDialogKind.NAG) { return _t( "Use your account to sign in to the latest version of the app at ", {}, { a: sub => {this.getPrettyTargetUrl()}, }, ); } else { return _t( "You’re already signed in and good to go here, but you can also grab the latest " + "versions of the app on all platforms at element.io/get-started.", {}, { a: sub => {sub}, }, ); } } getDialogButtons() { if (this.props.kind === RebrandDialogKind.NAG) { return } else { return } } render() { return
{this.getBodyText()}
Riot Logo Element Logo
{_t( "Learn more at element.io/previously-riot", {}, { a: sub => {sub}, } )}
{this.getDialogButtons()}
; } }