2022-04-21 23:55:26 +02:00
|
|
|
import { h, Component } from '/js/web_modules/preact.js';
|
|
|
|
import htm from '/js/web_modules/htm.js';
|
|
|
|
import TabBar from './tab-bar.js';
|
|
|
|
import IndieAuthForm from './auth-indieauth.js';
|
2022-04-23 02:23:14 +02:00
|
|
|
import FediverseAuth from './auth-fediverse.js';
|
2022-04-21 23:55:26 +02:00
|
|
|
|
|
|
|
const html = htm.bind(h);
|
|
|
|
|
|
|
|
export default class ChatSettingsModal extends Component {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
accessToken,
|
|
|
|
authenticated,
|
2022-04-23 02:23:14 +02:00
|
|
|
federationEnabled,
|
2022-04-21 23:55:26 +02:00
|
|
|
username,
|
|
|
|
indieAuthEnabled,
|
|
|
|
} = this.props;
|
|
|
|
|
2022-04-23 02:23:14 +02:00
|
|
|
const TAB_CONTENT = [];
|
|
|
|
if (indieAuthEnabled) {
|
|
|
|
TAB_CONTENT.push({
|
2022-04-21 23:55:26 +02:00
|
|
|
label: html`<span style=${{ display: 'flex', alignItems: 'center' }}
|
|
|
|
><img
|
|
|
|
style=${{
|
|
|
|
display: 'inline',
|
|
|
|
height: '0.8em',
|
|
|
|
marginRight: '5px',
|
|
|
|
}}
|
|
|
|
src="/img/indieauth.png"
|
|
|
|
/>
|
|
|
|
IndieAuth</span
|
|
|
|
>`,
|
|
|
|
content: html`<${IndieAuthForm}}
|
|
|
|
accessToken=${accessToken}
|
|
|
|
authenticated=${authenticated}
|
2022-04-23 02:23:14 +02:00
|
|
|
username=${username}
|
2022-04-21 23:55:26 +02:00
|
|
|
/>`,
|
2022-04-23 02:23:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (federationEnabled) {
|
|
|
|
TAB_CONTENT.push({
|
|
|
|
label: html`<span style=${{ display: 'flex', alignItems: 'center' }}
|
|
|
|
><img
|
|
|
|
style=${{
|
|
|
|
display: 'inline',
|
|
|
|
height: '0.8em',
|
|
|
|
marginRight: '5px',
|
|
|
|
}}
|
|
|
|
src="/img/fediverse-black.png"
|
|
|
|
/>
|
|
|
|
FediAuth</span
|
|
|
|
>`,
|
|
|
|
content: html`<${FediverseAuth}}
|
|
|
|
authenticated=${authenticated}
|
|
|
|
accessToken=${accessToken}
|
|
|
|
authenticated=${authenticated}
|
|
|
|
username=${username}
|
|
|
|
/>`,
|
|
|
|
});
|
|
|
|
}
|
2022-04-21 23:55:26 +02:00
|
|
|
|
|
|
|
return html`
|
|
|
|
<div class="bg-gray-100 bg-center bg-no-repeat p-5">
|
|
|
|
<${TabBar} tabs=${TAB_CONTENT} ariaLabel="Chat settings" />
|
2022-04-23 02:23:14 +02:00
|
|
|
<p class="mt-4">
|
|
|
|
<b>Note:</b> This is for authentication purposes only, and no personal
|
|
|
|
information will be accessed or stored.
|
|
|
|
</p>
|
2022-04-21 23:55:26 +02:00
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|