From c511c68d7508e8f5a3bc6d5261a40b16a6b98e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milorad=20FIlipovi=C4=87?= Date: Mon, 26 Sep 2022 15:25:19 +0200 Subject: [PATCH] feat(editor): Main navigation redesign (#4144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(editor): N8N-4540 Main navigation layout rework (#4060) * ✨ Implemented new editor layout using css grid * ✨ Reworking main navigation layout, migrating some styling to css modules * ✨ Reworking main sidebar layout and responsiveness * 💄 Minor type update * ✨ Updated editor grid layout so empty cells are collapsed (`fit-content`), fixed updates menu items styling * ✨ Implemented new user area look & feel in main sidebar * 💄 Adjusting sidebar bottom padding when user area is not shown * 💄 CSS cleanup/refactor + minor vue refactoring * ✨ Fixing overscoll issue in chrome and scrolling behaviour of the content view * 👌 Addressing review feedback * ✨ Added collapsed and expanded versions of n8n logo * ✨ Updating infinite scrolling in templates view to work with the new layout * 💄 Updating main sidebar expanded width and templates view left margin * 💄 Updating main content height * 💄 Adding global styles for scrollable views with centered content, minor updates to user area * ✨ Updating zoomToFit logic, lasso select box position and new nodes positioning * ✨ Fixing new node drop position now that mouse detection has been adjusted * 👌 Updating templates view scroll to top logic and responsive padding, aligning menu items titles * 💄 Moving template layout style from global css class to component level * ✨ Moved 'Workflows' menu to node view header. Added new dropdown component for user area and the new WF menu * 💄 Updating disabled states in new WF menu * 💄 Initial stab at new sidebar styling * ✨ Finished main navigation restyling * ✨ Updating `zoomToFit` and centering logic * ✨ Adding updates menu item to settings sidebar * 💄 Adding updates item to the settings sidebar and final touches on main sidebar style * 💄 Removing old code & refactoring * 💄 Minor CSS tweaks * 💄 Opening credentials modal on sidebar menu item click. Minor CSS updates * 💄 Updating sidebar expand/collapse animation * 💄 Few more refinements of sidebar animation * 👌 Addressing code review comments * ✨ Moved ActionDropdown component to design system * 👌 Fixing bugs reported during code review and testing * 👌 Addressing design review comments for the new sidebar * ✔️ Updating `N8nActionDropdown` component tests * ✨ Remembering scroll position when going back to templates list * ✨ Updating zoomToFit logic to account for footer content * 👌 Addressing latest sidebar review comments * 👌 Addressing main sidebar product review comments * 💄 Updating css variable names after vite merge * ✔️ Fixing linting errors in the design system * ✔️ Fixing `element-ui` type import * 👌 Addressing the code review comments. * ✨ Adding link to new credentials view, removed old modal * 💄 Updating credentials view responsiveness and route highlight handling * 💄 Adding highlight to workflows submenu when on new workflow page * 💄 Updated active submenu text color --- .../ActionDropdown.stories.ts | 72 ++ .../N8nActionDropdown/ActionDropdown.vue | 130 ++ .../__tests__/ActionDropdown.spec.ts | 52 + .../__snapshots__/ActionDropdown.spec.ts.snap | 42 + .../src/components/N8nActionDropdown/index.ts | 2 + packages/design-system/src/css/reset.scss | 2 +- .../src/plugins/n8nComponents.ts | 2 + packages/editor-ui/public/favicon.ico | Bin 5430 -> 15086 bytes .../editor-ui/public/n8n-logo-collapsed.svg | 3 + .../editor-ui/public/n8n-logo-expanded.svg | 6 + packages/editor-ui/src/App.vue | 48 +- .../src/components/CredentialsList.vue | 167 --- .../src/components/GiftNotificationIcon.vue | 5 + packages/editor-ui/src/components/Logo.vue | 2 +- .../src/components/MainHeader/MainHeader.vue | 9 +- .../components/MainHeader/WorkflowDetails.vue | 205 ++- .../editor-ui/src/components/MainSidebar.vue | 1104 ++++++++--------- packages/editor-ui/src/components/Modals.vue | 8 - .../src/components/NodeCreator/SearchBar.vue | 1 - .../src/components/SettingsSidebar.vue | 49 +- .../editor-ui/src/components/TagsDropdown.vue | 12 - .../editor-ui/src/components/TemplateList.vue | 10 +- .../editor-ui/src/components/WorkflowOpen.vue | 70 +- .../src/components/layouts/PageViewLayout.vue | 15 +- .../src/components/mixins/mouseSelect.ts | 12 +- packages/editor-ui/src/constants.ts | 12 +- packages/editor-ui/src/modules/ui.ts | 13 +- packages/editor-ui/src/n8n-theme.scss | 2 +- .../src/plugins/i18n/locales/en.json | 36 +- packages/editor-ui/src/plugins/icons.ts | 2 + packages/editor-ui/src/router.ts | 16 +- packages/editor-ui/src/views/NodeView.vue | 27 +- .../src/views/TemplatesCollectionView.vue | 11 +- .../src/views/TemplatesSearchView.vue | 32 +- .../editor-ui/src/views/TemplatesView.vue | 23 +- .../src/views/TemplatesWorkflowView.vue | 10 +- packages/editor-ui/src/views/canvasHelpers.ts | 40 +- 37 files changed, 1341 insertions(+), 911 deletions(-) create mode 100644 packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts create mode 100644 packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue create mode 100644 packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts create mode 100644 packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap create mode 100644 packages/design-system/src/components/N8nActionDropdown/index.ts create mode 100644 packages/editor-ui/public/n8n-logo-collapsed.svg create mode 100644 packages/editor-ui/public/n8n-logo-expanded.svg delete mode 100644 packages/editor-ui/src/components/CredentialsList.vue diff --git a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts new file mode 100644 index 0000000000000..149d255ba0f20 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts @@ -0,0 +1,72 @@ +import N8nActionDropdown from "./ActionDropdown.vue"; +import { StoryFn } from '@storybook/vue'; + +export default { + title: 'Atoms/ActionDropdown', + component: N8nActionDropdown, + argTypes: { + placement: { + control: { + type: 'select', + options: ['top', 'top-end', 'top-start', 'bottom', 'bottom-end', 'bottom-start'], + }, + }, + activatorIcon: { + control: { + type: 'text', + }, + }, + trigger: { + control: { + type: 'select', + options: ['click', 'hover'], + }, + }, + }, +}; + +const template: StoryFn = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { + N8nActionDropdown, + }, + template: ``, +}); + +export const defaultActionDropdown = template.bind({}); +defaultActionDropdown.args = { + items: [ + { + id: 'item1', + label: 'Action 1', + }, + { + id: 'item2', + label: 'Action 2', + }, + ], +}; + +export const customStyling = template.bind({}); +customStyling.args = { + activatorIcon: 'bars', + items: [ + { + id: 'item1', + label: 'Action 1', + icon: 'thumbs-up', + }, + { + id: 'item2', + label: 'Action 2', + icon: 'thumbs-down', + disabled: true, + }, + { + id: 'item3', + label: 'Action 3', + icon: 'heart', + divided: true, + }, + ], +}; diff --git a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue new file mode 100644 index 0000000000000..0ae8705fed129 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts b/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts new file mode 100644 index 0000000000000..8af723b476b47 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts @@ -0,0 +1,52 @@ +import { render } from '@testing-library/vue'; +import N8nActionDropdown from '../ActionDropdown.vue'; + +describe('components', () => { + describe('N8nActionDropdown', () => { + it('should render default styling correctly', () => { + const wrapper = render(N8nActionDropdown, { + props: { + items: [ + { + id: 'item1', + label: 'Action 1', + }, + { + id: 'item2', + label: 'Action 2', + }, + ], + }, + stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'], + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + it('should render custom styling correctly', () => { + const wrapper = render(N8nActionDropdown, { + props: { + items: [ + { + id: 'item1', + label: 'Action 1', + icon: 'thumbs-up', + }, + { + id: 'item2', + label: 'Action 2', + icon: 'thumbs-down', + disabled: true, + }, + { + id: 'item3', + label: 'Action 3', + icon: 'heart', + divided: true, + }, + ], + }, + stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'], + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + }); +}); diff --git a/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap b/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap new file mode 100644 index 0000000000000..cfeb3fa9eedaf --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap @@ -0,0 +1,42 @@ +// Vitest Snapshot v1 + +exports[`components > N8nActionDropdown > should render custom styling correctly 1`] = ` +"
+ +
+ +
+ + +
Action 1
+
+ +
Action 2
+
+ +
Action 3
+
+
+
+
" +`; + +exports[`components > N8nActionDropdown > should render default styling correctly 1`] = ` +"
+ +
+ +
+ + +
+ Action 1
+
+ +
+ Action 2
+
+
+
+
" +`; diff --git a/packages/design-system/src/components/N8nActionDropdown/index.ts b/packages/design-system/src/components/N8nActionDropdown/index.ts new file mode 100644 index 0000000000000..e0b58950d4a3c --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/index.ts @@ -0,0 +1,2 @@ +import N8nActionDropdown from './ActionDropdown.vue'; +export default N8nActionDropdown; diff --git a/packages/design-system/src/css/reset.scss b/packages/design-system/src/css/reset.scss index 6688cb9621eef..546de883be185 100644 --- a/packages/design-system/src/css/reset.scss +++ b/packages/design-system/src/css/reset.scss @@ -15,7 +15,7 @@ html { body { height: 100%; width: 100%; - overscroll-behavior-x: none; + overscroll-behavior: none; line-height: 1; font-size: var(--font-size-m); font-weight: var(--font-weight-regular); diff --git a/packages/design-system/src/plugins/n8nComponents.ts b/packages/design-system/src/plugins/n8nComponents.ts index 15816855de02e..990b7311d95e4 100644 --- a/packages/design-system/src/plugins/n8nComponents.ts +++ b/packages/design-system/src/plugins/n8nComponents.ts @@ -1,5 +1,6 @@ import Vue from 'vue'; import N8nActionBox from '../components/N8nActionBox'; +import N8nActionDropdown from '../components/N8nActionDropdown'; import N8nActionToggle from '../components/N8nActionToggle'; import N8nAvatar from '../components/N8nAvatar'; import N8nBadge from "../components/N8nBadge"; @@ -46,6 +47,7 @@ export default { install: (app: typeof Vue, options?: {}) => { app.component('n8n-info-accordion', N8nInfoAccordion); app.component('n8n-action-box', N8nActionBox); + app.component('n8n-action-dropdown', N8nActionDropdown); app.component('n8n-action-toggle', N8nActionToggle); app.component('n8n-avatar', N8nAvatar); app.component('n8n-badge', N8nBadge); diff --git a/packages/editor-ui/public/favicon.ico b/packages/editor-ui/public/favicon.ico index 0b4949e8fda9502820e15173974133a76dc48bc6..e5f92d7f5eb2ef4b436d8ae237005633363903f7 100644 GIT binary patch literal 15086 zcmeI2du$X{6o;o2XrVlcfPmHR5~yN$q=-OcKoB8-XdppD1eHewQKC{Y0TQ*u3YDM` zf>9tr5d={YB>aJfL@EgQKudh_60{cNWwaH10BgtZw>!7Y4ofL%w_V6g^7Y)ux%ZxX z=FYvdXKGnVRueWm#4*=;YHa>kwt>NYziSZ&`Ct=!6bUtZ|_7@YOLQ z{J*{jd=K~@@IByr!1sXffvdp-xx-F0fUYna#>4H<>`Is$cD99ua2(3PhSRVKdMEN6 zu&*hs0@*D7f>QX;$^U@tmZ)>UwlQ$Vv2_D-0Ne_5;1p<1uLEz^b$?-p)_Gr;4J%*| z$VU0Oy|IwA^p=6@4nn4>t1F2OX^;^{M*{y zw@Fhz6!e^iV6>}TzWNYkr}oZcAb*=@x`cEeqwkf}$p_Da_AT|{ri}d4;9Zw@Qnuft zt9J6?Mz}u4I8z<{lgO^_dh%KD9=L7LJd0qMTi2VW{$V%;8vg*i0*gUDP??^!!KNMQ z43N)N_a|uFd9V#MrpgyVva5~On9d^AX`Qz;bw*Ow1O~wj$bdq#rR;yF-Vz8Rw?B>nyC^!u{A zKg#s{FL&x>uhye5KGwe7&eP@|M@M#Qe$qE~t86P=(x>h|FO{ahE8YGpef=cF^BZfO zur`{(5SR(i!6>LWK{508`H4u$ZEhhNFd#+^`c){#zzrJ%Zf5QvwpvHE2^`TGShK9n7mv6}jN z?!L%B<+M41?BcGgjWlC6fW9yrR)TDFvx@wF(7cKu!`MYydyR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X}qH9Elh(%UUQ+miiJegh{B^Af{+j8VB5c)dZWBPmG9-M_?xC#MiEaxwKJ?N@oQ;-Pv(ugddqwz#adsB=) zxCFJ3Tfg(&fbJD2-cUH<5`VDs`BM(x!hp-u>m^(l4dbh|Pr+;GU1YEf1+n!z<#MwYaw^N%19THGn`eu!&Y2kO0-Z;tr<8$G2L8Vca2{4cO`+e` zLNn&hbA6-cz=FqP3a!>qt zn1|M4#Ap6~P@Wa{M?7gI5BgZh2b?bOx@gO|?gTqvT~r^H8H+ia>OB2M^olzU>w@ku z7rIM)hfdHv=nd#MsEzstiBvhdi;!wR9}0$p-qDJqWx}(C&GK7>RdjXy^mV@ zH4wlNh(*V|j9xkW?C&keYe8#8mzj3(duFD|m9M4E^cC-uL-MGf^KV-G6n}>J74k#Y znic;G=q@G{|EX%+*)+MF;iol(zgwa4d))7HkGYhm3DADp{63IXAJSciqworp|80ND zzxP*rC|i@w_;kT;?#SW)3G7?-Hw-qOtv}7%uRF8%r_UK0-iy7B^3fF;Z*}i>uKxU( zT4LyIxCx=Zt5xkY_Z}g~pamAZ9}DNnG&-BLdHMzKUvx||J{=I&2<=Yr^*oSoTWFs- z^Uj~JW|SwPobq0$t2Dp9MfBgm%R=Mj`$f-R@;efRII3aoKm7h^9msmWCi3SgMxQv_ zK{@yUs%6!$*0bn5Dn@+GNvt+de8ttf-5VU6&DD6Z;zsAqz6a^`wBcD39V^MD43sjk z@)@v8KAC!JQ){gK_SM>Pn0|3?@?HJq^EYgBU44k;Gn4NhS^MG%Hg(v7rEfnjHT^GE C-e)!d diff --git a/packages/editor-ui/public/n8n-logo-collapsed.svg b/packages/editor-ui/public/n8n-logo-collapsed.svg new file mode 100644 index 0000000000000..62e0c21bb7486 --- /dev/null +++ b/packages/editor-ui/public/n8n-logo-collapsed.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/editor-ui/public/n8n-logo-expanded.svg b/packages/editor-ui/public/n8n-logo-expanded.svg new file mode 100644 index 0000000000000..29dbf38f910e8 --- /dev/null +++ b/packages/editor-ui/public/n8n-logo-expanded.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index f48dcfb2176f7..a03bbf4d37f5c 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -1,14 +1,21 @@