diff --git a/app/assets/icons/ic-check-bold.svg b/app/assets/icons/ic-check-bold.svg new file mode 100644 index 000000000..82c81e896 --- /dev/null +++ b/app/assets/icons/ic-check-bold.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/javascripts/components/DecoratedInput.tsx b/app/assets/javascripts/components/DecoratedInput.tsx index fed3ded66..9caeebfb1 100644 --- a/app/assets/javascripts/components/DecoratedInput.tsx +++ b/app/assets/javascripts/components/DecoratedInput.tsx @@ -38,13 +38,12 @@ export const DecoratedInput: FunctionalComponent = ({ const inputStateClasses = disabled ? 'overflow-ellipsis' : ''; return (
- {left?.map((leftChild, idx, arr) => ( + {left?.map((leftChild) => ( <> {leftChild} - {idx < arr.length - 1 &&
} +
))} - {left !== undefined &&
}
= ({ autocomplete={autocomplete ? 'on' : 'off'} />
- {right !== undefined &&
} - {right?.map((rightChild, idx, arr) => ( + {right?.map((rightChild) => ( <> +
{rightChild} - {idx < arr.length - 1 &&
} ))}
diff --git a/app/assets/javascripts/components/Icon.tsx b/app/assets/javascripts/components/Icon.tsx index 7814ba9b6..bbd43d7f0 100644 --- a/app/assets/javascripts/components/Icon.tsx +++ b/app/assets/javascripts/components/Icon.tsx @@ -27,6 +27,7 @@ import CopyIcon from '../../icons/ic-copy.svg'; import DownloadIcon from '../../icons/ic-download.svg'; import InfoIcon from '../../icons/ic-info.svg'; import CheckIcon from '../../icons/ic-check.svg'; +import CheckBoldIcon from '../../icons/ic-check-bold.svg'; import { toDirective } from './utils'; import { FunctionalComponent } from 'preact'; @@ -59,7 +60,8 @@ const ICONS = { copy: CopyIcon, download: DownloadIcon, info: InfoIcon, - check: CheckIcon + check: CheckIcon, + "check-bold": CheckBoldIcon, }; export type IconType = keyof typeof ICONS; diff --git a/app/assets/javascripts/preferences/PreferencesView.tsx b/app/assets/javascripts/preferences/PreferencesView.tsx index 9ed5cf152..3a9540196 100644 --- a/app/assets/javascripts/preferences/PreferencesView.tsx +++ b/app/assets/javascripts/preferences/PreferencesView.tsx @@ -35,6 +35,7 @@ const PaneSelector: FunctionComponent< ); case 'listed': diff --git a/app/assets/javascripts/preferences/panes/EndToEndEncryption.tsx b/app/assets/javascripts/preferences/panes/EndToEndEncryption.tsx new file mode 100644 index 000000000..41cc557e2 --- /dev/null +++ b/app/assets/javascripts/preferences/panes/EndToEndEncryption.tsx @@ -0,0 +1,40 @@ +import { DecoratedInput } from "@/components/DecoratedInput"; +import { Icon } from "@/components/Icon"; +import { AppState } from "@/ui_models/app_state"; +import { observer } from "mobx-react-lite"; +import { FunctionComponent } from "preact"; +import { PreferencesGroup, PreferencesSegment, Text, Title } from "../components"; + +const formatCount = (count: number, itemType: string) => `${count} / ${count} ${itemType}`; + +export const EndToEndEncryption: FunctionComponent<{ appState: AppState }> = observer(({ appState }) => { + const count = appState.accountMenu.structuredNotesAndTagsCount; + const notes = formatCount(count.notes, 'notes'); + const tags = formatCount(count.tags, 'tags'); + const archived = formatCount(count.archived, 'archived notes'); + const deleted = formatCount(count.deleted, 'trashed notes'); + + const checkIcon = ; + const noteIcon = ; + const tagIcon = ; + const archiveIcon = ; + const trashIcon = ; + return ( + + + End-to-end encryption + Your data is encrypted before syncing to your private account. +
+ +
+ +
+
+ +
+ +
+ + + ); +}); diff --git a/app/assets/javascripts/preferences/panes/Security.tsx b/app/assets/javascripts/preferences/panes/Security.tsx index a0269a269..4d6cae15a 100644 --- a/app/assets/javascripts/preferences/panes/Security.tsx +++ b/app/assets/javascripts/preferences/panes/Security.tsx @@ -1,10 +1,17 @@ +import { AppState } from '@/ui_models/app_state'; import { FunctionComponent } from 'preact'; import { PreferencesPane } from '../components'; +import { EndToEndEncryption } from './EndToEndEncryption'; import { TwoFactorAuthWrapper } from './two-factor-auth'; import { MfaProps } from './two-factor-auth/MfaProps'; -export const Security: FunctionComponent = (props) => ( +interface SecurityProps extends MfaProps { + appState: AppState; +} + +export const Security: FunctionComponent = (props) => ( +