From 7a5f3dcc8e3d16af1feae67a735746e7113b1a31 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Wed, 26 Oct 2022 12:56:48 +0200 Subject: [PATCH] change(ui) - header menu --- .../app/components/Header/SiteDropdown.js | 126 +++++++++--------- .../components/Header/UserMenu/UserMenu.tsx | 6 +- .../components/Header/siteDropdown.module.css | 22 +-- 3 files changed, 80 insertions(+), 74 deletions(-) diff --git a/frontend/app/components/Header/SiteDropdown.js b/frontend/app/components/Header/SiteDropdown.js index dafd5e7bb..8b90114a0 100644 --- a/frontend/app/components/Header/SiteDropdown.js +++ b/frontend/app/components/Header/SiteDropdown.js @@ -17,74 +17,76 @@ import NewProjectButton from './NewProjectButton'; @withStore @withRouter @connect( - (state) => ({ - sites: state.getIn(['site', 'list']), - siteId: state.getIn(['site', 'siteId']), - account: state.getIn(['user', 'account']), - }), - { - setSiteId, - pushNewSite, - init, - clearSearch, - clearSearchLive, - fetchIntegrationVariables, - } + (state) => ({ + sites: state.getIn(['site', 'list']), + siteId: state.getIn(['site', 'siteId']), + account: state.getIn(['user', 'account']), + }), + { + setSiteId, + pushNewSite, + init, + clearSearch, + clearSearchLive, + fetchIntegrationVariables, + } ) export default class SiteDropdown extends React.PureComponent { - state = { showProductModal: false }; + state = { showProductModal: false }; - closeModal = (e, newSite) => { - this.setState({ showProductModal: false }); - }; + closeModal = (e, newSite) => { + this.setState({ showProductModal: false }); + }; - newSite = () => { - this.props.init({}); - this.setState({ showProductModal: true }); - }; + newSite = () => { + this.props.init({}); + this.setState({ showProductModal: true }); + }; - switchSite = (siteId) => { - const { mstore, location } = this.props; + switchSite = (siteId) => { + const { mstore, location } = this.props; - this.props.setSiteId(siteId); - this.props.fetchIntegrationVariables(); - this.props.clearSearch(location.pathname.includes('/sessions')); - this.props.clearSearchLive(); + this.props.setSiteId(siteId); + this.props.fetchIntegrationVariables(); + this.props.clearSearch(location.pathname.includes('/sessions')); + this.props.clearSearchLive(); - mstore.initClient(); + mstore.initClient(); + }; + + render() { + const { + sites, + siteId, + account, + location: { pathname }, + } = this.props; + const isAdmin = account.admin || account.superAdmin; + const activeSite = sites.find((s) => s.id == siteId); + const disabled = !siteChangeAvaliable(pathname); + const showCurrent = hasSiteId(pathname) || siteChangeAvaliable(pathname); + + return ( +
+
+
+ {showCurrent && activeSite ? activeSite.host : 'All Projects'} +
+ +
+
    + {isAdmin && } +
    + {sites.map((site) => ( +
  • this.switchSite(site.id)}> + + {site.host} +
  • + ))} +
+
+
+
+ ); } - - render() { - const { - sites, - siteId, - account, - location: { pathname }, - } = this.props; - const isAdmin = account.admin || account.superAdmin; - const activeSite = sites.find((s) => s.id == siteId); - const disabled = !siteChangeAvaliable(pathname); - const showCurrent = hasSiteId(pathname) || siteChangeAvaliable(pathname); - - return ( -
-
{showCurrent && activeSite ? activeSite.host : 'All Projects'}
- -
-
    - {isAdmin && ( - - )} -
    - {sites.map((site) => ( -
  • this.switchSite(site.id)}> - - {site.host} -
  • - ))} -
-
-
- ); - } } diff --git a/frontend/app/components/Header/UserMenu/UserMenu.tsx b/frontend/app/components/Header/UserMenu/UserMenu.tsx index eba80b19b..9c5fac9cb 100644 --- a/frontend/app/components/Header/UserMenu/UserMenu.tsx +++ b/frontend/app/components/Header/UserMenu/UserMenu.tsx @@ -30,12 +30,14 @@ function UserMenu(props: RouteComponentProps) {
{getInitials(account.name)}
-
+
{account.name}
{account.email}
-
{account.superAdmin ? 'Super Admin' : account.admin ? 'Admin' : 'Member'}
+
+ {account.superAdmin ? 'Super Admin' : account.admin ? 'Admin' : 'Member'} +
diff --git a/frontend/app/components/Header/siteDropdown.module.css b/frontend/app/components/Header/siteDropdown.module.css index 6b5d10e81..850aa072e 100644 --- a/frontend/app/components/Header/siteDropdown.module.css +++ b/frontend/app/components/Header/siteDropdown.module.css @@ -3,21 +3,20 @@ align-items: center; /* border-left: solid thin $gray-light !important; */ padding: 10px; - min-width: 180px; + width: fit-content; justify-content: flex-start; position: relative; user-select: none; - border: solid thin transparent; - height: 32px; - border: solid thin $gray-light; + height: 50px; + /* border: solid thin $gray-light; */ border-radius: 3px; - margin: 10px; + margin: 0 10px; cursor: pointer; &:hover { background-color: $active-blue; /* border: solid thin $active-blue-border; */ - & .drodownIcon { + & .dropdownIcon { transform: rotate(180deg); transition: all 0.2s; } @@ -26,10 +25,10 @@ } } - & .drodownIcon { + & .dropdownIcon { transition: all 0.4s; margin: 0; - margin-left: auto; + margin-left: 8px; } & [data-can-disable=true] { @@ -46,13 +45,13 @@ & .menu { display: none; position: absolute; - top: 32px; + top: 50px; left: -1px; background-color: white; min-width: 200px; z-index: 2; border-radius: 3px; - border: 1px solid $gray-light; + border: 1px solid rgb(238, 238, 238); } & ul { @@ -76,6 +75,7 @@ transition: all 0.2s; line-height: 16px; border-radius: 3px; + text-transform: capitalize; &:hover { background-color: $active-blue; @@ -105,6 +105,8 @@ text-overflow: ellipsis; overflow: hidden; white-space: nowrap; + font-weight: 500; + text-transform: capitalize; } .statusGreenIcon {