Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import url from 'url';
|
||||
import React from 'react';
|
||||
import url from "url";
|
||||
import React from "react";
|
||||
import { SERVICE_TYPES } from "matrix-js-sdk/src/service-types";
|
||||
|
||||
import { _t, pickBestLanguage } from '../../../languageHandler';
|
||||
import { _t, pickBestLanguage } from "../../../languageHandler";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
|
||||
|
@ -34,10 +34,7 @@ class TermsCheckbox extends React.PureComponent<ITermsCheckboxProps> {
|
|||
};
|
||||
|
||||
render() {
|
||||
return <input type="checkbox"
|
||||
onChange={this.onChange}
|
||||
checked={this.props.checked}
|
||||
/>;
|
||||
return <input type="checkbox" onChange={this.onChange} checked={this.props.checked} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,30 +79,43 @@ export default class TermsDialog extends React.PureComponent<ITermsDialogProps,
|
|||
};
|
||||
|
||||
private onNextClick = (): void => {
|
||||
this.props.onFinished(true, Object.keys(this.state.agreedUrls).filter((url) => this.state.agreedUrls[url]));
|
||||
this.props.onFinished(
|
||||
true,
|
||||
Object.keys(this.state.agreedUrls).filter((url) => this.state.agreedUrls[url]),
|
||||
);
|
||||
};
|
||||
|
||||
private nameForServiceType(serviceType: SERVICE_TYPES, host: string): JSX.Element {
|
||||
switch (serviceType) {
|
||||
case SERVICE_TYPES.IS:
|
||||
return <div>{ _t("Identity server") }<br />({ host })</div>;
|
||||
return (
|
||||
<div>
|
||||
{_t("Identity server")}
|
||||
<br />({host})
|
||||
</div>
|
||||
);
|
||||
case SERVICE_TYPES.IM:
|
||||
return <div>{ _t("Integration manager") }<br />({ host })</div>;
|
||||
return (
|
||||
<div>
|
||||
{_t("Integration manager")}
|
||||
<br />({host})
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private summaryForServiceType(serviceType: SERVICE_TYPES): JSX.Element {
|
||||
switch (serviceType) {
|
||||
case SERVICE_TYPES.IS:
|
||||
return <div>
|
||||
{ _t("Find others by phone or email") }
|
||||
<br />
|
||||
{ _t("Be found by phone or email") }
|
||||
</div>;
|
||||
return (
|
||||
<div>
|
||||
{_t("Find others by phone or email")}
|
||||
<br />
|
||||
{_t("Be found by phone or email")}
|
||||
</div>
|
||||
);
|
||||
case SERVICE_TYPES.IM:
|
||||
return <div>
|
||||
{ _t("Use bots, bridges, widgets and sticker packs") }
|
||||
</div>;
|
||||
return <div>{_t("Use bots, bridges, widgets and sticker packs")}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,31 +133,33 @@ export default class TermsDialog extends React.PureComponent<ITermsDialogProps,
|
|||
const policyValues = Object.values(policiesAndService.policies);
|
||||
for (let i = 0; i < policyValues.length; ++i) {
|
||||
const termDoc = policyValues[i];
|
||||
const termsLang = pickBestLanguage(Object.keys(termDoc).filter((k) => k !== 'version'));
|
||||
const termsLang = pickBestLanguage(Object.keys(termDoc).filter((k) => k !== "version"));
|
||||
let serviceName;
|
||||
let summary;
|
||||
if (i === 0) {
|
||||
serviceName = this.nameForServiceType(policiesAndService.service.serviceType, parsedBaseUrl.host);
|
||||
summary = this.summaryForServiceType(
|
||||
policiesAndService.service.serviceType,
|
||||
);
|
||||
summary = this.summaryForServiceType(policiesAndService.service.serviceType);
|
||||
}
|
||||
|
||||
rows.push(<tr key={termDoc[termsLang].url}>
|
||||
<td className="mx_TermsDialog_service">{ serviceName }</td>
|
||||
<td className="mx_TermsDialog_summary">{ summary }</td>
|
||||
<td>
|
||||
{ termDoc[termsLang].name }
|
||||
<a rel="noreferrer noopener" target="_blank" href={termDoc[termsLang].url}>
|
||||
<span className="mx_TermsDialog_link" />
|
||||
</a>
|
||||
</td>
|
||||
<td><TermsCheckbox
|
||||
url={termDoc[termsLang].url}
|
||||
onChange={this.onTermsCheckboxChange}
|
||||
checked={Boolean(this.state.agreedUrls[termDoc[termsLang].url])}
|
||||
/></td>
|
||||
</tr>);
|
||||
rows.push(
|
||||
<tr key={termDoc[termsLang].url}>
|
||||
<td className="mx_TermsDialog_service">{serviceName}</td>
|
||||
<td className="mx_TermsDialog_summary">{summary}</td>
|
||||
<td>
|
||||
{termDoc[termsLang].name}
|
||||
<a rel="noreferrer noopener" target="_blank" href={termDoc[termsLang].url}>
|
||||
<span className="mx_TermsDialog_link" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<TermsCheckbox
|
||||
url={termDoc[termsLang].url}
|
||||
onChange={this.onTermsCheckboxChange}
|
||||
checked={Boolean(this.state.agreedUrls[termDoc[termsLang].url])}
|
||||
/>
|
||||
</td>
|
||||
</tr>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +171,7 @@ export default class TermsDialog extends React.PureComponent<ITermsDialogProps,
|
|||
for (const terms of Object.values(policiesAndService.policies)) {
|
||||
let docAgreed = false;
|
||||
for (const lang of Object.keys(terms)) {
|
||||
if (lang === 'version') continue;
|
||||
if (lang === "version") continue;
|
||||
if (this.state.agreedUrls[terms[lang].url]) {
|
||||
docAgreed = true;
|
||||
break;
|
||||
|
@ -180,24 +192,27 @@ export default class TermsDialog extends React.PureComponent<ITermsDialogProps,
|
|||
fixedWidth={false}
|
||||
onFinished={this.onCancelClick}
|
||||
title={_t("Terms of Service")}
|
||||
contentId='mx_Dialog_content'
|
||||
contentId="mx_Dialog_content"
|
||||
hasCancel={false}
|
||||
>
|
||||
<div id='mx_Dialog_content'>
|
||||
<p>{ _t("To continue you need to accept the terms of this service.") }</p>
|
||||
<div id="mx_Dialog_content">
|
||||
<p>{_t("To continue you need to accept the terms of this service.")}</p>
|
||||
|
||||
<table className="mx_TermsDialog_termsTable"><tbody>
|
||||
<tr className="mx_TermsDialog_termsTableHeader">
|
||||
<th>{ _t("Service") }</th>
|
||||
<th>{ _t("Summary") }</th>
|
||||
<th>{ _t("Document") }</th>
|
||||
<th>{ _t("Accept") }</th>
|
||||
</tr>
|
||||
{ rows }
|
||||
</tbody></table>
|
||||
<table className="mx_TermsDialog_termsTable">
|
||||
<tbody>
|
||||
<tr className="mx_TermsDialog_termsTableHeader">
|
||||
<th>{_t("Service")}</th>
|
||||
<th>{_t("Summary")}</th>
|
||||
<th>{_t("Document")}</th>
|
||||
<th>{_t("Accept")}</th>
|
||||
</tr>
|
||||
{rows}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<DialogButtons primaryButton={_t('Next')}
|
||||
<DialogButtons
|
||||
primaryButton={_t("Next")}
|
||||
hasCancel={true}
|
||||
onCancel={this.onCancelClick}
|
||||
onPrimaryButtonClick={this.onNextClick}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue