import React, { useEffect, useState } from 'react'; import { Box, Text, IconButton, Icon, Icons, Scroll, Button, config, toRem } from 'folds'; import { Page, PageContent, PageHeader } from '../../../components/page'; import { SequenceCard } from '../../../components/sequence-card'; import { SequenceCardStyle } from '../styles.css'; import { SettingTile } from '../../../components/setting-tile'; import LotusLogo from '../../../../../public/res/Lotus.png'; import pkg from '../../../../../package.json'; import { clearCacheAndReload } from '../../../../client/initMatrix'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; import { lotusTerminalBodyClass } from '../../../../lotus-terminal.css'; type MSC1929Contact = { matrix_id?: string; email_address?: string; role?: string; }; type MSC1929Support = { contacts?: MSC1929Contact[]; support_page?: string; }; function useServerSupport(): MSC1929Support | null { const mx = useMatrixClient(); const [support, setSupport] = useState(null); useEffect(() => { const baseUrl = (mx as unknown as { baseUrl: string }).baseUrl; fetch(`${baseUrl}/.well-known/matrix/support`) .then((res) => { if (!res.ok) return null; return res.json() as Promise; }) .then((data) => { if (data && (data.contacts?.length || data.support_page)) { setSupport(data); } }) .catch(() => { // Graceful degradation — server may not have this configured }); }, [mx]); return support; } type AboutProps = { requestClose: () => void; }; export function About({ requestClose }: AboutProps) { const mx = useMatrixClient(); const serverSupport = useServerSupport(); return ( About Lotus Chat logo Lotus Chat v{pkg.version} A Matrix client for Lotus Guild. Options clearCacheAndReload(mx)} variant="Secondary" fill="Soft" size="300" radii="300" outlined > Clear Cache } /> {serverSupport && ( Homeserver Support {serverSupport.contacts && serverSupport.contacts.length > 0 && ( {serverSupport.contacts.map((contact, i) => ( {contact.role === 'm.role.admin' ? 'Admin' : contact.role === 'm.role.security' ? 'Security' : 'Contact'} : {contact.matrix_id ?? contact.email_address ?? ''} ))} )} {serverSupport.support_page && ( Support Page: {serverSupport.support_page} )} )} Credits
  • The{' '} matrix-js-sdk {' '} is ©{' '} The Matrix.org Foundation C.I.C {' '} used under the terms of{' '} Apache 2.0 .
  • The{' '} twemoji-colr {' '} font is ©{' '} Mozilla Foundation {' '} used under the terms of{' '} Apache 2.0 .
  • The{' '} Twemoji {' '} emoji art is ©{' '} Twitter, Inc and other contributors {' '} used under the terms of{' '} CC-BY 4.0 .
  • The{' '} Material sound resources {' '} are ©{' '} Google {' '} used under the terms of{' '} CC-BY 4.0 .
  • ); }