-
Notifications
You must be signed in to change notification settings - Fork 38
Assistant dialog papercuts #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marcoambrosini
wants to merge
4
commits into
main
Choose a base branch
from
fix/534-assistant-dialog-papercuts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0087452
collapse task history sidebar below 900px dialog width
marcoambrosini dd36134
modal: widen to min(1220px, 90vw)
marcoambrosini 86a2e07
modal: fullscreen on small mobile and when maximized
marcoambrosini 777def4
modal: align maximize button with close button
marcoambrosini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /** | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| // The assistant lives in a resizable/draggable dialog, so the navigation | ||
| // visibility follows the dialog/container width rather than the viewport. | ||
| const NAV_COLLAPSE_BREAKPOINT = 900 | ||
|
|
||
| /** | ||
| * Collapses the `NcAppNavigation` sidebar when the surrounding container gets | ||
| * narrower than NAV_COLLAPSE_BREAKPOINT and reopens it when it grows back. | ||
| * | ||
| * Unlike hiding the navigation, this drives the component's built-in open/close | ||
| * (by clicking its own toggle button) so the toggle stays visible and the | ||
| * sidebar remains reachable on a narrow dialog. | ||
| * | ||
| * The consuming component must set `ref="container"` on the observed element | ||
| * and `ref="appNav"` on its `<NcAppNavigation>`. If the container is rendered | ||
| * conditionally, call `setupNavObserver()` again once it appears. | ||
| */ | ||
| export default { | ||
| mounted() { | ||
| this.setupNavObserver() | ||
| }, | ||
| beforeUnmount() { | ||
| this.teardownNavObserver() | ||
| }, | ||
| methods: { | ||
| setupNavObserver() { | ||
| this.teardownNavObserver() | ||
| const container = this.$refs.container | ||
| if (!container || typeof ResizeObserver === 'undefined') { | ||
| return | ||
| } | ||
| // null = not evaluated yet, so the first observation always applies | ||
| this.navCollapsed = null | ||
| this.navResizeObserver = new ResizeObserver(this.onNavContainerResize) | ||
| this.navResizeObserver.observe(container) | ||
| }, | ||
| teardownNavObserver() { | ||
| this.navResizeObserver?.disconnect() | ||
| this.navResizeObserver = null | ||
| }, | ||
| onNavContainerResize(entries) { | ||
| const width = entries[0]?.contentRect.width | ||
| if (width === undefined) { | ||
| return | ||
| } | ||
| const shouldCollapse = width < NAV_COLLAPSE_BREAKPOINT | ||
| if (shouldCollapse === this.navCollapsed) { | ||
| return | ||
| } | ||
| this.navCollapsed = shouldCollapse | ||
| // defer to the next frame to avoid "ResizeObserver loop" warnings | ||
| window.requestAnimationFrame(() => this.setNavOpen(!shouldCollapse)) | ||
| }, | ||
| setNavOpen(open) { | ||
| // We deliberately drive NcAppNavigation through its own toggle button | ||
| // rather than emit('toggle-navigation') from @nextcloud/event-bus: that | ||
| // bus is global, so it would also collapse the host app's sidebar when | ||
| // resizing the assistant modal. NcAppNavigation exposes no `open` prop | ||
| // and doesn't expose toggleNavigation(), so its toggle button is the | ||
| // only instance-scoped lever. | ||
| const toggle = this.$refs.appNav?.$el?.querySelector('button.app-navigation-toggle') | ||
| if (!toggle) { | ||
| return | ||
| } | ||
| const isOpen = toggle.getAttribute('aria-expanded') === 'true' | ||
| if (isOpen !== open) { | ||
| toggle.click() | ||
| } | ||
| }, | ||
| }, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block should go after the
emitsblock.