Skip to content
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

chore(web): refactor step editor sidebar #4408

Merged

Conversation

LetItRock
Copy link
Contributor

@LetItRock LetItRock commented Oct 4, 2023

What change does this PR introduce?

Refactor the step editor sidebar to be a reusable component for all different steps, and reuse it in all the editors.
Refactor the workflow settings/snippet sidebar.
Implemented a separate VariantsListSidebar component for variants list.

Why was this change needed?

Other information (Screenshots)

Screenshot 2023-10-04 at 20 35 31

Screenshot 2023-10-04 at 20 36 00
Screenshot 2023-10-04 at 20 36 31
Screenshot 2023-10-04 at 20 36 42
Screenshot 2023-10-04 at 20 36 51

Screenshot 2023-10-04 at 21 15 30
Screenshot 2023-10-04 at 21 15 24
Screenshot 2023-10-04 at 21 15 19
Screenshot 2023-10-04 at 21 15 11
Screenshot 2023-10-04 at 21 15 04

@LetItRock LetItRock self-assigned this Oct 4, 2023
@linear
Copy link

linear bot commented Oct 4, 2023

NV-2715 🔀 Create the Editor Sidebar

What?

Create the Editor Sidebar to be a reusable component. Update its UI according to the designs.

Why? (Context)

We would like to reuse the same Editor Sidebar for all the channels Editors and Variant Editors.

The only difference between Editor and Variant Editor is that it has an additional variant line under the name.

Definition of Done

  • the header
    • provider icon with a small channel icon at the right bottom corner
    • has the editable name field
    • has the ability to inject the custom component under the name (for variant)
  • the header actions
    • delete (before it was at the bottom)
    • conditions button (aka filters, do not implement it just show the filters modal)
    • close button

Screenshot 2023-08-30 at 09.25.09.png

Screenshot 2023-08-30 at 09.40.25.png

In-App condition - Tenants (Figma)

@@ -78,6 +93,8 @@ export const Sidebar = ({
isOpened,
isExpanded = false,
isLoading = false,
isParentScrollable = false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow to decide whether the whole sidebar is scrollable or only the body

<HeaderHolder>
{isExpanded && onBack && (
<ActionIcon variant="transparent" onClick={onBack} data-test-id="sidebar-back">
<ActionIcon onClick={onBack} data-test-id="sidebar-back">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the actions should have the background on hover

paddingBottom: 24,
}}
>
<StepEditorSidebar>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the StepEditorSidebar for all editors

{channel === StepTypeEnum.SMS && (
<>
<TemplateSMSEditor key={key} />
<TranslateProductLead id="translate-sms-editor" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the TranslateProductLead inside the editor

Comment on lines +37 to +41
display: 'flex',
flexDirection: 'column-reverse',
gap: 4,
flex: '1 1 auto',
marginRight: 16,
width: '100%',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverse the order of "step name" and the "step label" - for example:

Email
Variant 1

import { Text, colors } from '../../../design-system';
import { useStepIndex } from '../hooks/useStepIndex';

export const StepNameLabel = ({ variantsCount = 0 }: { variantsCount?: number }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the smart label component that depending on the context renders the label:

  • if root step - render nothing
  • if variant - render Variant {n}
  • if variants list - render {n} variants

@LetItRock LetItRock force-pushed the nv-2715-refactor-editor-sidebar branch from 2ddc12b to 95aa843 Compare October 4, 2023 18:57
Copy link
Contributor

@ainouzgali ainouzgali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful

@ainouzgali ainouzgali merged commit 086b38a into variants-refactor-form-path Oct 8, 2023
15 of 17 checks passed
@ainouzgali ainouzgali deleted the nv-2715-refactor-editor-sidebar branch October 8, 2023 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants