import React, { useState } from 'react'; import PropTypes from 'prop-types'; import './Settings.scss'; import initMatrix from '../../../client/initMatrix'; import settings from '../../../client/state/settings'; import { toggleMarkdown } from '../../../client/action/settings'; import Text from '../../atoms/text/Text'; import IconButton from '../../atoms/button/IconButton'; import Button from '../../atoms/button/Button'; import Toggle from '../../atoms/button/Toggle'; import SegmentedControls from '../../atoms/segmented-controls/SegmentedControls'; import PopupWindow, { PWContentSelector } from '../../molecules/popup-window/PopupWindow'; import SettingTile from '../../molecules/setting-tile/SettingTile'; import ProfileEditor from '../../molecules/profile-editor/ProfileEditor'; import ImportE2ERoomKeys from '../../molecules/import-e2e-room-keys/ImportE2ERoomKeys'; import GenIC from '../../../../public/res/ic/outlined/settings.svg'; import SunIC from '../../../../public/res/ic/outlined/sun.svg'; import LockIC from '../../../../public/res/ic/outlined/lock.svg'; import InfoIC from '../../../../public/res/ic/outlined/info.svg'; import CrossIC from '../../../../public/res/ic/outlined/cross.svg'; import CinnySVG from '../../../../public/res/svg/cinny.svg'; function GeneralSection() { return (
)} />
); } function AppearanceSection() { const [, updateState] = useState({}); return (
settings.setTheme(index)} /> )} /> { toggleMarkdown(isMarkdown); updateState({}); }} /> )} content={Format messages with markdown syntax before sending.} />
); } function SecuritySection() { return (
Use this device ID-key combo to verify or manage this session from Element client.} /> {'To decrypt older messages, Export E2EE room keys from Element (Settings > Security & Privacy > Encryption > Cryptography) and import them here. Imported keys are encrypted so you\'ll have to enter the password you set in order to decrypt it.'} )} />
); } function AboutSection() { return (
Cinny logo
Cinny v1.2.0 Yet another matrix client
); } function Settings({ isOpen, onRequestClose }) { const settingSections = [{ name: 'General', iconSrc: GenIC, render() { return ; }, }, { name: 'Appearance', iconSrc: SunIC, render() { return ; }, }, { name: 'Security & Privacy', iconSrc: LockIC, render() { return ; }, }, { name: 'Help & About', iconSrc: InfoIC, render() { return ; }, }]; const [selectedSection, setSelectedSection] = useState(settingSections[0]); return ( ( setSelectedSection(section)} iconSrc={section.iconSrc} > {section.name} )) } contentOptions={} > {selectedSection.render()} ); } Settings.propTypes = { isOpen: PropTypes.bool.isRequired, onRequestClose: PropTypes.func.isRequired, }; export default Settings;