Files
Verso/services/web/frontend/js/shared/components/sidebar/sidebar-lower-section.tsx
T
claudeandClaude Opus 4.8 12cabd1d1b
Build and Deploy Verso / deploy (push) Successful in 9m21s
Branding: build-number version, EB Garamond title, blue filters, Present button
- Instance name: stamp the nav title with the build number at deploy time
  ("Verso V0.<run> alpha") via a sed placeholder fed by GITHUB_RUN_NUMBER,
  instead of the static "Verso V1.0 Alpha".

- Title typeface: self-host the EB Garamond latin subset (same one embedded in
  the logo SVGs) and apply it to .navbar-title so the instance name matches the
  Verso wordmark.

- Sidebar wordmark: let the logo fill the full sidebar column width (drop the
  160px cap).

- Project filters: switch the ds-nav active state (filter selection + theme
  toggle) from the green tokens to the blue scale, matching the rail.

- Present button: rename the presentation toolbar action from "Preview" to
  "Present" / "Présenter" and add a tooltip explaining it publishes the
  presentation and opens it in a new tab. New keys present /
  present_publishes_and_opens_in_new_tab in en, fr and extracted-translations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 22:32:07 +00:00

152 lines
4.9 KiB
TypeScript

import { type Ref, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Question, User } from '@phosphor-icons/react'
import { Dropdown } from 'react-bootstrap'
import getMeta from '@/utils/meta'
import OLTooltip from '@/shared/components/ol/ol-tooltip'
import { NavDropdownMenuItems } from '@/shared/components/navbar/nav-dropdown-from-data'
import { NavbarDropdownItemData } from '@/shared/components/types/navbar'
import { useContactUsModal } from '@/shared/hooks/use-contact-us-modal'
import { UserProvider } from '@/shared/context/user-context'
import { AccountMenuItems } from '@/shared/components/navbar/account-menu-items'
import { sendMB } from '@/infrastructure/event-tracking'
import { useActiveOverallTheme } from '@/shared/hooks/use-active-overall-theme'
import versoLogo from '@/shared/svgs/verso-logo.svg'
import versoLogoDark from '@/shared/svgs/verso-logo-dark.svg'
export function SidebarLowerSection({
showThemeToggle = false,
accountRef,
onAccountOpen,
children,
}: {
showThemeToggle?: boolean
accountRef?: Ref<HTMLDivElement>
onAccountOpen?: () => void
children?: React.ReactNode
}) {
const { t } = useTranslation()
const [showAccountDropdown, setShowAccountDropdown] = useState(false)
const [showHelpDropdown, setShowHelpDropdown] = useState(false)
const { showModal: showContactUsModal, modal: contactUsModal } =
useContactUsModal({
autofillProjectUrl: false,
})
const { sessionUser, showSubscriptionLink, items } = getMeta('ol-navbar')
const { appName } = getMeta('ol-ExposedSettings')
const activeOverallTheme = useActiveOverallTheme()
const helpItem = items.find(
item => item.text === 'help_and_resources'
) as NavbarDropdownItemData
return (
<>
{children}
<nav
className="d-flex flex-row gap-3 mb-2"
aria-label={t('account_help')}
>
{helpItem && (
<Dropdown
className="ds-nav-icon-dropdown"
onToggle={show => {
setShowHelpDropdown(show)
if (show) {
sendMB('menu-expand', { item: 'help', location: 'sidebar' })
}
}}
role="menu"
>
<Dropdown.Toggle role="menuitem" aria-label={t('help')}>
<OLTooltip
description={t('help')}
id="help-icon"
overlayProps={{
placement: 'top',
}}
hidden={showHelpDropdown}
>
<div>
<Question size={24} />
</div>
</OLTooltip>
</Dropdown.Toggle>
<Dropdown.Menu
as="ul"
role="menu"
align="end"
popperConfig={{
modifiers: [{ name: 'offset', options: { offset: [0, 5] } }],
}}
>
<NavDropdownMenuItems
dropdown={helpItem.dropdown}
showContactUsModal={showContactUsModal}
location="sidebar"
/>
</Dropdown.Menu>
</Dropdown>
)}
{sessionUser && (
<Dropdown
className="ds-nav-icon-dropdown"
onToggle={show => {
setShowAccountDropdown(show)
if (show) {
sendMB('menu-expand', {
item: 'account',
location: 'sidebar',
})
onAccountOpen?.()
}
}}
role="menu"
>
<Dropdown.Toggle role="menuitem" aria-label={t('Account')}>
<OLTooltip
description={t('Account')}
id="open-account"
overlayProps={{
placement: 'top',
}}
hidden={showAccountDropdown}
>
<div ref={accountRef}>
<User size={24} />
</div>
</OLTooltip>
</Dropdown.Toggle>
<Dropdown.Menu
as="ul"
role="menu"
align="end"
popperConfig={{
modifiers: [{ name: 'offset', options: { offset: [-50, 5] } }],
}}
>
<AccountMenuItems
sessionUser={sessionUser}
showSubscriptionLink={showSubscriptionLink}
showThemeToggle={showThemeToggle}
/>
</Dropdown.Menu>
</Dropdown>
)}
</nav>
<a
href="/"
className="ds-nav-verso-logo"
aria-label={appName}
style={{ display: 'block', marginTop: 'var(--spacing-03)' }}
>
<img
src={activeOverallTheme === 'dark' ? versoLogoDark : versoLogo}
alt={appName}
style={{ width: '100%', height: 'auto' }}
/>
</a>
<UserProvider>{contactUsModal}</UserProvider>
</>
)
}