From 4ff23c77e8860bd47fd74fd0d639f0fbe13ea03e Mon Sep 17 00:00:00 2001 From: mkljczk Date: Thu, 5 Dec 2024 16:31:23 +0100 Subject: [PATCH] pl-fe: optimize initial js size Signed-off-by: mkljczk --- .../pl-fe/src/components/account-hover-card.tsx | 2 +- packages/pl-fe/src/components/account.tsx | 2 +- .../announcements/announcements-panel.tsx | 2 +- .../src/components/announcements/reaction.tsx | 4 ++-- .../pl-fe/src/components/autosuggest-input.tsx | 2 +- packages/pl-fe/src/components/avatar-stack.tsx | 2 +- packages/pl-fe/src/components/big-card.tsx | 2 +- .../dropdown-menu/dropdown-menu-item.tsx | 4 ++-- .../components/dropdown-menu/dropdown-menu.tsx | 4 ++-- packages/pl-fe/src/components/event-preview.tsx | 4 ++-- packages/pl-fe/src/components/group-card.tsx | 4 ++-- .../components/groups/popover/group-popover.tsx | 4 ++-- packages/pl-fe/src/components/hashtags-bar.tsx | 2 +- .../pl-fe/src/components/landing-gradient.tsx | 2 +- packages/pl-fe/src/components/link.tsx | 2 +- packages/pl-fe/src/components/list.tsx | 2 +- packages/pl-fe/src/components/mention.tsx | 2 +- packages/pl-fe/src/components/modal-root.tsx | 2 +- packages/pl-fe/src/components/navlinks.tsx | 2 +- packages/pl-fe/src/components/parsed-content.tsx | 2 +- .../pl-fe/src/components/pending-items-row.tsx | 2 +- .../pl-fe/src/components/polls/poll-option.tsx | 10 +++++----- packages/pl-fe/src/components/radio.tsx | 2 +- .../pl-fe/src/components/scroll-top-button.tsx | 2 +- packages/pl-fe/src/components/sidebar-menu.tsx | 12 ++++++------ .../pl-fe/src/components/site-error-boundary.tsx | 8 ++++---- .../src/components/status-action-button.tsx | 2 +- .../pl-fe/src/components/status-hover-card.tsx | 2 +- packages/pl-fe/src/components/status-mention.tsx | 2 +- .../src/components/status-reactions-bar.tsx | 2 +- .../src/components/status-reply-mentions.tsx | 2 +- packages/pl-fe/src/components/status.tsx | 4 ++-- .../src/components/statuses/status-info.tsx | 2 +- .../pl-fe/src/components/thumb-navigation.tsx | 6 +++--- packages/pl-fe/src/components/trending-link.tsx | 2 +- packages/pl-fe/src/components/ui/accordion.tsx | 2 +- packages/pl-fe/src/components/ui/card.tsx | 2 +- packages/pl-fe/src/components/ui/checkbox.tsx | 2 +- packages/pl-fe/src/components/ui/counter.tsx | 2 +- packages/pl-fe/src/components/ui/divider.tsx | 4 ++-- packages/pl-fe/src/components/ui/form-group.tsx | 4 ++-- packages/pl-fe/src/components/ui/icon-button.tsx | 2 +- .../src/components/ui/inline-multiselect.tsx | 4 ++-- packages/pl-fe/src/components/ui/input.tsx | 4 ++-- packages/pl-fe/src/components/ui/layout.tsx | 2 +- packages/pl-fe/src/components/ui/modal.tsx | 8 ++++---- packages/pl-fe/src/components/ui/popover.tsx | 4 ++-- .../pl-fe/src/components/ui/progress-bar.tsx | 4 ++-- packages/pl-fe/src/components/ui/select.tsx | 2 +- packages/pl-fe/src/components/ui/slider.tsx | 6 +++--- packages/pl-fe/src/components/ui/tabs.tsx | 4 ++-- packages/pl-fe/src/components/ui/tag-input.tsx | 2 +- packages/pl-fe/src/components/ui/tag.tsx | 2 +- packages/pl-fe/src/components/ui/textarea.tsx | 2 +- packages/pl-fe/src/components/ui/toast.tsx | 8 ++++---- packages/pl-fe/src/components/ui/toggle.tsx | 2 +- packages/pl-fe/src/components/ui/widget.tsx | 2 +- .../pl-fe/src/components/verification-badge.tsx | 4 ++-- packages/pl-fe/src/features/about/index.tsx | 2 +- .../account-timeline/components/moved-note.tsx | 2 +- .../src/features/account/components/header.tsx | 8 ++++---- .../pl-fe/src/features/admin/announcements.tsx | 2 +- .../src/features/admin/components/report.tsx | 2 +- packages/pl-fe/src/features/admin/domains.tsx | 2 +- packages/pl-fe/src/features/admin/relays.tsx | 2 +- packages/pl-fe/src/features/admin/rules.tsx | 2 +- .../src/features/aliases/components/search.tsx | 2 +- packages/pl-fe/src/features/audio/index.tsx | 4 ++-- .../auth-login/components/consumers-list.tsx | 2 +- .../pl-fe/src/features/auth-token-list/index.tsx | 2 +- packages/pl-fe/src/features/backups/index.tsx | 2 +- .../features/chats/components/chat-composer.tsx | 4 ++-- .../features/chats/components/chat-list-item.tsx | 4 ++-- .../src/features/chats/components/chat-list.tsx | 4 ++-- .../chats/components/chat-page/chat-page.tsx | 6 +++--- .../chats/components/chat-pending-upload.tsx | 2 +- .../chats/components/chat-search/results.tsx | 4 ++-- .../features/chats/components/chat-textarea.tsx | 16 ++++++++-------- .../features/chats/components/chat-upload.tsx | 4 ++-- .../components/chat-widget/chat-pane-header.tsx | 2 +- .../components/chat-widget/chat-settings.tsx | 6 +++--- .../chats/components/chat-widget/chat-window.tsx | 2 +- .../chat-widget/headers/chat-search-header.tsx | 2 +- .../src/features/chats/components/ui/pane.tsx | 2 +- packages/pl-fe/src/features/circle/index.tsx | 2 +- .../compose-event/components/upload-button.tsx | 2 +- .../features/compose-event/tabs/edit-event.tsx | 4 ++-- .../features/compose/components/compose-form.tsx | 2 +- .../compose/components/language-dropdown.tsx | 2 +- .../compose/components/reply-indicator.tsx | 2 +- .../compose/components/reply-mentions.tsx | 2 +- .../plugins/floating-link-editor-plugin.tsx | 2 +- .../floating-text-format-toolbar-plugin.tsx | 4 ++-- .../crypto-donate/components/crypto-address.tsx | 3 +-- .../components/detailed-crypto-address.tsx | 3 +-- .../directory/components/account-card.tsx | 4 ++-- .../edit-profile/components/avatar-picker.tsx | 2 +- .../edit-profile/components/header-picker.tsx | 2 +- .../pl-fe/src/features/embedded-status/index.tsx | 2 +- .../features/event/components/event-header.tsx | 6 +++--- .../src/features/event/event-discussion.tsx | 2 +- .../src/features/event/event-information.tsx | 4 ++-- packages/pl-fe/src/features/filters/index.tsx | 2 +- .../features/group/components/group-header.tsx | 8 ++++---- .../pl-fe/src/features/group/group-timeline.tsx | 2 +- .../src/features/hashtag-timeline/index.tsx | 2 +- .../pl-fe/src/features/home-timeline/index.tsx | 2 +- .../src/features/interaction-requests/index.tsx | 6 +++--- .../landing-timeline/components/logo-text.tsx | 2 +- packages/pl-fe/src/features/migration/index.tsx | 2 +- .../notifications/components/notification.tsx | 2 +- .../pl-fe/src/features/notifications/index.tsx | 2 +- .../onboarding/steps/avatar-selection-step.tsx | 2 +- .../features/onboarding/steps/completed-step.tsx | 2 +- .../steps/cover-photo-selection-step.tsx | 4 ++-- .../features/onboarding/steps/fediverse-step.tsx | 6 +++--- .../onboarding/steps/suggested-accounts-step.tsx | 2 +- .../pl-fe-config/components/icon-picker-menu.tsx | 4 ++-- .../pl-fe-config/components/site-preview.tsx | 2 +- .../components/placeholder-avatar.tsx | 4 ++-- .../placeholder/components/placeholder-card.tsx | 2 +- .../components/placeholder-chat-message.tsx | 4 ++-- .../components/placeholder-display-name.tsx | 2 +- .../components/placeholder-event-header.tsx | 2 +- .../components/placeholder-event-preview.tsx | 4 ++-- .../components/placeholder-group-card.tsx | 4 ++-- .../components/placeholder-group-search.tsx | 2 +- .../components/placeholder-hashtag.tsx | 2 +- .../components/placeholder-media-gallery.tsx | 2 +- .../components/placeholder-notification.tsx | 2 +- .../placeholder-sidebar-suggestions.tsx | 2 +- .../components/placeholder-sidebar-trends.tsx | 2 +- .../components/placeholder-status-content.tsx | 2 +- .../pl-fe/src/features/public-timeline/index.tsx | 2 +- .../components/pinned-hosts-picker.tsx | 2 +- .../src/features/search/components/search.tsx | 2 +- .../status/components/detailed-status.tsx | 2 +- .../features/status/components/thread-status.tsx | 2 +- .../src/features/status/components/thread.tsx | 6 +++--- .../features/ui/components/background-shapes.tsx | 2 +- .../features/ui/components/column-forbidden.tsx | 2 +- .../components/modals/compare-history-modal.tsx | 2 +- .../ui/components/modals/compose-modal.tsx | 2 +- .../ui/components/modals/dropdown-menu-modal.tsx | 2 +- .../modals/edit-bookmark-folder-modal.tsx | 2 +- .../ui/components/modals/hotkeys-modal.tsx | 2 +- .../steps/confirmation-step.tsx | 6 +++--- .../report-modal/steps/confirmation-step.tsx | 2 +- .../modals/report-modal/steps/reason-step.tsx | 2 +- .../features/ui/components/profile-dropdown.tsx | 6 +++--- packages/pl-fe/src/features/ui/index.tsx | 2 +- .../src/features/ui/util/async-components.ts | 2 ++ packages/pl-fe/src/features/video/index.tsx | 2 +- packages/pl-fe/src/init/pl-fe-head.tsx | 2 +- packages/pl-fe/src/layouts/chats-layout.tsx | 2 +- packages/pl-fe/src/layouts/home-layout.tsx | 4 ++-- packages/pl-fe/src/layouts/landing-layout.tsx | 2 +- packages/pl-fe/vite.config.ts | 2 +- 158 files changed, 242 insertions(+), 242 deletions(-) diff --git a/packages/pl-fe/src/components/account-hover-card.tsx b/packages/pl-fe/src/components/account-hover-card.tsx index 1286f798a..5c721f950 100644 --- a/packages/pl-fe/src/components/account-hover-card.tsx +++ b/packages/pl-fe/src/components/account-hover-card.tsx @@ -124,7 +124,7 @@ const AccountHoverCard: React.FC = ({ visible = true }) => { onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} > - + = ({ account, disabled }) => { return ( diff --git a/packages/pl-fe/src/components/autosuggest-input.tsx b/packages/pl-fe/src/components/autosuggest-input.tsx index 1fc057963..5756a59be 100644 --- a/packages/pl-fe/src/components/autosuggest-input.tsx +++ b/packages/pl-fe/src/components/autosuggest-input.tsx @@ -217,7 +217,7 @@ const AutosuggestInput: React.FC = ({ return menu.map((item, i) => ( = ({ accountIds, limit = 3 }) => { style={{ zIndex: limit - i }} > = ({ title, subtitle, children }) => ( -
+
{title} {subtitle && {subtitle}} diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx index 8e0390a8d..3e7e4b268 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx @@ -100,7 +100,7 @@ const DropdownMenuItem = ({ index, item, onClick, autoFocus, onSetTab }: IDropdo } return ( -
  • +
  • { } const getClassName = () => { - const className = clsx('z-[1001] bg-white py-1 shadow-lg ease-in-out focus:outline-none black:bg-black no-reduce-motion:transition-all dark:bg-gray-900 dark:ring-2 dark:ring-primary-700', { + const className = clsx('black:bg-black no-reduce-motion:transition-all dark:ring-primary-700 z-[1001] bg-white py-1 shadow-lg ease-in-out focus:outline-none dark:bg-gray-900 dark:ring-2', { 'rounded-md min-w-56 max-w-sm duration-100': true, 'no-reduce-motion:scale-0': !(isDisplayed && isOpen), 'scale-100': isDisplayed && isOpen, @@ -371,7 +371,7 @@ const DropdownMenu = (props: IDropdownMenu) => {
  • diff --git a/packages/pl-fe/src/components/event-preview.tsx b/packages/pl-fe/src/components/event-preview.tsx index 3d457cbad..ae33e35ac 100644 --- a/packages/pl-fe/src/components/event-preview.tsx +++ b/packages/pl-fe/src/components/event-preview.tsx @@ -54,11 +54,11 @@ const EventPreview: React.FC = ({ status, className, hideAction, )); return ( -
    +
    {floatingAction && action}
    -
    +
    {banner && {intl.formatMessage(messages.eventBanner)}}
    diff --git a/packages/pl-fe/src/components/group-card.tsx b/packages/pl-fe/src/components/group-card.tsx index 1a384169a..db067ebf1 100644 --- a/packages/pl-fe/src/components/group-card.tsx +++ b/packages/pl-fe/src/components/group-card.tsx @@ -19,11 +19,11 @@ interface IGroupCard { const GroupCard: React.FC = ({ group }) => ( {/* Group Cover Image */} - + { content={ {/* Group Cover Image */} - + {group.header && ( = ({ hashtags }) => { key={hashtag} to={`/tags/${hashtag}`} onClick={(e) => e.stopPropagation()} - className='flex items-center rounded-sm bg-gray-100 px-1.5 py-1 text-center text-xs font-medium text-primary-600 black:bg-primary-900 dark:bg-primary-700 dark:text-white' + className='text-primary-600 black:bg-primary-900 dark:bg-primary-700 flex items-center rounded-sm bg-gray-100 px-1.5 py-1 text-center text-xs font-medium dark:text-white' > #{hashtag} diff --git a/packages/pl-fe/src/components/landing-gradient.tsx b/packages/pl-fe/src/components/landing-gradient.tsx index 7bf75dc11..0e582c7dd 100644 --- a/packages/pl-fe/src/components/landing-gradient.tsx +++ b/packages/pl-fe/src/components/landing-gradient.tsx @@ -2,7 +2,7 @@ import React from 'react'; /** Fullscreen gradient used as a backdrop to public pages. */ const LandingGradient: React.FC = () => ( -
    +
    ); export { LandingGradient as default }; diff --git a/packages/pl-fe/src/components/link.tsx b/packages/pl-fe/src/components/link.tsx index 413061279..7516ce49f 100644 --- a/packages/pl-fe/src/components/link.tsx +++ b/packages/pl-fe/src/components/link.tsx @@ -4,7 +4,7 @@ import { Link as Comp, LinkProps } from 'react-router-dom'; const Link = (props: LinkProps) => ( ); diff --git a/packages/pl-fe/src/components/list.tsx b/packages/pl-fe/src/components/list.tsx index d5881ff4b..b125be4d1 100644 --- a/packages/pl-fe/src/components/list.tsx +++ b/packages/pl-fe/src/components/list.tsx @@ -56,7 +56,7 @@ const ListItem: React.FC = ({ className, label, hint, children, to, h return null; }), [children, domId]); - const classNames = clsx('flex items-center justify-between overflow-hidden bg-gradient-to-r from-gradient-start/20 to-gradient-end/20 first:rounded-t-lg last:rounded-b-lg dark:from-gradient-start/10 dark:to-gradient-end/10', + const classNames = clsx('from-gradient-start/20 to-gradient-end/20 dark:from-gradient-start/10 dark:to-gradient-end/10 flex items-center justify-between overflow-hidden bg-gradient-to-r first:rounded-t-lg last:rounded-b-lg', className, { 'px-4 py-2': size === 'md', diff --git a/packages/pl-fe/src/components/mention.tsx b/packages/pl-fe/src/components/mention.tsx index 68bcabb39..56310296b 100644 --- a/packages/pl-fe/src/components/mention.tsx +++ b/packages/pl-fe/src/components/mention.tsx @@ -23,7 +23,7 @@ const Mention: React.FC = ({ mention: { acct, username }, disabled }) diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index be0eb10fc..a6dfa527c 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -205,7 +205,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type })