-
Notifications
You must be signed in to change notification settings - Fork 86
Agentic UI: Render application settings as a fullscreen overlay #4297
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4eff5e5
Render application settings as a fullscreen overlay over the workbench
bcotrim 9eb8968
Merge remote-tracking branch 'origin/trunk' into agentic-settings-ful…
bcotrim 446ae4b
Merge remote-tracking branch 'origin/trunk' into agentic-settings-ful…
bcotrim b07e4e8
Reuse FullscreenChrome in the onboarding layout
bcotrim 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { close } from '@wordpress/icons'; | ||
| import { IconButton } from '@wordpress/ui'; | ||
| import styles from './style.module.css'; | ||
|
|
||
| interface FullscreenChromeProps { | ||
| /** | ||
| * When provided, renders a close button in the top-right corner so the user | ||
| * can leave the fullscreen view. Omit to render just the window drag edges. | ||
| */ | ||
| onClose?: () => void; | ||
| /** Accessible label for the close button. Defaults to "Close". */ | ||
| closeLabel?: string; | ||
| /** Disables the close button, e.g. while a submit is in flight. */ | ||
| closeDisabled?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Window chrome for fullscreen views that fill the window with no native title | ||
| * bar (site creation, settings). Renders invisible drag strips along the top, | ||
| * left, and bottom edges so the window can still be moved, plus an optional | ||
| * close button pinned top-right. The right edge is left free for a scroll bar, | ||
| * and the close button stays clickable over the drag strips via the global | ||
| * no-drag rule in index.css. | ||
| */ | ||
| export function FullscreenChrome( { onClose, closeLabel, closeDisabled }: FullscreenChromeProps ) { | ||
| return ( | ||
| <> | ||
| <div aria-hidden="true"> | ||
| <div className={ `${ styles.dragEdge } ${ styles.dragEdgeTop }` } /> | ||
| <div className={ `${ styles.dragEdge } ${ styles.dragEdgeLeft }` } /> | ||
| <div className={ `${ styles.dragEdge } ${ styles.dragEdgeBottom }` } /> | ||
| </div> | ||
| { onClose && ( | ||
| <IconButton | ||
| className={ styles.close } | ||
| variant="minimal" | ||
| tone="neutral" | ||
| size="default" | ||
| icon={ close } | ||
| label={ closeLabel ?? __( 'Close' ) } | ||
| onClick={ onClose } | ||
| disabled={ closeDisabled } | ||
| /> | ||
| ) } | ||
| </> | ||
| ); | ||
| } | ||
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,46 @@ | ||
| /* Fullscreen views fill the window with no title bar; invisible strips along | ||
| the top, left, and bottom edges act as the window drag region. A full- | ||
| background region would also work, but it would swallow the mouse events any | ||
| interactive background (e.g. the onboarding dot grid) depends on. The right | ||
| edge is left free for the scroll bar, and interactive elements overlapping a | ||
| strip (the close button) stay clickable via the global no-drag rule. */ | ||
| .dragEdge { | ||
| position: fixed; | ||
| pointer-events: none; | ||
| -webkit-app-region: drag; | ||
| } | ||
|
|
||
| .dragEdgeTop { | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| height: 36px; | ||
| } | ||
|
|
||
| .dragEdgeLeft { | ||
| top: 36px; | ||
| left: 0; | ||
| bottom: 0; | ||
| width: 16px; | ||
| } | ||
|
|
||
| .dragEdgeBottom { | ||
| left: 16px; | ||
| right: 0; | ||
| bottom: 0; | ||
| height: 16px; | ||
| } | ||
|
|
||
| .close { | ||
| /* Fixed so it stays in the corner while the page scrolls; above the | ||
| footer scrim/actions (z-index 5/6). */ | ||
| position: fixed; | ||
| top: 16px; | ||
| right: 16px; | ||
| z-index: 7; | ||
| } | ||
|
|
||
| .close svg { | ||
| width: 32px; | ||
| height: 32px; | ||
| } |
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
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,15 @@ | ||
| import { createContext, useContext } from 'react'; | ||
|
|
||
| /** | ||
| * The settings layout renders the settings view as a fullscreen overlay and | ||
| * owns the "close" action (navigate back to where the user was). The view | ||
| * renders the close button inside its own toolbar, so the handler is shared | ||
| * down through this context rather than threaded as props through the route | ||
| * components. `null` when the view is rendered outside the settings overlay, | ||
| * where no close button should appear. | ||
| */ | ||
| export const SettingsCloseContext = createContext< ( () => void ) | null >( null ); | ||
|
|
||
| export function useSettingsClose(): ( () => void ) | null { | ||
| return useContext( SettingsCloseContext ); | ||
| } |
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 new component is similar to
onboarding-layout. We can consider unifying them, or using this new one in the Onboarding layout.studio/apps/ui/src/components/onboarding-layout/index.tsx
Lines 21 to 37 in 9eb8968