import React, { useCallback, useEffect, useState } from 'react'; import { getVersion } from '@tauri-apps/api/app'; 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 PaarrotSVG from '../../../../../public/res/svg/paarrot.svg'; import { clearCacheAndReload } from '../../../../client/initMatrix'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; type AboutProps = { requestClose: () => void; }; export function About({ requestClose }: AboutProps) { const mx = useMatrixClient(); const [version, setVersion] = useState(''); const [protocolStatus, setProtocolStatus] = useState('Checking desktop protocol integration...'); const [protocolBusy, setProtocolBusy] = useState(false); const formatProtocolStatus = useCallback((data: { scheme: string; platform: string; isDefault: boolean; registerCall: boolean; error: string | null; windows: null | { userChoiceProgId: string | null; userChoiceCommand: string | null; hkcuCommand: string | null; hklmCommand: string | null; }; }): string => { const state = data.isDefault ? 'registered' : 'not registered'; const startupState = data.registerCall ? 'ok' : 'no-change'; const owner = data.platform === 'win32' && data.windows?.userChoiceProgId ? ` Current default ProgId=${data.windows.userChoiceProgId}.` : ''; const missingHint = data.platform === 'win32' && !data.windows?.hkcuCommand && !data.windows?.hklmCommand ? ` ${data.scheme} link type is missing from Windows registry. Use Repair to create it.` : ''; const errorPart = data.error ? ` Error: ${data.error}` : ''; return `${data.scheme} is ${state} (startup=${startupState}) on ${data.platform}.${owner}${missingHint}${errorPart}`; }, []); const refreshProtocolStatus = useCallback(() => { if (!window.electron?.protocol?.getStatus) { setProtocolStatus('Desktop protocol diagnostics are unavailable in this environment.'); return; } window.electron.protocol .getStatus() .then((result) => { if (!result?.success || !result.data) { setProtocolStatus(result?.error ?? 'Unable to query protocol state.'); return; } setProtocolStatus(formatProtocolStatus(result.data)); }) .catch((error) => { setProtocolStatus(`Protocol diagnostics failed: ${error instanceof Error ? error.message : String(error)}`); }); }, [formatProtocolStatus]); const repairProtocolHandler = () => { if (!window.electron?.protocol?.repair) { setProtocolStatus('Protocol repair is unavailable in this environment.'); return; } setProtocolBusy(true); window.electron.protocol .repair() .then((result) => { if (!result?.success || !result.data) { setProtocolStatus(result?.error ?? 'Protocol repair failed.'); return; } setProtocolStatus(formatProtocolStatus(result.data)); setProtocolBusy(false); }) .catch((error) => { setProtocolStatus(`Protocol repair failed: ${error instanceof Error ? error.message : String(error)}`); setProtocolBusy(false); }); }; useEffect(() => { getVersion().then(setVersion).catch(() => setVersion('unknown')); refreshProtocolStatus(); }, [refreshProtocolStatus]); return ( About Paarrot logo Paarrot v{version} Squawk to yer mateys! Options clearCacheAndReload(mx)} variant="Secondary" fill="Soft" size="300" radii="300" outlined > Clear Cache } /> } /> 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 .
  • ); }