From 23491a4dddfa290f3db6d013fba77003d0ca4c98 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 2 Feb 2022 15:23:11 +0530 Subject: [PATCH 1/3] refactor: sort icons alphabetically --- app/assets/javascripts/components/Icon.tsx | 198 ++++++++++----------- 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/app/assets/javascripts/components/Icon.tsx b/app/assets/javascripts/components/Icon.tsx index c5aa62cd2d8..670040cdba0 100644 --- a/app/assets/javascripts/components/Icon.tsx +++ b/app/assets/javascripts/components/Icon.tsx @@ -1,141 +1,139 @@ -import EditorIcon from '../../icons/ic-editor.svg'; -import PremiumFeatureIcon from '../../icons/ic-premium-feature.svg'; -import PencilOffIcon from '../../icons/ic-pencil-off.svg'; -import PlainTextIcon from '../../icons/ic-text-paragraph.svg'; -import RichTextIcon from '../../icons/ic-text-rich.svg'; -import TrashIcon from '../../icons/ic-trash.svg'; -import TrashFilledIcon from '../../icons/ic-trash-filled.svg'; -import PinIcon from '../../icons/ic-pin.svg'; -import PinFilledIcon from '../../icons/ic-pin-filled.svg'; -import UnpinIcon from '../../icons/ic-pin-off.svg'; +import AccessibilityIcon from '../../icons/ic-accessibility.svg'; +import AccountCircleIcon from '../../icons/ic-account-circle.svg'; +import AddIcon from '../../icons/ic-add.svg'; import ArchiveIcon from '../../icons/ic-archive.svg'; -import UnarchiveIcon from '../../icons/ic-unarchive.svg'; -import HashtagIcon from '../../icons/ic-hashtag.svg'; +import ArrowLeftIcon from '../../icons/ic-arrow-left.svg'; +import ArrowsSortDownIcon from '../../icons/ic-arrows-sort-down.svg'; +import ArrowsSortUpIcon from '../../icons/ic-arrows-sort-up.svg'; +import AuthenticatorIcon from '../../icons/ic-authenticator.svg'; +import CheckBoldIcon from '../../icons/ic-check-bold.svg'; +import CheckCircleIcon from '../../icons/ic-check-circle.svg'; +import CheckIcon from '../../icons/ic-check.svg'; +import ChevronDownIcon from '../../icons/ic-chevron-down.svg'; import ChevronRightIcon from '../../icons/ic-chevron-right.svg'; -import RestoreIcon from '../../icons/ic-restore.svg'; import CloseIcon from '../../icons/ic-close.svg'; -import PasswordIcon from '../../icons/ic-textbox-password.svg'; -import TrashSweepIcon from '../../icons/ic-trash-sweep.svg'; -import MoreIcon from '../../icons/ic-more.svg'; -import TuneIcon from '../../icons/ic-tune.svg'; -import UserSwitch from '../../icons/ic-user-switch.svg'; -import MenuArrowDownIcon from '../../icons/ic-menu-arrow-down.svg'; -import MenuCloseIcon from '../../icons/ic-menu-close.svg'; -import AuthenticatorIcon from '../../icons/ic-authenticator.svg'; -import SpreadsheetsIcon from '../../icons/ic-spreadsheets.svg'; -import TasksIcon from '../../icons/ic-tasks.svg'; -import MarkdownIcon from '../../icons/ic-markdown.svg'; -import NotesIcon from '../../icons/ic-notes.svg'; +import CloudOffIcon from '../../icons/ic-cloud-off.svg'; import CodeIcon from '../../icons/ic-code.svg'; - -import AccessibilityIcon from '../../icons/ic-accessibility.svg'; -import AddIcon from '../../icons/ic-add.svg'; +import CopyIcon from '../../icons/ic-copy.svg'; +import DownloadIcon from '../../icons/ic-download.svg'; +import EditorIcon from '../../icons/ic-editor.svg'; +import EmailIcon from '../../icons/ic-email.svg'; +import EyeIcon from '../../icons/ic-eye.svg'; +import EyeOffIcon from '../../icons/ic-eye-off.svg'; +import HashtagIcon from '../../icons/ic-hashtag.svg'; import HelpIcon from '../../icons/ic-help.svg'; +import InfoIcon from '../../icons/ic-info.svg'; import KeyboardIcon from '../../icons/ic-keyboard.svg'; +import LinkOffIcon from '../../icons/ic-link-off.svg'; import ListBulleted from '../../icons/ic-list-bulleted.svg'; import ListedIcon from '../../icons/ic-listed.svg'; +import LockFilledIcon from '../../icons/ic-lock-filled.svg'; +import LockIcon from '../../icons/ic-lock.svg'; +import MarkdownIcon from '../../icons/ic-markdown.svg'; +import MenuArrowDownAlt from '../../icons/ic-menu-arrow-down-alt.svg'; +import MenuArrowDownIcon from '../../icons/ic-menu-arrow-down.svg'; +import MenuArrowRight from '../../icons/ic-menu-arrow-right.svg'; +import MenuCloseIcon from '../../icons/ic-menu-close.svg'; +import MoreIcon from '../../icons/ic-more.svg'; +import NotesIcon from '../../icons/ic-notes.svg'; +import PasswordIcon from '../../icons/ic-textbox-password.svg'; +import PencilOffIcon from '../../icons/ic-pencil-off.svg'; +import PinFilledIcon from '../../icons/ic-pin-filled.svg'; +import PinIcon from '../../icons/ic-pin.svg'; +import PlainTextIcon from '../../icons/ic-text-paragraph.svg'; +import PremiumFeatureIcon from '../../icons/ic-premium-feature.svg'; +import RestoreIcon from '../../icons/ic-restore.svg'; +import RichTextIcon from '../../icons/ic-text-rich.svg'; import SecurityIcon from '../../icons/ic-security.svg'; +import ServerIcon from '../../icons/ic-server.svg'; import SettingsIcon from '../../icons/ic-settings.svg'; -import StarIcon from '../../icons/ic-star.svg'; -import ThemesIcon from '../../icons/ic-themes.svg'; -import UserIcon from '../../icons/ic-user.svg'; -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 AccountCircleIcon from '../../icons/ic-account-circle.svg'; -import CloudOffIcon from '../../icons/ic-cloud-off.svg'; import SignInIcon from '../../icons/ic-signin.svg'; import SignOutIcon from '../../icons/ic-signout.svg'; -import CheckCircleIcon from '../../icons/ic-check-circle.svg'; +import SpreadsheetsIcon from '../../icons/ic-spreadsheets.svg'; +import StarIcon from '../../icons/ic-star.svg'; import SyncIcon from '../../icons/ic-sync.svg'; -import ArrowLeftIcon from '../../icons/ic-arrow-left.svg'; -import ChevronDownIcon from '../../icons/ic-chevron-down.svg'; -import EmailIcon from '../../icons/ic-email.svg'; -import ServerIcon from '../../icons/ic-server.svg'; -import EyeIcon from '../../icons/ic-eye.svg'; -import EyeOffIcon from '../../icons/ic-eye-off.svg'; -import LockIcon from '../../icons/ic-lock.svg'; -import LockFilledIcon from '../../icons/ic-lock-filled.svg'; -import ArrowsSortUpIcon from '../../icons/ic-arrows-sort-up.svg'; -import ArrowsSortDownIcon from '../../icons/ic-arrows-sort-down.svg'; +import TasksIcon from '../../icons/ic-tasks.svg'; +import ThemesIcon from '../../icons/ic-themes.svg'; +import TrashFilledIcon from '../../icons/ic-trash-filled.svg'; +import TrashIcon from '../../icons/ic-trash.svg'; +import TrashSweepIcon from '../../icons/ic-trash-sweep.svg'; +import TuneIcon from '../../icons/ic-tune.svg'; +import UnarchiveIcon from '../../icons/ic-unarchive.svg'; +import UnpinIcon from '../../icons/ic-pin-off.svg'; +import UserIcon from '../../icons/ic-user.svg'; +import UserSwitch from '../../icons/ic-user-switch.svg'; import WindowIcon from '../../icons/ic-window.svg'; -import LinkOffIcon from '../../icons/ic-link-off.svg'; - -import MenuArrowDownAlt from '../../icons/ic-menu-arrow-down-alt.svg'; -import MenuArrowRight from '../../icons/ic-menu-arrow-right.svg'; import { FunctionalComponent } from 'preact'; import { IconType } from '@standardnotes/snjs'; const ICONS = { - editor: EditorIcon, - 'menu-arrow-down-alt': MenuArrowDownAlt, - 'menu-arrow-right': MenuArrowRight, - notes: NotesIcon, - 'arrows-sort-up': ArrowsSortUpIcon, - 'arrows-sort-down': ArrowsSortDownIcon, - lock: LockIcon, - 'lock-filled': LockFilledIcon, - eye: EyeIcon, - 'eye-off': EyeOffIcon, - server: ServerIcon, - email: EmailIcon, - 'chevron-down': ChevronDownIcon, + 'account-circle': AccountCircleIcon, 'arrow-left': ArrowLeftIcon, - sync: SyncIcon, + 'arrows-sort-down': ArrowsSortDownIcon, + 'arrows-sort-up': ArrowsSortUpIcon, + 'check-bold': CheckBoldIcon, 'check-circle': CheckCircleIcon, - signIn: SignInIcon, - signOut: SignOutIcon, + 'chevron-down': ChevronDownIcon, + 'chevron-right': ChevronRightIcon, 'cloud-off': CloudOffIcon, + 'eye-off': EyeOffIcon, + 'link-off': LinkOffIcon, + 'list-bulleted': ListBulleted, + 'lock-filled': LockFilledIcon, + 'menu-arrow-down-alt': MenuArrowDownAlt, + 'menu-arrow-down': MenuArrowDownIcon, + 'menu-arrow-right': MenuArrowRight, + 'menu-close': MenuCloseIcon, 'pencil-off': PencilOffIcon, + 'pin-filled': PinFilledIcon, 'plain-text': PlainTextIcon, + 'premium-feature': PremiumFeatureIcon, 'rich-text': RichTextIcon, - code: CodeIcon, - markdown: MarkdownIcon, - 'user-switch': UserSwitch, - authenticator: AuthenticatorIcon, - spreadsheets: SpreadsheetsIcon, - tasks: TasksIcon, - trash: TrashIcon, 'trash-filled': TrashFilledIcon, - pin: PinIcon, - 'pin-filled': PinFilledIcon, - unpin: UnpinIcon, - archive: ArchiveIcon, - unarchive: UnarchiveIcon, - hashtag: HashtagIcon, - 'chevron-right': ChevronRightIcon, - restore: RestoreIcon, - close: CloseIcon, - password: PasswordIcon, 'trash-sweep': TrashSweepIcon, - more: MoreIcon, - tune: TuneIcon, + 'user-switch': UserSwitch, accessibility: AccessibilityIcon, add: AddIcon, + archive: ArchiveIcon, + authenticator: AuthenticatorIcon, + check: CheckIcon, + close: CloseIcon, + code: CodeIcon, + copy: CopyIcon, + download: DownloadIcon, + editor: EditorIcon, + email: EmailIcon, + eye: EyeIcon, + hashtag: HashtagIcon, help: HelpIcon, + info: InfoIcon, keyboard: KeyboardIcon, - spellcheck: NotesIcon, - 'list-bulleted': ListBulleted, - 'link-off': LinkOffIcon, listed: ListedIcon, + lock: LockIcon, + markdown: MarkdownIcon, + more: MoreIcon, + notes: NotesIcon, + password: PasswordIcon, + pin: PinIcon, + restore: RestoreIcon, security: SecurityIcon, + server: ServerIcon, settings: SettingsIcon, + signIn: SignInIcon, + signOut: SignOutIcon, + spellcheck: NotesIcon, + spreadsheets: SpreadsheetsIcon, star: StarIcon, + sync: SyncIcon, + tasks: TasksIcon, themes: ThemesIcon, + trash: TrashIcon, + tune: TuneIcon, + unarchive: UnarchiveIcon, + unpin: UnpinIcon, user: UserIcon, - copy: CopyIcon, - download: DownloadIcon, - info: InfoIcon, - check: CheckIcon, - 'check-bold': CheckBoldIcon, - 'account-circle': AccountCircleIcon, - 'menu-arrow-down': MenuArrowDownIcon, - 'menu-close': MenuCloseIcon, window: WindowIcon, - 'premium-feature': PremiumFeatureIcon, }; type Props = { From 64a8eff079c70ddb2feacc068ad8f8699a1b4f1a Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 2 Feb 2022 17:52:19 +0530 Subject: [PATCH 2/3] chore: bump snjs version --- package.json | 2 +- yarn.lock | 39 ++++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index feb1eff8f6a..1e3a62787b0 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@reach/tooltip": "^0.16.2", "@standardnotes/components": "1.4.4", "@standardnotes/features": "1.26.1", - "@standardnotes/snjs": "2.48.0", + "@standardnotes/snjs": "2.49.0", "@standardnotes/settings": "^1.11.2", "@standardnotes/sncrypto-web": "1.6.2", "mobx": "^6.3.5", diff --git a/yarn.lock b/yarn.lock index 8b7e1b958b2..d83ec940fb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2615,15 +2615,15 @@ resolved "https://registry.yarnpkg.com/@standardnotes/components/-/components-1.4.4.tgz#2db82b5f35d34be8c766e22d8559e2b80a6aa996" integrity sha512-sxG5iIETpZUYVt6zQBTRxUC1qCZRmKyOuERyDLADju2gnGddDiLWU/TpgE7k8C/pLkw4OXprAmEVxbOagDrIxw== -"@standardnotes/domain-events@^2.21.0": - version "2.21.0" - resolved "https://registry.yarnpkg.com/@standardnotes/domain-events/-/domain-events-2.21.0.tgz#b9d7465c46f7c77c005fa3f40b7be94b3ce9170b" - integrity sha512-GhbQww8zODQx1WRjPo/9xIJjGlF1IAkejrXjqtLAGmiCkjYOBdzKNe3K8EAd1LWcMGgfF4NlLEkSyNOh1PpgRA== +"@standardnotes/domain-events@^2.21.2": + version "2.21.2" + resolved "https://registry.yarnpkg.com/@standardnotes/domain-events/-/domain-events-2.21.2.tgz#e28a0c1a65b09cf9712ce1efab279af33f68cae6" + integrity sha512-wZuTpgFFhV6CxwWHxU1Y0rtlR7SLZAccnT+GIbWk77WlkbdyJydpMIgcr5I94+9wFZuzMGA3SU+HyYbAE08ozg== dependencies: "@standardnotes/auth" "^3.15.3" - "@standardnotes/features" "^1.26.1" + "@standardnotes/features" "^1.27.0" -"@standardnotes/features@1.26.1", "@standardnotes/features@^1.26.1": +"@standardnotes/features@1.26.1": version "1.26.1" resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.26.1.tgz#d4e4aed2ba91e40c407484e569a96c339477bba2" integrity sha512-zxoeH9fjQtcTUbc5qaYD7AZETKDniM+tIvmLrWqwSC9B6/IL0R39G51BEkOzen+KhR/WgH3itHDVM+zrSMg53Q== @@ -2631,11 +2631,24 @@ "@standardnotes/auth" "^3.15.3" "@standardnotes/common" "^1.8.0" +"@standardnotes/features@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.27.0.tgz#eac735cafaa90f2d174fea65757034bfd841b056" + integrity sha512-RJXtBw5PCGNXuvUZDn1UJHQuF9+V0kZcGI4leWZJNRFDCQeuESOopVXvVIPCske/vUTHy8BGJttc2m9OatTlPw== + dependencies: + "@standardnotes/auth" "^3.15.3" + "@standardnotes/common" "^1.8.0" + "@standardnotes/settings@^1.11.2": version "1.11.2" resolved "https://registry.yarnpkg.com/@standardnotes/settings/-/settings-1.11.2.tgz#cb59d5bd9c7bb34c9d75381c51a438328faf5905" integrity sha512-yTNd7eTmo3KIeaZpAu8sh0xD/4JaVei1viJVW+is7yCAPX0bTxGnZm/qFVByW8jcox4YA7cIzixp3KMJf61COw== +"@standardnotes/settings@^1.11.3": + version "1.11.3" + resolved "https://registry.yarnpkg.com/@standardnotes/settings/-/settings-1.11.3.tgz#f7735da40807dab6eaf81cc82d8d30f5461d26d5" + integrity sha512-95nqPYIZt57HMrymf4FTMDHOibM13AmV/8JEj7mPbIqcNKvVD486BURsaqpoBgkqB4Q43LbT8dfTrBPDgmIdxg== + "@standardnotes/sncrypto-common@^1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@standardnotes/sncrypto-common/-/sncrypto-common-1.6.0.tgz#c6174adf65c778c8d53e45ea4c68087786f86b67" @@ -2650,16 +2663,16 @@ buffer "^6.0.3" libsodium-wrappers "^0.7.9" -"@standardnotes/snjs@2.48.0": - version "2.48.0" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.48.0.tgz#8ee65a3700bab06d7be30e225421a300b81d5d14" - integrity sha512-Q8YW6U0Fo/Wvw49cUlmnKMRRjw1vIYIc+jKvKsxgVFO4WCJljrfe9hMobOiEC93AVc7/ckyGBRsihsMu1AI+qQ== +"@standardnotes/snjs@2.49.0": + version "2.49.0" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.49.0.tgz#2e5e98bad959e39687e0cd29749423363c402f72" + integrity sha512-3okQKxj+LEwYfzUOeNQVdev9PL0YTaf7TaqLqVXsFPOngudwVt64QWTb7NfAyg0HI6D8jZFhbZDh9XDfR6x4/g== dependencies: "@standardnotes/auth" "^3.15.3" "@standardnotes/common" "^1.8.0" - "@standardnotes/domain-events" "^2.21.0" - "@standardnotes/features" "^1.26.1" - "@standardnotes/settings" "^1.11.2" + "@standardnotes/domain-events" "^2.21.2" + "@standardnotes/features" "^1.27.0" + "@standardnotes/settings" "^1.11.3" "@standardnotes/sncrypto-common" "^1.6.0" "@svgr/babel-plugin-add-jsx-attribute@^5.4.0": From f7c4d1fd496a60bc010fbf69741667a3dd75b77f Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 2 Feb 2022 17:53:07 +0530 Subject: [PATCH 3/3] feat: add check since ICONS wont have all IconType --- app/assets/javascripts/components/Icon.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/components/Icon.tsx b/app/assets/javascripts/components/Icon.tsx index 670040cdba0..8928b6d3dfb 100644 --- a/app/assets/javascripts/components/Icon.tsx +++ b/app/assets/javascripts/components/Icon.tsx @@ -147,7 +147,10 @@ export const Icon: FunctionalComponent = ({ className = '', ariaLabel, }) => { - const IconComponent = ICONS[type]; + const IconComponent = ICONS[type as keyof typeof ICONS]; + if (!IconComponent) { + return null; + } return (