diff --git a/static/app/components/demo/demoHeader.tsx b/static/app/components/demo/demoHeader.tsx index b3ccab954a77ff..3be364240fc74a 100644 --- a/static/app/components/demo/demoHeader.tsx +++ b/static/app/components/demo/demoHeader.tsx @@ -95,9 +95,7 @@ const Wrapper = styled('div')<{collapsed: boolean}>` white-space: nowrap; gap: ${space(4)}; - margin-left: calc( - -1 * ${p => (p.collapsed ? p.theme.sidebar.collapsedWidth : p.theme.sidebar.expandedWidth)} - ); + margin-left: calc(-1 * ${p => p.theme.sidebar.width}); position: fixed; width: 100%; diff --git a/static/app/components/sidebar/broadcasts.tsx b/static/app/components/sidebar/broadcasts.tsx index 539e25284918d8..039eac22118b1e 100644 --- a/static/app/components/sidebar/broadcasts.tsx +++ b/static/app/components/sidebar/broadcasts.tsx @@ -115,7 +115,7 @@ class Broadcasts extends Component { } render() { - const {orientation, collapsed, currentPanel, hidePanel} = this.props; + const {orientation, collapsed, currentPanel, hidePanel, hasNewNav} = this.props; const {broadcasts, loading} = this.state; const unseenPosts = this.unseenIds; @@ -130,7 +130,8 @@ class Broadcasts extends Component { active={currentPanel === SidebarPanelKey.BROADCASTS} badge={unseenPosts.length} icon={} - label={t("What's new")} + hasNewNav={hasNewNav} + label={hasNewNav ? t('New') : t("What's new")} onClick={this.handleShowPanel} id="broadcasts" /> diff --git a/static/app/components/sidebar/help.tsx b/static/app/components/sidebar/help.tsx index a1f8ad92560f70..287d8ee88a1d09 100644 --- a/static/app/components/sidebar/help.tsx +++ b/static/app/components/sidebar/help.tsx @@ -20,7 +20,13 @@ type Props = Pick< organization: Organization; }; -function SidebarHelp({orientation, collapsed, hidePanel, organization}: Props) { +function SidebarHelp({ + orientation, + collapsed, + hidePanel, + organization, + hasNewNav, +}: Props) { return ( {({isOpen, getActorProps, getMenuProps}) => ( @@ -31,6 +37,7 @@ function SidebarHelp({orientation, collapsed, hidePanel, organization}: Props) { orientation={orientation} collapsed={collapsed} hasPanel={false} + hasNewNav={hasNewNav} icon={} label={t('Help')} id="help" diff --git a/static/app/components/sidebar/index.tsx b/static/app/components/sidebar/index.tsx index 3c922f24bdb7dd..0b0b61aa12241d 100644 --- a/static/app/components/sidebar/index.tsx +++ b/static/app/components/sidebar/index.tsx @@ -2,7 +2,6 @@ import {Fragment, useCallback, useContext, useEffect} from 'react'; import {css} from '@emotion/react'; import styled from '@emotion/styled'; -import {hideSidebar, showSidebar} from 'sentry/actionCreators/preferences'; import Feature from 'sentry/components/acl/feature'; import GuideAnchor from 'sentry/components/assistant/guideAnchor'; import {Chevron} from 'sentry/components/chevron'; @@ -36,7 +35,6 @@ import {t} from 'sentry/locale'; import ConfigStore from 'sentry/stores/configStore'; import DemoWalkthroughStore from 'sentry/stores/demoWalkthroughStore'; import HookStore from 'sentry/stores/hookStore'; -import PreferencesStore from 'sentry/stores/preferencesStore'; import SidebarPanelStore from 'sentry/stores/sidebarPanelStore'; import {useLegacyStore} from 'sentry/stores/useLegacyStore'; import {space} from 'sentry/styles/space'; @@ -115,15 +113,13 @@ function useOpenOnboardingSidebar(organization?: Organization) { function Sidebar() { const location = useLocation(); - const preferences = useLegacyStore(PreferencesStore); const activePanel = useLegacyStore(SidebarPanelStore); const organization = useOrganization({allowNull: true}); const {shouldAccordionFloat} = useContext(ExpandedContext); - const hasNewNav = organization?.features.includes('navigation-sidebar-v2'); + const hasNewNav = true; const hasOrganization = !!organization; const isSelfHostedErrorsOnly = ConfigStore.get('isSelfHostedErrorsOnly'); - const collapsed = hasNewNav ? true : !!preferences.collapsed; const horizontal = useMedia(`(max-width: ${theme.breakpoints.medium})`); // Panel determines whether to highlight const hasPanel = !!activePanel; @@ -131,10 +127,10 @@ function Sidebar() { const sidebarItemProps = { orientation, - collapsed, hasPanel, organization, hasNewNav, + collapsed: true, }; // Avoid showing superuser UI on self-hosted instances const showSuperuserWarning = () => { @@ -148,13 +144,7 @@ function Sidebar() { useOpenOnboardingSidebar(); - const toggleCollapse = useCallback(() => { - if (collapsed) { - showSidebar(); - } else { - hideSidebar(); - } - }, [collapsed]); + const toggleCollapse = useCallback(() => {}, []); // Close panel on any navigation useEffect(() => void hidePanel(), [location?.pathname]); @@ -175,19 +165,6 @@ function Sidebar() { }); }, [location?.hash]); - // Add sidebar collapse classname to body - useEffect(() => { - const bcl = document.body.classList; - - if (collapsed) { - bcl.add('collapsed'); - } else { - bcl.remove('collapsed'); - } - - return () => bcl.remove('collapsed'); - }, [collapsed]); - // Add sidebar hasNewNav classname to body useEffect(() => { const bcl = document.body.classList; @@ -540,7 +517,7 @@ function Sidebar() { {...sidebarItemProps} index icon={} - label={hasNewNav ? 'Dash.' : t('Dashboards')} + label={hasNewNav ? 'Boards' : t('Dashboards')} to={`/organizations/${organization.slug}/dashboards/`} id="customizable-dashboards" /> @@ -628,22 +605,17 @@ function Sidebar() { ); + const collapsed = true; + return ( - + - + {showSuperuserWarning() && !isExcludedOrg() && ( @@ -659,39 +631,34 @@ function Sidebar() { {!isSelfHostedErrorsOnly && ( - - - {explore} - {insights} - - - - {performance} - {feedback} - {monitors} - {alerts} - {dashboards} - {releases} - - + + {explore} + {insights} + {performance} + {feedback} + {monitors} + {alerts} + {dashboards} + {releases} + )} {isSelfHostedErrorsOnly && ( - - - {alerts} - {discover2} - {dashboards} - {releases} - {userFeedback} - - + + {alerts} + {discover2} + {dashboards} + {releases} + {userFeedback} + )} - - {stats} - {settings} - + {!hasNewNav && ( + + {stats} + {settings} + + )} )} @@ -749,12 +716,14 @@ function Sidebar() { organization, })} togglePanel(SidebarPanelKey.SERVICE_INCIDENTS)} hidePanel={hidePanel} /> + {hasNewNav && ( + + {stats} + {settings} + + )} {!horizontal && !hasNewNav && ( @@ -805,15 +781,8 @@ export const SidebarWrapper = styled('nav')<{collapsed: boolean; hasNewNav?: boo background: ${p => p.theme.sidebarGradient}; color: ${p => p.theme.sidebar.color}; line-height: 1; - padding: 12px 0 2px; /* Allows for 32px avatars */ - width: ${p => - p.theme.sidebar[ - p.hasNewNav - ? 'semiCollapsedWidth' - : p.collapsed - ? 'collapsedWidth' - : 'expandedWidth' - ]}; + padding: 16px 8px; + width: ${p => p.theme.sidebar.width}; position: fixed; top: ${p => (ConfigStore.get('demoMode') ? p.theme.demo.headerSize : 0)}; left: 0; @@ -840,8 +809,8 @@ export const SidebarWrapper = styled('nav')<{collapsed: boolean; hasNewNav?: boo const SidebarSectionGroup = styled('div')<{hasNewNav?: boolean}>` ${responsiveFlex}; flex-shrink: 0; /* prevents shrinking on Safari */ - gap: 1px; - ${p => p.hasNewNav && `align-items: center;`} + gap: 8px; + ${p => p.hasNewNav && `flex-direction: column; align-items: stretch;`} `; const SidebarSectionGroupPrimary = styled('div')` @@ -863,7 +832,7 @@ const PrimaryItems = styled('div')` flex: 1; display: flex; flex-direction: column; - gap: 1px; + gap: ${space(1)}; -ms-overflow-style: -ms-autohiding-scrollbar; @media (max-height: 675px) and (min-width: ${p => p.theme.breakpoints.medium}) { border-bottom: 1px solid ${p => p.theme.sidebarBorder}; @@ -905,6 +874,8 @@ const SidebarSection = styled(SidebarSectionGroup)<{ }>` ${p => !p.noMargin && !p.hasNewNav && `margin: ${space(1)} 0`}; ${p => !p.noPadding && !p.hasNewNav && `padding: 0 ${space(2)}`}; + align-items: stretch; + gap: ${space(1)}; @media (max-width: ${p => p.theme.breakpoints.small}) { margin: 0; diff --git a/static/app/components/sidebar/serviceIncidents.tsx b/static/app/components/sidebar/serviceIncidents.tsx index 7382cd606d4b7f..becce636d0f769 100644 --- a/static/app/components/sidebar/serviceIncidents.tsx +++ b/static/app/components/sidebar/serviceIncidents.tsx @@ -21,6 +21,7 @@ function ServiceIncidents({ hidePanel, collapsed, orientation, + hasNewNav, }: Props) { const {data: incidents} = useServiceIncidents({statusFilter: 'unresolved'}); @@ -43,6 +44,7 @@ function ServiceIncidents({ collapsed={collapsed} active={active} icon={} + hasNewNav={hasNewNav} label={t('Service status')} onClick={onShowPanel} /> diff --git a/static/app/components/sidebar/sidebarDropdown/index.tsx b/static/app/components/sidebar/sidebarDropdown/index.tsx index 729b0688233ff0..8ea2825bcf0584 100644 --- a/static/app/components/sidebar/sidebarDropdown/index.tsx +++ b/static/app/components/sidebar/sidebarDropdown/index.tsx @@ -66,7 +66,7 @@ export default function SidebarDropdown({orientation, collapsed, hideOrgLinks}: collapsed={collapsed} organization={org ?? undefined} user={!org ? user : undefined} - size={32} + size={38} round={false} /> ) : ( @@ -201,7 +201,7 @@ const UserBadgeNoOverflow = styled(IdBadge)` const SidebarDropdownRoot = styled('div')` position: relative; - padding: 0 3px; /* align org icon with sidebar item icons */ + padding: 0; /* align org icon with sidebar item icons */ `; // So that long org names and user names do not overflow @@ -244,8 +244,9 @@ const SidebarDropdownActor = styled('button')` `; const StyledAvatar = styled(Avatar)<{collapsed: boolean}>` - margin: ${space(0.25)} 0; + margin: 0; margin-right: ${p => (p.collapsed ? '0' : space(1.5))}; + margin-bottom: ${space(1)}; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08); border-radius: 6px; /* Fixes background bleeding on corners */ diff --git a/static/app/components/sidebar/sidebarItem.tsx b/static/app/components/sidebar/sidebarItem.tsx index 5bf969bb8991e1..2d78dbebf1e8f7 100644 --- a/static/app/components/sidebar/sidebarItem.tsx +++ b/static/app/components/sidebar/sidebarItem.tsx @@ -387,49 +387,18 @@ const StyledSidebarItem = styled(Link, { shouldForwardProp: p => typeof p === 'string' && isPropValid(p), })` display: flex; + align-self: center; + justify-content: center; color: ${p => (p.isInFloatingAccordion ? p.theme.gray400 : 'inherit')}; position: relative; cursor: pointer; - font-size: 15px; - height: ${p => (p.isInFloatingAccordion ? '35px' : p.hasNewNav ? '40px' : '30px')}; + font-size: 11px; + height: 52px; + width: 100%; flex-shrink: 0; + flex-grow: 1; border-radius: ${p => p.theme.borderRadius}; transition: none; - ${p => { - if (!p.hasNewNav) { - return css` - &:before { - display: block; - content: ''; - position: absolute; - top: 4px; - left: calc(-${space(2)} - 1px); - bottom: 6px; - width: 5px; - border-radius: 0 3px 3px 0; - background-color: transparent; - transition: 0.15s background-color linear; - } - `; - } - return css` - margin: ${space(2)} 0; - width: 100px; - align-self: center; - `; - }} - - @media (max-width: ${p => p.theme.breakpoints.medium}) { - &:before { - top: auto; - left: 5px; - bottom: -12px; - height: 5px; - width: auto; - right: 5px; - border-radius: 3px 3px 0 0; - } - } &:hover, &:focus-visible { @@ -452,7 +421,7 @@ const StyledSidebarItem = styled(Link, { &:focus-visible { outline: none; - box-shadow: 0 0 0 2px ${p => p.theme.purple300}; + box-shadow: inset 0 0 0 2px ${p => p.theme.purple300}; } ${getActiveStyle}; @@ -477,10 +446,11 @@ const SidebarItemIcon = styled('span')<{hasNewNav?: boolean}>` justify-content: center; flex-shrink: 0; width: 37px; + padding: 6px 8px; svg { display: block; - margin: 0 auto; + margin: auto; width: 18px; height: 18px; } @@ -554,6 +524,7 @@ const CollapsedFeatureBadge = styled(FeatureBadge)` `; const StyledInteractionStateLayer = styled(InteractionStateLayer)` - height: ${16 * 2 + 40}px; - width: 70px; + height: 53px; + width: 58px; + border-radius: ${p => p.theme.borderRadius}; `; diff --git a/static/app/components/sidebar/sidebarPanel.tsx b/static/app/components/sidebar/sidebarPanel.tsx index a4fb5e3a0ff2b6..e5e8f8357fc8cf 100644 --- a/static/app/components/sidebar/sidebarPanel.tsx +++ b/static/app/components/sidebar/sidebarPanel.tsx @@ -35,9 +35,7 @@ const PanelContainer = styled('div')` : css` width: 460px; top: 0; - left: ${p.collapsed - ? p.theme.sidebar.collapsedWidth - : p.theme.sidebar.expandedWidth}; + left: ${p.theme.sidebar.width}; `}; `; diff --git a/static/app/utils/theme.tsx b/static/app/utils/theme.tsx index fbe53a4db0506c..3b5ea26d34928a 100644 --- a/static/app/utils/theme.tsx +++ b/static/app/utils/theme.tsx @@ -806,8 +806,8 @@ const commonTheme = { badgeSize: '22px', smallBadgeSize: '11px', collapsedWidth: '70px', - semiCollapsedWidth: '100px', - expandedWidth: '220px', + width: '80px', + panelWidth: '150px', mobileHeightNumber: 54, mobileHeight: '54px', menuSpacing: '15px', diff --git a/static/app/views/replays/detail/layout/utils.tsx b/static/app/views/replays/detail/layout/utils.tsx index 7646862204b095..4700a9d4c4982f 100644 --- a/static/app/views/replays/detail/layout/utils.tsx +++ b/static/app/views/replays/detail/layout/utils.tsx @@ -1,13 +1,10 @@ import {LayoutKey} from 'sentry/utils/replays/hooks/useReplayLayout'; import theme from 'sentry/utils/theme'; -export const getDefaultLayout = (collapsed: boolean): LayoutKey => { +export const getDefaultLayout = (_collapsed: boolean): LayoutKey => { const {innerWidth, innerHeight} = window; - const sidebarWidth = parseInt( - collapsed ? theme.sidebar.collapsedWidth : theme.sidebar.expandedWidth, - 10 - ); + const sidebarWidth = parseInt(theme.sidebar.width, 10); const mediumScreenWidth = parseInt(theme.breakpoints.medium, 10); diff --git a/static/less/layout.less b/static/less/layout.less index e8b0a44b8ad8d5..f42b2d1f8ad130 100644 --- a/static/less/layout.less +++ b/static/less/layout.less @@ -7,8 +7,9 @@ body { &.collapsed { padding-left: @sidebar-collapsed-width; } + &.hasNewNav { - padding-left: @sidebar-semi-collapsed-width; + padding-left: @sidebar-v2-width; } } @@ -42,8 +43,13 @@ body.narrow { &.collapsed { padding-left: @sidebar-collapsed-width; } + &.hasNewNav { - padding-left: @sidebar-semi-collapsed-width; + padding-left: calc(@sidebar-v2-width + @sidebar-v2-panel-width); + + &.collapsed { + padding-left: @sidebar-v2-width; + } } } @@ -56,7 +62,7 @@ body.narrow { line-height: 1.2; } - .app > .container { + .app>.container { padding-top: 40px; max-width: 860px; @@ -114,7 +120,7 @@ body.narrow { /* Integration templates use body.auth! */ body.auth { - .app > .container { + .app>.container { padding-top: 5vh; max-width: 740px; } @@ -136,11 +142,9 @@ body.auth { padding-top: 20px; width: 60px; background: #564f64; - background-image: linear-gradient( - -180deg, - rgba(52, 44, 62, 0) 0%, - rgba(52, 44, 62, 0.5) 100% - ); + background-image: linear-gradient(-180deg, + rgba(52, 44, 62, 0) 0%, + rgba(52, 44, 62, 0.5) 100%); box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.1); border-radius: 4px 0 0 4px; margin-top: -1px; @@ -220,7 +224,7 @@ body.auth { align-items: center; margin-top: 20px; - > .btn { + >.btn { margin-right: 6px; } @@ -243,11 +247,11 @@ body.auth { margin-left: auto; margin-right: 0; - > a { + >a { display: flex; align-items: center; - > svg { + >svg { height: 17px; width: 20px; margin-right: 5px; @@ -304,7 +308,7 @@ body.auth { */ .windowed-small { - .app > .container { + .app>.container { padding-top: 60px !important; max-width: 600px !important; margin: 0 auto; @@ -415,18 +419,18 @@ body.auth { padding: 0 14px; } - .narrow .app > .container, - .narrow.windowed-small .app > .container { + .narrow .app>.container, + .narrow.windowed-small .app>.container { padding-top: 30px !important; } - .narrow.dialog .app > .container, - .narrow.dialog.windowed-small .app > .container { + .narrow.dialog .app>.container, + .narrow.dialog.windowed-small .app>.container { padding-top: 10px !important; } .nav-tabs { - > li { + >li { text-transform: capitalize; margin-right: 11px; @@ -458,7 +462,7 @@ body.auth { padding-left: 30px; } - .app > .container { + .app>.container { .box-content.with-padding { padding: 20px 20px 10px; } @@ -486,7 +490,7 @@ body.auth { padding-left: 20px; padding-right: 20px; - > div { + >div { width: 100%; padding: 0; margin: 0; @@ -507,7 +511,7 @@ body.auth { .join-request { margin-left: auto; - > a > svg { + >a>svg { height: 16px; width: 19px; margin-right: 4px; diff --git a/static/less/variables.less b/static/less/variables.less index 03c430c5fbccf6..e48959d980c08d 100644 --- a/static/less/variables.less +++ b/static/less/variables.less @@ -34,6 +34,8 @@ // // Sets up sidebar offsets +@sidebar-v2-width: 80px; +@sidebar-v2-panel-width: 150px; @sidebar-collapsed-width: 70px; @sidebar-semi-collapsed-width: 100px; @sidebar-expanded-width: 220px;