diff --git a/app/assets/javascripts/preferences/components/Content.tsx b/app/assets/javascripts/preferences/components/Content.tsx index 84cdae4d18c..a754c3d4d4c 100644 --- a/app/assets/javascripts/preferences/components/Content.tsx +++ b/app/assets/javascripts/preferences/components/Content.tsx @@ -4,8 +4,8 @@ export const Title: FunctionComponent = ({ children }) => (

{children}

); -export const Subtitle: FunctionComponent = ({ children }) => ( -

{children}

+export const Subtitle: FunctionComponent<{ className?: string }> = ({ children, className = "" }) => ( +

{children}

); export const Text: FunctionComponent<{ className?: string }> = ({ diff --git a/app/assets/javascripts/preferences/components/PreferencesPane.tsx b/app/assets/javascripts/preferences/components/PreferencesPane.tsx index bfe2e4572a0..257ce4f73b4 100644 --- a/app/assets/javascripts/preferences/components/PreferencesPane.tsx +++ b/app/assets/javascripts/preferences/components/PreferencesPane.tsx @@ -6,13 +6,13 @@ export const PreferencesPane: FunctionComponent = ({ children }) => (
{children != undefined && Array.isArray(children) ? children - .filter((child) => child != undefined) - .map((child) => ( - <> - {child} -
- - )) + .filter((child) => child != undefined) + .map((child) => ( + <> + {child} +
+ + )) : children}
diff --git a/app/assets/javascripts/preferences/panes/AccountPreferences.tsx b/app/assets/javascripts/preferences/panes/AccountPreferences.tsx index 1af8bc6f3ca..6d27c63cf23 100644 --- a/app/assets/javascripts/preferences/panes/AccountPreferences.tsx +++ b/app/assets/javascripts/preferences/panes/AccountPreferences.tsx @@ -3,6 +3,7 @@ import { SubscriptionWrapper, Credentials, LogOutWrapper, + Authentication, } from '@/preferences/panes/account'; import { PreferencesPane } from '@/preferences/components'; import { observer } from 'mobx-react-lite'; @@ -16,6 +17,17 @@ type Props = { export const AccountPreferences = observer( ({ application, appState }: Props) => { + const isLoggedIn = application.getUser(); + + if (!isLoggedIn) { + return ( + + + + + ); + } + return ( diff --git a/app/assets/javascripts/preferences/panes/account/Authentication.tsx b/app/assets/javascripts/preferences/panes/account/Authentication.tsx new file mode 100644 index 00000000000..d98fc839ec9 --- /dev/null +++ b/app/assets/javascripts/preferences/panes/account/Authentication.tsx @@ -0,0 +1,41 @@ +import { Button } from "@/components/Button"; +import { PreferencesGroup, PreferencesSegment, Subtitle, Text, Title } from "@/preferences/components"; +import { WebApplication } from "@/ui_models/application"; +import { AppState } from "@/ui_models/app_state"; +import { observer } from "mobx-react-lite"; +import { FunctionComponent } from "preact"; + +export const Authentication: FunctionComponent<{ application: WebApplication, appState: AppState }> = + observer(({ appState }) => { + + const clickSignIn = () => { + appState.preferences.closePreferences(); + appState.accountMenu.setShowLogin(true); + appState.accountMenu.setShow(true); + }; + + const clickRegister = () => { + appState.preferences.closePreferences(); + appState.accountMenu.setShowRegister(true); + appState.accountMenu.setShow(true); + }; + + return ( + + +
+ You're not signed in + Sign in to sync your notes and preferences across all your devices and enable end-to-end encryption. +
+
+
+
+ Standard Notes is free on every platform, and comes standard with sync and encryption. +
+ + + ); + }); diff --git a/app/assets/javascripts/preferences/panes/account/Credentials.tsx b/app/assets/javascripts/preferences/panes/account/Credentials.tsx index 4ba981a53f7..ff7e092907e 100644 --- a/app/assets/javascripts/preferences/panes/account/Credentials.tsx +++ b/app/assets/javascripts/preferences/panes/account/Credentials.tsx @@ -7,12 +7,13 @@ import { dateToLocalizedString } from '@/utils'; import { useState } from 'preact/hooks'; import { ChangeEmail } from '@/preferences/panes/account/changeEmail'; import { PasswordWizardType } from '@/types'; +import { FunctionComponent } from 'preact'; type Props = { application: WebApplication; }; -export const Credentials = observer(({ application }: Props) => { +export const Credentials: FunctionComponent = observer(({ application }: Props) => { const [isChangeEmailDialogOpen, setIsChangeEmailDialogOpen] = useState(false); const user = application.getUser(); diff --git a/app/assets/javascripts/preferences/panes/account/Sync.tsx b/app/assets/javascripts/preferences/panes/account/Sync.tsx index 192b1802210..89d730cb608 100644 --- a/app/assets/javascripts/preferences/panes/account/Sync.tsx +++ b/app/assets/javascripts/preferences/panes/account/Sync.tsx @@ -6,12 +6,13 @@ import { useState } from '@node_modules/preact/hooks'; import { dateToLocalizedString } from '@/utils'; import { observer } from '@node_modules/mobx-react-lite'; import { WebApplication } from '@/ui_models/application'; +import { FunctionComponent } from 'preact'; type Props = { application: WebApplication; }; -export const Sync = observer(({ application }: Props) => { +export const Sync: FunctionComponent = observer(({ application }: Props) => { const formatLastSyncDate = (lastUpdatedDate: Date) => { return dateToLocalizedString(lastUpdatedDate); }; diff --git a/app/assets/javascripts/preferences/panes/account/index.ts b/app/assets/javascripts/preferences/panes/account/index.ts index 2fd73c04ce9..51ad45922c9 100644 --- a/app/assets/javascripts/preferences/panes/account/index.ts +++ b/app/assets/javascripts/preferences/panes/account/index.ts @@ -2,3 +2,4 @@ export { SubscriptionWrapper } from './subscription/SubscriptionWrapper'; export { Sync } from './Sync'; export { Credentials } from './Credentials'; export { LogOutWrapper } from './LogOutView'; +export { Authentication } from './Authentication'; diff --git a/app/assets/javascripts/preferences/panes/account/subscription/Subscription.tsx b/app/assets/javascripts/preferences/panes/account/subscription/Subscription.tsx index 4f159cb0c45..a063d1a06b8 100644 --- a/app/assets/javascripts/preferences/panes/account/subscription/Subscription.tsx +++ b/app/assets/javascripts/preferences/panes/account/subscription/Subscription.tsx @@ -10,13 +10,14 @@ import { SubscriptionInformation } from './SubscriptionInformation'; import { NoSubscription } from './NoSubscription'; import { Text } from '@/preferences/components'; import { observer } from 'mobx-react-lite'; +import { FunctionComponent } from 'preact'; type Props = { application: WebApplication; subscriptionState: SubscriptionState; }; -export const Subscription = observer(({ +export const Subscription: FunctionComponent = observer(({ application, subscriptionState, }: Props) => { diff --git a/app/assets/stylesheets/_sn.scss b/app/assets/stylesheets/_sn.scss index 6a79eec9594..c066f10b610 100644 --- a/app/assets/stylesheets/_sn.scss +++ b/app/assets/stylesheets/_sn.scss @@ -247,6 +247,11 @@ padding-right: 2.25rem; } +.px-12 { + padding-left: 3rem; + padding-right: 3rem; +} + .py-9 { padding-top: 2.25rem; padding-bottom: 2.25rem;