From 43d94fbcbff4cf7f6bc2703d3c42852e9ffbd51b Mon Sep 17 00:00:00 2001 From: Mo Date: Tue, 3 May 2022 10:51:40 -0500 Subject: [PATCH] chore: prettier files --- .../Components/Abstract/PureComponent.tsx | 5 +- .../AccountMenu/ConfirmPassword.tsx | 6 +- .../Components/AccountMenu/CreateAccount.tsx | 13 +- .../AccountMenu/GeneralAccountMenu.tsx | 13 +- .../Components/AccountMenu/SignIn.tsx | 320 ++++++------ .../WorkspaceSwitcherOption.tsx | 102 ++-- .../Components/AccountMenu/index.tsx | 7 +- .../Components/Button/RoundIconButton.tsx | 7 +- .../ChallengeModal/ChallengeModal.tsx | 17 +- .../ChallengeModal/ChallengePrompt.tsx | 22 +- .../LockscreenWorkspaceSwitcher.tsx | 17 +- .../javascripts/Components/Checkbox/index.tsx | 8 +- .../Components/ComponentView/IsDeprecated.tsx | 9 +- .../ComponentView/OfflineRestricted.tsx | 14 +- .../Components/ComponentView/UrlMissing.tsx | 9 +- .../Components/ComponentView/index.tsx | 9 +- .../javascripts/Components/Dropdown/index.tsx | 30 +- .../javascripts/Components/Footer/index.tsx | 36 +- .../Components/Input/DecoratedInput.tsx | 4 +- .../Input/DecoratedPasswordInput.tsx | 12 +- .../javascripts/Components/Menu/Menu.tsx | 19 +- .../javascripts/Components/Menu/MenuItem.tsx | 14 +- .../MultipleSelectedNotes/index.tsx | 4 +- .../Components/Navigation/index.tsx | 7 +- .../Components/NoteView/NoteView.test.ts | 24 +- .../Components/NoteView/NoteView.tsx | 138 ++---- .../Components/NotesContextMenu/index.tsx | 4 +- .../NotesList/NotesListOptionsMenu.tsx | 32 +- .../NotesOptions/ListedActionsOption.tsx | 18 +- .../NotesOptions/NotesOptionsPanel.tsx | 134 +++-- .../Components/NotesView/index.tsx | 23 +- .../Components/OtherSessionsSignOut/index.tsx | 12 +- .../Components/PanelResizer/index.tsx | 18 +- .../Components/PasswordWizard/index.tsx | 45 +- .../Components/PermissionsModal/index.tsx | 5 +- .../Preferences/Panes/Account/Advanced.tsx | 45 +- .../Panes/Account/Authentication.tsx | 22 +- .../Account/ChangeEmail/ChangeEmailForm.tsx | 5 +- .../ChangeEmail/ChangeEmailSuccess.tsx | 4 +- .../Panes/Account/ChangeEmail/index.tsx | 19 +- .../Preferences/Panes/Account/Credentials.tsx | 17 +- .../Panes/Account/OfflineSubscription.tsx | 8 +- .../Preferences/Panes/Account/SignOutView.tsx | 6 +- .../Account/Subscription/NoSubscription.tsx | 16 +- .../Account/Subscription/Subscription.tsx | 51 +- .../Subscription/SubscriptionInformation.tsx | 88 ++-- .../Preferences/Panes/Account/Sync.tsx | 11 +- .../Preferences/Panes/Appearance.tsx | 20 +- .../CloudBackups/CloudBackupProvider.tsx | 13 +- .../Panes/Backups/CloudBackups/index.tsx | 33 +- .../Preferences/Panes/Backups/DataBackups.tsx | 29 +- .../Panes/Backups/EmailBackups.tsx | 21 +- .../Preferences/Panes/CloudLink.tsx | 51 +- .../Extensions/ConfirmCustomExtension.tsx | 21 +- .../Panes/Extensions/ExtensionItem.tsx | 20 +- .../Extensions/ExtensionsLatestVersions.ts | 5 +- .../Preferences/Panes/Extensions/index.tsx | 15 +- .../Preferences/Panes/General/Labs.tsx | 70 ++- .../Preferences/Panes/General/index.tsx | 6 +- .../Preferences/Panes/HelpFeedback.tsx | 51 +- .../Preferences/Panes/Listed/BlogItem.tsx | 6 +- .../Preferences/Panes/Listed/index.tsx | 4 +- .../Preferences/Panes/Security/Encryption.tsx | 7 +- .../Panes/Security/PasscodeLock.tsx | 54 +- .../Preferences/Panes/Security/Privacy.tsx | 14 +- .../Panes/Security/Protections.tsx | 23 +- .../Panes/TwoFactorAuth/AuthAppInfoPopup.tsx | 8 +- .../Panes/TwoFactorAuth/SaveSecretKey.tsx | 14 +- .../Panes/TwoFactorAuth/ScanQRCode.tsx | 24 +- .../TwoFactorAuth/TwoFactorActivation.ts | 7 +- .../Panes/TwoFactorAuth/TwoFactorAuth.ts | 13 +- .../Panes/TwoFactorAuth/TwoFactorAuthView.tsx | 7 +- .../Panes/TwoFactorAuth/TwoFactorSuccess.tsx | 11 +- .../Panes/TwoFactorAuth/Verification.tsx | 19 +- .../PreferencesComponents/Content.tsx | 14 +- .../PreferencesComponents/MenuItem.tsx | 8 +- .../PreferencesComponents/PreferencesPane.tsx | 4 +- .../Components/Preferences/PreferencesMenu.ts | 19 +- .../Preferences/PreferencesView.tsx | 14 +- .../Components/PremiumFeaturesModal/index.tsx | 4 +- .../PurchaseFlow/Panes/CreateAccount.tsx | 11 +- .../Components/PurchaseFlow/Panes/SignIn.tsx | 8 +- .../PurchaseFlow/PurchaseFlowView.tsx | 70 ++- .../PurchaseFlow/PurchaseFlowWrapper.tsx | 4 +- .../QuickSettingsMenu/EventHandlers.ts | 7 +- .../QuickSettingsMenu/FocusModeSwitch.tsx | 15 +- .../QuickSettingsMenu/ThemesMenuButton.tsx | 15 +- .../Components/QuickSettingsMenu/index.tsx | 469 ++++++++---------- .../HistoryListContainer.tsx | 50 +- .../RevisionHistoryModal/HistoryListItem.tsx | 14 +- .../LegacyHistoryList.tsx | 4 +- .../RemoteHistoryList.tsx | 12 +- .../RevisionContentLocked.tsx | 3 +- .../RevisionHistoryModalWrapper.tsx | 28 +- .../SelectedRevisionContent.tsx | 3 +- .../SessionHistoryList.tsx | 4 +- .../Components/RevisionHistoryModal/utils.ts | 13 +- .../Components/SearchOptions/index.tsx | 18 +- .../Components/SessionsModal/index.tsx | 8 +- .../Components/Shared/AccordionItem.tsx | 6 +- .../Components/Shared/ModalDialog.tsx | 16 +- .../javascripts/Components/Switch/index.tsx | 11 +- .../Components/SyncResolutionMenu/index.tsx | 10 +- .../TagAutocomplete/AutocompleteTagInput.tsx | 8 +- .../TagAutocomplete/AutocompleteTagResult.tsx | 8 +- .../Components/Tags/RootTagDropZone.tsx | 5 +- .../Components/Tags/SmartViewsList.tsx | 9 +- .../Components/Tags/SmartViewsListItem.tsx | 8 +- .../Components/Tags/TagContextMenu.tsx | 18 +- .../javascripts/Components/Tags/TagsList.tsx | 4 +- .../Components/Tags/TagsListItem.tsx | 465 +++++++++-------- .../Components/Tags/TagsSection.tsx | 6 +- .../Components/Tags/TagsSectionTitle.tsx | 56 +-- .../Hooks/useCloseOnClickOutside.ts | 5 +- .../Hooks/useListKeyboardNavigation.ts | 14 +- .../javascripts/Hooks/usePremiumModal.tsx | 52 +- .../javascripts/Services/ArchiveManager.ts | 8 +- .../javascripts/Services/ThemeManager.ts | 75 ++- app/assets/javascripts/Strings.ts | 27 +- .../javascripts/UIModels/AppState/AppState.ts | 13 +- .../AppState/NoAccountWarningState.ts | 4 +- .../UIModels/AppState/NoteTagsState.ts | 34 +- .../UIModels/AppState/NotesState.ts | 12 +- .../UIModels/AppState/NotesViewState.ts | 59 +-- .../UIModels/AppState/SubscriptionState.ts | 6 +- .../CalculateDifferenceBetweenDatesInDays.ts | 16 +- app/assets/javascripts/Utils/StringUtils.ts | 4 +- 127 files changed, 1365 insertions(+), 2428 deletions(-) diff --git a/app/assets/javascripts/Components/Abstract/PureComponent.tsx b/app/assets/javascripts/Components/Abstract/PureComponent.tsx index 6351b53bd..74041cef2 100644 --- a/app/assets/javascripts/Components/Abstract/PureComponent.tsx +++ b/app/assets/javascripts/Components/Abstract/PureComponent.tsx @@ -8,10 +8,7 @@ import { findDOMNode, unmountComponentAtNode } from 'preact/compat' export type PureComponentState = Partial> export type PureComponentProps = Partial> -export abstract class PureComponent< - P = PureComponentProps, - S = PureComponentState, -> extends Component { +export abstract class PureComponent

extends Component { private unsubApp!: () => void private unsubState!: () => void private reactionDisposers: IReactionDisposer[] = [] diff --git a/app/assets/javascripts/Components/AccountMenu/ConfirmPassword.tsx b/app/assets/javascripts/Components/AccountMenu/ConfirmPassword.tsx index db4065ebf..66afcc84e 100644 --- a/app/assets/javascripts/Components/AccountMenu/ConfirmPassword.tsx +++ b/app/assets/javascripts/Components/AccountMenu/ConfirmPassword.tsx @@ -107,10 +107,8 @@ export const ConfirmPassword: FunctionComponent = observer(

Because your notes are encrypted using your password,{' '} - - Standard Notes does not have a password reset option - - . If you forget your password, you will permanently lose access to your data. + Standard Notes does not have a password reset option. If you forget + your password, you will permanently lose access to your data.
= observer( ref={passwordInputRef} value={password} /> - - {isOpen && ( -
- -
- )} - - ) - }, -) + if (newMenuPosition) { + setMenuStyle(newMenuPosition) + } + }) + } + }, [isOpen]) + + return ( + <> + + {isOpen && ( +
+ +
+ )} + + ) +}) diff --git a/app/assets/javascripts/Components/AccountMenu/index.tsx b/app/assets/javascripts/Components/AccountMenu/index.tsx index cf4ae5772..d27726865 100644 --- a/app/assets/javascripts/Components/AccountMenu/index.tsx +++ b/app/assets/javascripts/Components/AccountMenu/index.tsx @@ -51,9 +51,7 @@ const MenuPaneSelector: FunctionComponent = observer( /> ) case AccountMenuPane.SignIn: - return ( - - ) + return case AccountMenuPane.Register: return ( = observer( export const AccountMenu: FunctionComponent = observer( ({ application, appState, onClickOutside, mainApplicationGroup }) => { - const { currentPane, setCurrentPane, shouldAnimateCloseMenu, closeAccountMenu } = - appState.accountMenu + const { currentPane, setCurrentPane, shouldAnimateCloseMenu, closeAccountMenu } = appState.accountMenu const ref = useRef(null) useCloseOnClickOutside(ref, () => { diff --git a/app/assets/javascripts/Components/Button/RoundIconButton.tsx b/app/assets/javascripts/Components/Button/RoundIconButton.tsx index ee3d20325..55882f655 100644 --- a/app/assets/javascripts/Components/Button/RoundIconButton.tsx +++ b/app/assets/javascripts/Components/Button/RoundIconButton.tsx @@ -21,12 +21,7 @@ interface Props { * IconButton component with an icon * preventDefault is already handled within the component */ -export const RoundIconButton: FunctionComponent = ({ - onClick, - type, - className, - icon: iconType, -}) => { +export const RoundIconButton: FunctionComponent = ({ onClick, type, className, icon: iconType }) => { const click = (e: MouseEvent) => { e.preventDefault() onClick() diff --git a/app/assets/javascripts/Components/ChallengeModal/ChallengeModal.tsx b/app/assets/javascripts/Components/ChallengeModal/ChallengeModal.tsx index bd1cdb627..d961747fe 100644 --- a/app/assets/javascripts/Components/ChallengeModal/ChallengeModal.tsx +++ b/app/assets/javascripts/Components/ChallengeModal/ChallengeModal.tsx @@ -34,10 +34,7 @@ type Props = { onDismiss: (challenge: Challenge) => Promise } -const validateValues = ( - values: ChallengeModalValues, - prompts: ChallengePrompt[], -): ChallengeModalValues | undefined => { +const validateValues = (values: ChallengeModalValues, prompts: ChallengePrompt[]): ChallengeModalValues | undefined => { let hasInvalidValues = false const validatedValues = { ...values } for (const prompt of prompts) { @@ -75,10 +72,9 @@ export const ChallengeModal: FunctionComponent = ({ const [isProcessing, setIsProcessing] = useState(false) const [, setProcessingPrompts] = useState([]) const [bypassModalFocusLock, setBypassModalFocusLock] = useState(false) - const shouldShowForgotPasscode = [ - ChallengeReason.ApplicationUnlock, - ChallengeReason.Migration, - ].includes(challenge.reason) + const shouldShowForgotPasscode = [ChallengeReason.ApplicationUnlock, ChallengeReason.Migration].includes( + challenge.reason, + ) const shouldShowWorkspaceSwitcher = challenge.reason === ChallengeReason.ApplicationUnlock const submit = async () => { @@ -268,10 +264,7 @@ export const ChallengeModal: FunctionComponent = ({ )} {shouldShowWorkspaceSwitcher && ( - + )} diff --git a/app/assets/javascripts/Components/ChallengeModal/ChallengePrompt.tsx b/app/assets/javascripts/Components/ChallengeModal/ChallengePrompt.tsx index 406962e4e..116c7a5f9 100644 --- a/app/assets/javascripts/Components/ChallengeModal/ChallengePrompt.tsx +++ b/app/assets/javascripts/Components/ChallengeModal/ChallengePrompt.tsx @@ -1,8 +1,4 @@ -import { - ChallengePrompt, - ChallengeValidation, - ProtectionSessionDurations, -} from '@standardnotes/snjs' +import { ChallengePrompt, ChallengeValidation, ProtectionSessionDurations } from '@standardnotes/snjs' import { FunctionComponent } from 'preact' import { useEffect, useRef } from 'preact/hooks' import { DecoratedInput } from '@/Components/Input/DecoratedInput' @@ -17,13 +13,7 @@ type Props = { isInvalid: boolean } -export const ChallengeModalPrompt: FunctionComponent = ({ - prompt, - values, - index, - onValueChange, - isInvalid, -}) => { +export const ChallengeModalPrompt: FunctionComponent = ({ prompt, values, index, onValueChange, isInvalid }) => { const inputRef = useRef(null) useEffect(() => { @@ -49,9 +39,7 @@ export const ChallengeModalPrompt: FunctionComponent = ({ return (