From 069624029ad2a257cb36f88b7d35dc5b2c6fcaf3 Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Wed, 29 Jan 2025 11:40:15 +0000 Subject: [PATCH] Merge pull request #23080 from overleaf/dp-file-outline-in-editor Add file outline to new editor GitOrigin-RevId: c9b36d480b243905de8e98dcb838c56a2fe9d2b0 --- .../components/file-tree-outline-panel.tsx | 33 ++++++++ .../features/ide-redesign/components/rail.tsx | 9 +-- .../bootstrap-5/pages/editor/outline.scss | 78 ++++++++++++++++++- .../bootstrap-5/pages/editor/rail.scss | 4 + 4 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 services/web/frontend/js/features/ide-redesign/components/file-tree-outline-panel.tsx diff --git a/services/web/frontend/js/features/ide-redesign/components/file-tree-outline-panel.tsx b/services/web/frontend/js/features/ide-redesign/components/file-tree-outline-panel.tsx new file mode 100644 index 0000000000..4e95b00460 --- /dev/null +++ b/services/web/frontend/js/features/ide-redesign/components/file-tree-outline-panel.tsx @@ -0,0 +1,33 @@ +import { Panel, PanelGroup } from 'react-resizable-panels' +import { FileTree } from '@/features/ide-react/components/file-tree' +import { OutlineContainer } from '@/features/outline/components/outline-container' +import { VerticalResizeHandle } from '@/features/ide-react/components/resize/vertical-resize-handle' + +function FileTreeOutlinePanel() { + return ( + + + + + + + + + + ) +} + +export default FileTreeOutlinePanel diff --git a/services/web/frontend/js/features/ide-redesign/components/rail.tsx b/services/web/frontend/js/features/ide-redesign/components/rail.tsx index 80e117ccb3..8ce34509fe 100644 --- a/services/web/frontend/js/features/ide-redesign/components/rail.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/rail.tsx @@ -5,8 +5,8 @@ import MaterialIcon, { } from '@/shared/components/material-icon' import { Panel } from 'react-resizable-panels' import { useLayoutContext } from '@/shared/context/layout-context' -import { FileTree } from '@/features/ide-react/components/file-tree' import { ErrorIndicator, ErrorPane } from './errors' +import FileTreeOutlinePanel from './file-tree-outline-panel' type RailElement = { icon: AvailableUnfilledIcon @@ -29,12 +29,7 @@ const RAIL_TABS: RailElement[] = [ { key: 'file-tree', icon: 'description', - component: ( - <> - {/* TODO: add panel for file outline */} - - - ), + component: , }, { key: 'integrations', diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss index c0de189b1e..c716cd426e 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss @@ -7,6 +7,7 @@ --outline-container-color-bg: var(--bg-dark-tertiary); --outline-content-color: var(--content-primary-dark); --outline-item-highlight-color: var(--neutral-60); + --outline-item-carat-color: var(--content-disabled); } @include theme('light') { @@ -18,6 +19,81 @@ --outline-container-color-bg: var(--bg-light-primary); --outline-content-color: var(--content-secondary); --outline-item-highlight-color: var(--bg-light-secondary); + --outline-item-carat-color: var(--content-disabled); +} + +// TODO ide-redesign-cleanup: Replace the existing styling with these overrides. +.ide-redesign-main { + --outline-bg-color: var(--bg-light-primary); + --outline-item-hover-bg: var(--bg-light-secondary); + --outline-header-hover-bg: var(--bg-light-secondary); + --outline-content-color: var(--content-primary); + --outline-item-highlight-color: var(--bg-light-secondary); + --outline-item-carat-color: var(--content-primary); + --outline-line-guide-color: color-mix( + in srgb, + var(--border-primary) 24%, + transparent + ); + --outline-container-color-bg: var(--bg-light-primary); + + .outline-pane { + padding: 4px; + } + + .outline-header { + border: none; + height: unset; + } + + .outline-header-expand-collapse-btn { + border-radius: var(--border-radius-base); + padding: var(--spacing-02); + } + + .outline-header-name { + font-weight: unset; + } + + .outline-carat-icon { + font-size: unset; + } + + .outline-body { + padding-right: 0; + } + + .outline-item-list { + display: flex; + flex-direction: column; + gap: var(--spacing-02); + margin-top: var(--spacing-02); + + &::before { + left: var(--spacing-06); + } + } + + .outline-item-list-root { + &::before { + content: none; + } + } + + .outline-item-expand-collapse-btn { + display: flex; + align-items: center; + padding: var(--spacing-02); + } + + .outline-item-no-children { + padding-left: 0; + } + + .outline-item-link { + flex-grow: 1; + padding: var(--spacing-02); + } } .outline-container { @@ -182,7 +258,7 @@ vertical-align: inherit; position: relative; z-index: 1; - color: var(--content-disabled); + color: var(--outline-item-carat-color); margin-right: calc(var(--spacing-03) * -1); border-radius: var(--border-radius-base); diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss index 0b2577d0cd..32e9c9ea32 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss @@ -70,6 +70,10 @@ top: 0; } + .tab-pane { + height: 100%; + } + .tab-content { height: 100%; width: 100%;