From a12e2001c3387abc69f277b263658d1a3302bd32 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 6 Mar 2025 10:54:40 +0000 Subject: [PATCH] Remove Bootstrap 3 code from IDE page components (#23061) GitOrigin-RevId: b41aff10672bf96e892de0be396a69eb25e2443b --- services/web/.storybook/preview.tsx | 8 +- .../utils/with-bootstrap-switcher.tsx | 4 +- services/web/cypress/support/component.ts | 1 + services/web/cypress/support/ct/window.ts | 1 + .../support/shared/commands/compile.ts | 9 +- .../web/frontend/extracted-translations.json | 4 - .../js/features/chat/components/chat-pane.tsx | 16 +- .../chat/components/message-input.tsx | 6 +- .../components/clone-project-tag.tsx | 53 +- .../components/dictionary-modal-content.tsx | 9 +- .../components/download-pdf.tsx | 12 +- .../components/download-source.tsx | 7 +- .../components/editor-left-menu.tsx | 64 +- .../components/left-menu-button.tsx | 9 +- .../settings/settings-dictionary.tsx | 1 - .../settings/settings-menu-select.tsx | 26 +- .../components/back-to-projects-button.tsx | 21 +- .../components/chat-toggle-button.jsx | 23 +- .../components/history-toggle-button.jsx | 7 +- .../components/layout-dropdown-button.tsx | 376 +++------- .../components/menu-button.jsx | 12 +- .../components/online-users-widget.jsx | 82 +-- .../project-name-editable-label.tsx | 7 +- .../components/share-project-button.jsx | 7 +- .../components/toolbar-header.jsx | 23 +- .../track-changes-toggle-button.jsx | 6 +- .../components/upgrade-prompt.jsx | 7 +- .../components/file-tree-context-menu.tsx | 67 +- .../file-tree-modal-create-file-body.jsx | 5 +- .../file-tree-modal-create-file-footer.jsx | 1 - .../file-tree-modal-create-file-mode.jsx | 7 +- .../modes/file-tree-import-from-project.tsx | 47 +- .../components/file-tree-folder-icons.tsx | 55 +- .../file-tree/components/file-tree-icon.tsx | 39 +- .../file-tree-item-menu-items.tsx | 117 ++- .../file-tree-item/file-tree-item-menu.tsx | 7 +- .../components/file-tree-toolbar.tsx | 43 +- .../modals/file-tree-modal-create-folder.jsx | 7 +- .../modals/file-tree-modal-delete.jsx | 7 +- .../file-tree/util/icon-type-from-name.ts | 9 +- .../file-view/components/file-view-header.tsx | 7 +- .../file-view/components/file-view-icons.jsx | 24 +- .../components/file-view-refresh-button.tsx | 10 +- .../change-list/add-label-modal.tsx | 5 - .../change-list/all-history-list.tsx | 4 - .../change-list/dropdown/actions-dropdown.tsx | 77 +- .../change-list/dropdown/history-dropdown.tsx | 14 +- .../dropdown/menu-item/compare.tsx | 5 +- .../dropdown/menu-item/download.tsx | 9 +- .../dropdown/menu-item/restore-project.tsx | 9 +- .../change-list/history-version.tsx | 6 +- .../change-list/label-list-item.tsx | 6 +- .../components/change-list/tag-tooltip.tsx | 5 - .../diff-view/document-diff-viewer.tsx | 5 +- .../modals/restore-project-modal.tsx | 1 - .../toolbar/toolbar-restore-file-button.tsx | 4 - ...toolbar-restore-file-to-version-button.tsx | 4 - .../file-tree/history-file-tree-doc.tsx | 19 +- .../file-tree/history-file-tree-folder.tsx | 58 +- .../ide-react/components/alerts/alerts.tsx | 1 - .../alerts/lost-connection-alert.tsx | 1 - .../components/detach-compile-button.tsx | 33 +- .../components/pdf-clear-cache-button.tsx | 15 +- .../pdf-code-check-failed-notice.tsx | 18 +- .../components/pdf-compile-button.tsx | 362 +++------- .../components/pdf-download-files-button.tsx | 52 +- .../pdf-preview/components/pdf-file-list.tsx | 112 +-- .../pdf-hybrid-code-check-button.tsx | 15 +- .../components/pdf-hybrid-download-button.tsx | 7 +- .../components/pdf-hybrid-logs-button.tsx | 7 +- .../components/pdf-log-entry-raw-content.tsx | 4 - .../components/pdf-preview-error.tsx | 2 - .../components/pdf-preview-hybrid-toolbar.tsx | 17 +- .../components/pdf-synctex-controls.tsx | 63 +- .../components/pdf-zoom-dropdown.tsx | 315 +++----- .../components/stop-on-first-error-prompt.tsx | 7 +- .../components/switch-to-editor-button.tsx | 17 +- .../components/timeout-upgrade-prompt-new.tsx | 1 - .../components/preview-log-entry-header.tsx | 12 +- .../preview-logs-pane-max-entries.jsx | 15 +- .../review-panel-comment-options.tsx | 90 +-- .../review-panel-more-comments-button.tsx | 11 +- .../review-panel-resolved-threads-button.tsx | 7 +- ...review-panel-track-changes-menu-button.tsx | 11 +- .../components/add-collaborators.jsx | 3 - .../components/edit-member.tsx | 51 +- .../share-project-modal/components/invite.jsx | 14 +- .../components/link-sharing.jsx | 16 +- .../components/owner-info.jsx | 7 +- .../components/select-collaborators.jsx | 117 +-- .../share-project-modal-content.tsx | 20 +- .../components/transfer-ownership-modal.jsx | 20 +- .../components/view-member.jsx | 7 +- .../components/codemirror-search-form.tsx | 41 +- .../command-tooltip/href-tooltip.tsx | 12 +- .../command-tooltip/include-tooltip.tsx | 7 +- .../command-tooltip/input-tooltip.tsx | 7 +- .../command-tooltip/ref-tooltip.tsx | 7 +- .../command-tooltip/url-tooltip.tsx | 7 +- .../figure-modal/figure-modal-footer.tsx | 40 +- .../figure-modal/figure-modal-options.tsx | 35 +- .../figure-modal-source-picker.tsx | 28 +- .../figure-modal-upload-source.tsx | 21 +- .../components/math-preview-tooltip.tsx | 121 +--- .../paste-html/pasted-content-menu.tsx | 17 +- .../editor-widgets/editor-widgets.tsx | 17 +- .../entries/add-comment-entry.tsx | 17 +- .../entries/aggregate-change-entry.tsx | 22 +- .../bulk-actions-entry/bulk-actions-entry.tsx | 12 +- .../review-panel/entries/change-entry.tsx | 22 +- .../review-panel/entries/comment-entry.tsx | 17 +- .../components/review-panel/nav.tsx | 12 +- .../components/review-panel/overview-file.tsx | 7 +- .../components/review-panel/toggler.tsx | 7 +- .../toolbar/resolved-comments-dropdown.tsx | 7 +- .../review-panel/toolbar/toggle-menu.tsx | 7 +- .../upgrade-track-changes-modal.tsx | 12 +- .../components/switch-to-pdf-button.jsx | 17 +- .../toolbar/column-width-modal/modal.tsx | 12 +- .../toolbar/toolbar-button-menu.tsx | 3 +- .../toolbar/insert-figure-dropdown.tsx | 29 +- .../components/toolbar/overflow.tsx | 9 +- .../components/toolbar/toolbar-button.tsx | 21 +- .../components/toolbar/toolbar-items.tsx | 37 +- .../spelling-suggestions-language.tsx | 21 +- .../spelling/spelling-suggestions.tsx | 116 +-- .../extensions/toolbar/toolbar-panel.ts | 5 +- .../extensions/visual/table-generator.ts | 9 +- .../components/word-count-modal-content.jsx | 17 +- .../web/frontend/stories/chat.stories.jsx | 2 - .../stories/clone-project-modal.stories.jsx | 2 - .../editor-left-menu/actions-menu.stories.tsx | 4 - .../editor-navigation-toolbar.stories.jsx | 2 - .../stories/editor-switch.stories.jsx | 4 - .../editor/layout-dropdown-button.stories.tsx | 2 - .../editor/pdf-compile-button.stories.tsx | 2 - .../frontend/stories/file-tree.stories.jsx | 2 - .../stories/file-view/file-view.stories.jsx | 2 - .../history/document-diff-viewer.stories.tsx | 2 - .../history/history-version.stories.tsx | 2 - .../stories/history/label-version.stories.tsx | 2 - .../stories/history/toggle-switch.stories.tsx | 2 - .../stories/hotkeys-modal.stories.jsx | 2 - .../create-file-modal-footer.stories.jsx | 2 - .../create-file/create-file-modal.stories.jsx | 4 - .../create-file-name-input.stories.jsx | 4 - .../create-file/error-message.stories.jsx | 4 - .../web/frontend/stories/outline.stories.jsx | 2 - .../stories/pdf-log-entry.stories.tsx | 2 - .../pdf-preview-error-boundary.stories.jsx | 4 - .../stories/pdf-preview-messages.stories.jsx | 4 - .../stories/pdf-preview-messages.stories.tsx | 4 - .../frontend/stories/pdf-preview.stories.jsx | 26 +- .../frontend/stories/pdf-viewer.stories.jsx | 4 - .../stories/share-project-modal.stories.jsx | 2 - .../source-editor/source-editor.stories.tsx | 4 - .../stories/word-count-modal.stories.jsx | 2 - services/web/locales/en.json | 2 - .../editor-left-menu.spec.tsx | 1 - .../detach-compile-button.spec.tsx | 1 - .../pdf-preview/pdf-js-viewer.spec.tsx | 1 - .../pdf-preview/pdf-logs-entries.spec.tsx | 1 - .../pdf-preview-detached-root.spec.tsx | 1 - .../pdf-preview-hybrid-toolbar.spec.tsx | 1 - .../pdf-preview/pdf-preview.spec.tsx | 49 +- .../pdf-preview/pdf-synctex-controls.spec.tsx | 5 +- .../notifications/group-invitation.spec.tsx | 1 - .../shared/accessible-modal.spec.tsx | 1 - .../components/shared/beta-badge.spec.tsx | 1 - .../components/shared/material-icon.spec.tsx | 1 - .../components/shared/select.spec.tsx | 108 +-- .../shared/split-test-badge.spec.tsx | 5 +- .../shared/start-free-trial-button.spec.tsx | 1 - .../components/shared/tooltip.spec.tsx | 1 - .../token-access/token-access-page.spec.tsx | 1 - .../layout-dropdown-button.test.jsx | 166 +++-- .../file-tree-create-name-input.spec.tsx | 1 - .../file-tree-modal-create-file.spec.tsx | 1 - .../components/file-tree-doc.spec.tsx | 5 +- .../components/file-tree-folder-list.spec.tsx | 1 - .../components/file-tree-folder.spec.tsx | 1 - .../file-tree-item-inner.spec.tsx | 1 - .../file-tree-item-name.spec.tsx | 1 - .../components/file-tree-root.spec.tsx | 1 - .../components/file-tree-toolbar.spec.tsx | 1 - .../file-tree/flows/context-menu.spec.tsx | 1 - .../file-tree/flows/create-folder.spec.tsx | 1 - .../file-tree/flows/delete-entity.spec.tsx | 33 +- .../file-tree/flows/rename-entity.spec.tsx | 1 - .../util/icon-type-from-name.test.js | 12 +- .../components/file-view-header.test.jsx | 2 +- .../file-view-refresh-button.test.jsx | 13 +- .../members-table/unlink-user-modal.test.tsx | 1 + .../components/change-list-bs5.spec.tsx | 681 ------------------ .../history/components/change-list.spec.tsx | 6 +- .../components/document-diff-viewer.spec.tsx | 1 - .../history/components/toolbar.spec.tsx | 1 - .../switch-to-editor-button.spec.tsx | 1 - .../components/switch-to-pdf-button.spec.tsx | 1 - .../outline/components/outline-item.spec.tsx | 1 - .../outline/components/outline-list.spec.tsx | 1 - .../outline/components/outline-pane.spec.tsx | 1 - .../outline/components/outline-root.spec.tsx | 1 - .../upload-project-modal.spec.tsx | 1 - .../review-panel/review-panel.spec.tsx | 1 - .../codemirror-editor-autocomplete.spec.tsx | 1 - .../codemirror-editor-close-brackets.spec.tsx | 1 - .../codemirror-editor-cursor.spec.tsx | 1 - .../codemirror-editor-figure-modal.spec.tsx | 107 +-- .../codemirror-editor-fundamentals.spec.tsx | 1 - .../codemirror-editor-shortcuts.spec.tsx | 1 - ...mirror-editor-spellchecker-client.spec.tsx | 1 - ...codemirror-editor-table-generator.spec.tsx | 11 +- ...ror-editor-visual-command-tooltip.spec.tsx | 1 - .../codemirror-editor-visual-floats.spec.tsx | 1 - .../codemirror-editor-visual-list.spec.tsx | 1 - ...demirror-editor-visual-paste-html.spec.tsx | 92 ++- ...codemirror-editor-visual-readonly.spec.tsx | 1 - .../codemirror-editor-visual-toolbar.spec.tsx | 9 +- ...codemirror-editor-visual-tooltips.spec.tsx | 1 - .../codemirror-editor-visual.spec.tsx | 1 - .../components/codemirror-editor.spec.tsx | 1 - .../frontend/infrastructure/i18n.spec.tsx | 1 - .../shared/hooks/use-detach-action.spec.tsx | 1 - .../shared/hooks/use-detach-layout.spec.tsx | 1 - .../shared/hooks/use-detach-state.spec.tsx | 1 - .../shared/hooks/use-recaptcha.spec.tsx | 1 - .../frontend/shared/hooks/use-resize.spec.tsx | 1 - 228 files changed, 1253 insertions(+), 3939 deletions(-) delete mode 100644 services/web/test/frontend/features/history/components/change-list-bs5.spec.tsx diff --git a/services/web/.storybook/preview.tsx b/services/web/.storybook/preview.tsx index 0ed624e087..ed67abc3c4 100644 --- a/services/web/.storybook/preview.tsx +++ b/services/web/.storybook/preview.tsx @@ -126,8 +126,8 @@ const preview: Preview = { // render stories in iframes, to isolate modals inlineStories: false, }, - // Default to Bootstrap 3 styles - bootstrap5: false, + // Default to Bootstrap 5 styles + bootstrap5: true, }, globalTypes: { theme: { @@ -166,10 +166,10 @@ const preview: Preview = { const { bootstrap3Style, bootstrap5Style } = context.loaded const bootstrapVersion = Number( context.args[bootstrapVersionArg] || - (context.parameters.bootstrap5 ? 5 : 3) + (context.parameters.bootstrap5 === false ? 3 : 5) ) as 3 | 5 const activeStyle = - bootstrapVersion === 5 ? bootstrap5Style : bootstrap3Style + bootstrapVersion === 3 ? bootstrap3Style : bootstrap5Style resetMeta(bootstrapVersion) diff --git a/services/web/.storybook/utils/with-bootstrap-switcher.tsx b/services/web/.storybook/utils/with-bootstrap-switcher.tsx index 2d6b6a5609..640338dbb0 100644 --- a/services/web/.storybook/utils/with-bootstrap-switcher.tsx +++ b/services/web/.storybook/utils/with-bootstrap-switcher.tsx @@ -10,11 +10,11 @@ export const bsVersionDecorator: Meta = { control: { type: 'inline-radio' }, options: ['3', '5'], table: { - defaultValue: { summary: '3' }, + defaultValue: { summary: '5' }, }, }, }, args: { - [bootstrapVersionArg]: '3', + [bootstrapVersionArg]: '5', }, } diff --git a/services/web/cypress/support/component.ts b/services/web/cypress/support/component.ts index f658b7d2e9..00e359b4ff 100644 --- a/services/web/cypress/support/component.ts +++ b/services/web/cypress/support/component.ts @@ -5,6 +5,7 @@ import './shared/commands' import './shared/exceptions' import './ct/commands' import './ct/codemirror' +import '../../test/frontend/helpers/bootstrap-5' beforeEach(function () { resetMeta() diff --git a/services/web/cypress/support/ct/window.ts b/services/web/cypress/support/ct/window.ts index ae2a194bc1..3f415cf3c5 100644 --- a/services/web/cypress/support/ct/window.ts +++ b/services/web/cypress/support/ct/window.ts @@ -10,6 +10,7 @@ export function resetMeta() { hasLinkedProjectOutputFileFeature: true, hasLinkUrlFeature: true, }) + window.metaAttributesCache.set('ol-bootstrapVersion', 5) } // Populate meta for top-level access in modules on import diff --git a/services/web/cypress/support/shared/commands/compile.ts b/services/web/cypress/support/shared/commands/compile.ts index cbd9972414..90567d8e74 100644 --- a/services/web/cypress/support/shared/commands/compile.ts +++ b/services/web/cypress/support/shared/commands/compile.ts @@ -84,11 +84,7 @@ export const waitForCompile = ({ prefix = 'compile', pdf = false } = {}) => { } export const interceptDeferredCompile = (beforeResponse?: () => void) => { - let resolveDeferredCompile: (value?: unknown) => void - - const promise = new Promise(resolve => { - resolveDeferredCompile = resolve - }) + const { promise, resolve } = Promise.withResolvers() cy.intercept( { method: 'POST', url: '/project/*/compile*', times: 1 }, @@ -148,6 +144,5 @@ export const interceptDeferredCompile = (beforeResponse?: () => void) => { { fixture: 'build/output.blg' } ).as(`compile-blg`) - // @ts-ignore - return cy.wrap(resolveDeferredCompile) + return cy.wrap(resolve) } diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index b901131642..469f3a796c 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -342,7 +342,6 @@ "create_project_in_github": "", "created": "", "created_at": "", - "creating": "", "current_file": "", "current_password": "", "currently_seeing_only_24_hrs_history": "", @@ -699,12 +698,10 @@ "hide_outline": "", "history": "", "history_add_label": "", - "history_adding_label": "", "history_are_you_sure_delete_label": "", "history_compare_from_this_version": "", "history_compare_up_to_this_version": "", "history_delete_label": "", - "history_deleting_label": "", "history_download_this_version": "", "history_entry_origin_dropbox": "", "history_entry_origin_git": "", @@ -1384,7 +1381,6 @@ "restore_file_version": "", "restore_project_to_this_version": "", "restore_this_version": "", - "restoring": "", "resync_completed": "", "resync_message": "", "resync_project_history": "", diff --git a/services/web/frontend/js/features/chat/components/chat-pane.tsx b/services/web/frontend/js/features/chat/components/chat-pane.tsx index ff928fb769..d51037762e 100644 --- a/services/web/frontend/js/features/chat/components/chat-pane.tsx +++ b/services/web/frontend/js/features/chat/components/chat-pane.tsx @@ -4,22 +4,17 @@ import { useTranslation } from 'react-i18next' import MessageInput from './message-input' import InfiniteScroll from './infinite-scroll' import ChatFallbackError from './chat-fallback-error' -import Icon from '../../../shared/components/icon' import { useLayoutContext } from '../../../shared/context/layout-context' import { useUserContext } from '../../../shared/context/user-context' import withErrorBoundary from '../../../infrastructure/error-boundary' import { FetchError } from '../../../infrastructure/fetch-json' import { useChatContext } from '../context/chat-context' import { FullSizeLoadingSpinner } from '../../../shared/components/loading-spinner' -import { bsVersion } from '@/features/utils/bootstrap-5' -import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import MaterialIcon from '@/shared/components/material-icon' const MessageList = lazy(() => import('./message-list')) -const Loading = () => ( - -) +const Loading = () => const ChatPane = React.memo(function ChatPane() { const { t } = useTranslation() @@ -86,9 +81,7 @@ const ChatPane = React.memo(function ChatPane() { itemCount={messageContentCount} >
-

- {t('chat')} -

+

{t('chat')}

}> {status === 'pending' && } {shouldDisplayPlaceholder && } @@ -115,10 +108,7 @@ function Placeholder() {
{t('send_first_message')}
- } - bs5={} - /> +
) diff --git a/services/web/frontend/js/features/chat/components/message-input.tsx b/services/web/frontend/js/features/chat/components/message-input.tsx index 30373886f9..b0c2312af9 100644 --- a/services/web/frontend/js/features/chat/components/message-input.tsx +++ b/services/web/frontend/js/features/chat/components/message-input.tsx @@ -1,5 +1,4 @@ import { useTranslation } from 'react-i18next' -import { bsVersion } from '@/features/utils/bootstrap-5' type MessageInputProps = { resetUnreadMessages: () => void @@ -27,10 +26,7 @@ function MessageInput({ resetUnreadMessages, sendMessage }: MessageInputProps) { return (
-