feat: Implements the action bar with core actions.#393
feat: Implements the action bar with core actions.#393kozmaadrian wants to merge 12 commits intoewfrom
Conversation
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
|
|
I think we should separate preview and publish as actions. As an edge delivery user, that's what I'm used to. Only having a publish button makes it not clear to me whether it will do preview, publish or preview -> publish both. |
|
Happy to debate this one, but: Do we really need a confirmation dialog for single-file preview/publish? For multi files it makes sense, but for single file, we don't have a confirmation in sidekick or da so I don't think we need it here. |
| variant: { type: String, attribute: false }, | ||
| autofocusId: { type: String, attribute: false }, | ||
| dismissable: { type: Boolean, attribute: false }, | ||
| onPrimaryAction: { type: Function, attribute: false }, |
There was a problem hiding this comment.
Why do we go for this approach vs firing events as in other blocks? This creates tight coupling between consumer and dialog, when ideally it would be nice that dialog simply fires an event and consumer listens and responds - consistent with how things are working across the repo atm. Dialog doesnt and shouldnt know about what happens after click - it just handles the UI, fires event and forgets, and everything else is the responsibility of the consumer.
As a bonus, this would also help redice the properties ie both the onAction and the actionId
There was a problem hiding this comment.
The dialog was refactored, no callbacks are used.
|
@kozmaadrian All new blocks introduced have the callback pattern as in React vs event driven pattern across the repo. Why this deviation from pattern? |
|
|
||
| _renderShell({ title, body, actions }) { | ||
| return html` | ||
| <div |
There was a problem hiding this comment.
Worth exploring if we can use the native api here instead of custom code completely - it would give ootb support for many of the expected capabilities of a dialog.
There was a problem hiding this comment.
+1, this should use dialog with showModal
| showRename: { type: Boolean }, | ||
| showDeploy: { type: Boolean }, | ||
| disabled: { type: Boolean, attribute: false }, | ||
| onDismiss: { type: Function, attribute: false }, |
There was a problem hiding this comment.
onDismiss/onAction are callback props. since we use CustomEvent, why don't we fire events instead? same for onComplete in the action dialogs
There was a problem hiding this comment.
I can changed that, however at one point, the agreement was to consistently use events in shared components, while minimizing their use in more tightly coupled scenarios.
There was a problem hiding this comment.
Update: AFAIU, reducing the number of events can be addressed in a future refactoring if needed. Therefore, I updated the code to rely exclusively on events.
| } else { | ||
| const url = r.json?.live?.url; | ||
| if (url) openAemUrlWithNoCache(url); | ||
| } |
There was a problem hiding this comment.
openAemUrlWithNoCache opens tabs inside the deploy fn. why don't we return the URLs and let the consumer decide? (in the function in line 8)
There was a problem hiding this comment.
Done as suggested.
| static properties = { | ||
| title: { type: String, attribute: false }, | ||
| body: { type: Object, attribute: false }, | ||
| primaryActionLabel: { type: String, attribute: false }, |
There was a problem hiding this comment.
I see the same issue here with function props instead of events
https://lit.dev/docs/components/events/
There was a problem hiding this comment.
The dialog has been refactored.
| <div | ||
| class="panel" | ||
| role="dialog" | ||
| aria-modal="true" |
There was a problem hiding this comment.
we have role="dialog" aria-modal="true" but no focus trap. tab will escape to background.
There was a problem hiding this comment.
Switched to element.
|
|
||
| _onLayerClose = () => { | ||
| this.dispatchEvent( | ||
| new CustomEvent('nx-dialog-close', { bubbles: true, composed: true }), |
There was a problem hiding this comment.
when the dialog closes, focus needs to return to whatever triggered it.
| .bar-lead { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 6px; |
There was a problem hiding this comment.
magic number. please let's move to var
| --bar-lead-w: 141px; | ||
|
|
||
| width: var(--bar-lead-w); | ||
| min-width: var(--bar-lead-w); |
There was a problem hiding this comment.
width, min-width, max-width all the same var. flex: 0 0 var(--bar-lead-w) does the job.
| width: 100%; | ||
| min-height: var(--s2-spacing-500); | ||
| height: var(--s2-spacing-500); | ||
| padding-left: 10px; |
There was a problem hiding this comment.
The magic number seemed more readable since there’s no --s2-* variable defined for 6px.
| } | ||
|
|
||
| .browse-action-busy { | ||
| position: fixed; |
There was a problem hiding this comment.
isn't this identical in delete.css, deploy.css, rename.css. why don't we extract it?
| & .title { | ||
| margin: 0; | ||
| padding: 0; | ||
| font-size: 18px; |
|
I would really love for us to establish the no single letter name var and the boolean is/has prefix, but I won't block a PR for this. however there are many instances of those potential changes, and one of |
|
|
||
| const styles = await loadStyle(import.meta.url); | ||
|
|
||
| class NxBrowseDeployRunner extends LitElement { |
There was a problem hiding this comment.
I'm not sure I understand why we need this component? Any reason why this logic is separate and not part of browse? For me this is overkill and feels antipattern.
There was a problem hiding this comment.
I split it out to match the other actions and keep browse simpler. It also leaves room if we add multi-item preview/publish later.
There was a problem hiding this comment.
I get the need to keep things aligned, but consistency for the sake of consistency isnt helpful either. Delete and rename are valid as components because they have actual interactive state and user interaction - this has neither. In such a case, I feel a Lit component isnt justified. Completely fair to revisit and adapt when we have a more concrete use case, but not atm.
|
|
||
| const styles = await loadStyle(import.meta.url); | ||
|
|
||
| class NxOverlay extends LitElement { |
There was a problem hiding this comment.
Since this is only used in browse I would move this out of shared for now. Without finalized mocks and given how minimal it is, I think its premature to keep it in shared - ideally it neednt be a component at all and could just be done inline or we move it into browse.
There was a problem hiding this comment.
Fair! I’ll move the overlay into browse so it’s not in shared anymore. We can inline it later if we want it even simpler.


Implements the action bar with core actions: preview, publish, delete, and rename.
Also adds shared components dialog, toast, and progress circle, required for the browse actions.
Test URLs: