diff --git a/browser/CHANGELOG.md b/browser/CHANGELOG.md index 7325938fd2..ca9df93429 100644 --- a/browser/CHANGELOG.md +++ b/browser/CHANGELOG.md @@ -4,6 +4,11 @@ This changelog covers all five packages, as they are (for now) updated as a whol ## UNRELEASED +- The sidebar's App panel is gone. Its entries (your user page, Notifications, + Integrations, Sync, Feedback, About and Install App) now live in a dropdown + that opens from the user row at the bottom of the sidebar, with Settings as a + gear button beside it. A dot on the row shows unread notifications. + - Pasting an agent secret that opens a different agent than the signed-in account no longer signs that account out on its own. The app now says which account is signed in, shows both agents, and lets the user stay signed in or diff --git a/browser/data-browser/src/components/Dialog/index.tsx b/browser/data-browser/src/components/Dialog/index.tsx index b31320b871..72125c4196 100644 --- a/browser/data-browser/src/components/Dialog/index.tsx +++ b/browser/data-browser/src/components/Dialog/index.tsx @@ -28,9 +28,9 @@ import { CurrentBackgroundColor } from '../../globalCssVars'; import { timeoutEffect } from '@helpers/timeoutEffect'; import { useAndroidBack } from '../../helpers/androidBack'; -const FeedbackMenuItem = lazy(() => - import('../SideBar/FeedbackMenuItem').then(module => ({ - default: module.FeedbackMenuItem, +const FeedbackButton = lazy(() => + import('../SideBar/FeedbackButton').then(module => ({ + default: module.FeedbackButton, })), ); @@ -280,7 +280,7 @@ const InnerDialog: React.FC> = ({ {show && rootWelcomeChromeHidden && !hideOnboardingFeedback && ( - + )} diff --git a/browser/data-browser/src/components/ErrorLook.tsx b/browser/data-browser/src/components/ErrorLook.tsx index 7afeda5dea..6bcd641816 100644 --- a/browser/data-browser/src/components/ErrorLook.tsx +++ b/browser/data-browser/src/components/ErrorLook.tsx @@ -6,9 +6,9 @@ import { FaTriangleExclamation } from 'react-icons/fa6'; import { lazy, Suspense, type JSX } from 'react'; import { getMessageForErrorType } from '@tomic/react'; -const FeedbackMenuItem = lazy(() => - import('./SideBar/FeedbackMenuItem').then(module => ({ - default: module.FeedbackMenuItem, +const FeedbackButton = lazy(() => + import('./SideBar/FeedbackButton').then(module => ({ + default: module.FeedbackButton, })), ); @@ -60,7 +60,7 @@ export function ErrorBlock({ {showReport && ( - + )} diff --git a/browser/data-browser/src/components/OnboardingFeedback.tsx b/browser/data-browser/src/components/OnboardingFeedback.tsx index 2e0f33ddef..3bb42b57ec 100644 --- a/browser/data-browser/src/components/OnboardingFeedback.tsx +++ b/browser/data-browser/src/components/OnboardingFeedback.tsx @@ -1,11 +1,11 @@ import { styled } from 'styled-components'; -import { FeedbackMenuItem } from './SideBar/FeedbackMenuItem'; +import { FeedbackButton } from './SideBar/FeedbackButton'; /** Shared corner placement for onboarding pages and their dialogs. */ export function OnboardingFeedback() { return ( - + ); } diff --git a/browser/data-browser/src/components/SideBar/AccountMenu.tsx b/browser/data-browser/src/components/SideBar/AccountMenu.tsx new file mode 100644 index 0000000000..111a2d0219 --- /dev/null +++ b/browser/data-browser/src/components/SideBar/AccountMenu.tsx @@ -0,0 +1,355 @@ +import { + createContext, + useCallback, + useContext, + useEffect, + useRef, + useState, + type JSX, + type RefObject, +} from 'react'; +import { styled } from 'styled-components'; +import { + FaBell, + FaCirclePlus, + FaComment, + FaGear, + FaInfo, + FaPlug, + FaUser, +} from 'react-icons/fa6'; +import { LuChevronsUpDown } from 'react-icons/lu'; +import { + core, + unknownSubject, + useCurrentAgent, + useResource, +} from '@tomic/react'; +import { paths } from '../../routes/paths'; +import { shortcuts } from '../../actions/shortcuts'; +import { useNavigateWithTransition } from '../../hooks/useNavigateWithTransition'; +import { useInbox } from '../../hooks/useInbox'; +import { DIVIDER, DropdownMenu, type DropdownItem } from '../Dropdown'; +import type { DropdownTriggerProps } from '../Dropdown/DropdownTrigger'; +import { IconButton } from '../IconButton/IconButton'; +import { ResourceGlyph } from '../ResourceGlyph'; +import { useCombineRefs } from '../../hooks/useCombineRefs'; +import { useFeedbackDialog } from './FeedbackButton'; +import { getSyncIcon, getSyncLabel, useSyncStatus } from './syncStatus'; +import { + SideBarMenuRow, + SideBarMenuRowIcon, + SideBarMenuRowLabel, +} from './SideBarMenuItem'; + +// Non standard event type so we have to type it ourselfs for now. +type BeforeInstallPromptEvent = { + preventDefault: () => void; + prompt: () => Promise<{ outcome: 'accepted' | 'dismissed' }>; +}; + +export interface AccountMenuProps { + /** Called after an item navigates somewhere. Used for closing the sidebar. */ + onItemClick: () => void; +} + +interface AccountTriggerContextValue { + /** Lets the feedback dialog return focus to the trigger when it closes. */ + triggerRef: RefObject; + unread: number; +} + +const AccountTriggerContext = createContext({ + triggerRef: { current: null }, + unread: 0, +}); + +/** + * The bottom row of the sidebar: the current user, which opens a menu with + * everything app-wide (profile, notifications, integrations, sync, feedback, + * about), and a Settings button beside it. + */ +export function AccountMenu(props: AccountMenuProps): JSX.Element { + const [agent] = useCurrentAgent(); + + return agent ? ( + + ) : ( + + ); +} + +/** Notifications only exist for a signed-in user, so only then read the inbox. */ +function SignedInAccountMenu(props: AccountMenuProps): JSX.Element { + const { unread } = useInbox(); + + return ; +} + +function AccountMenuRow({ + onItemClick, + unread, +}: AccountMenuProps & { unread: number }): JSX.Element { + const [agent] = useCurrentAgent(); + const navigate = useNavigateWithTransition(); + const syncStatus = useSyncStatus(); + const triggerRef = useRef(null); + const feedback = useFeedbackDialog({ triggerRef }); + const [install, showInstallButton] = useInstallPrompt(); + + const goTo = (path: string) => () => { + navigate(path); + onItemClick(); + }; + + const unreadLabel = + unread > 0 ? `Notifications, ${unread} unread` : undefined; + + const items: DropdownItem[] = [ + agent + ? { + id: 'profile', + label: 'Profile', + icon: , + helper: 'See and edit the current Agent / User', + shortcut: shortcuts.userSettings, + onClick: goTo(paths.agentSettings), + } + : { + id: 'login', + label: 'Login / New User', + icon: , + helper: 'Sign in, or create a new Agent / User', + onClick: goTo(paths.agentSettings), + }, + ...(agent + ? [ + { + id: 'notifications', + label: 'Notifications', + icon: , + helper: unreadLabel ?? 'Messages, comments and replies for you', + onClick: goTo(paths.notifications), + suffix: unread > 0 && ( + + {unread > 99 ? '99+' : unread} + + ), + }, + ] + : []), + DIVIDER, + { + id: 'integrations', + label: 'Integrations', + icon: , + helper: 'Discover published integrations', + onClick: goTo(paths.integrations), + }, + { + id: 'sync', + label: 'Sync', + // The status is in the tooltip; hiding the icon's own title keeps the + // item's accessible name "Sync". + icon: {getSyncIcon(syncStatus)}, + helper: getSyncLabel(syncStatus), + onClick: goTo(paths.sync), + }, + DIVIDER, + { + id: 'feedback', + label: 'Feedback', + icon: , + helper: 'Report a bug or suggest an improvement', + onClick: feedback.open, + }, + { + id: 'about', + label: 'About', + icon: , + helper: 'Welcome page, tells about this app', + onClick: goTo(paths.about), + }, + ...(showInstallButton + ? [ + { + id: 'install-app', + label: 'Install App', + icon: , + helper: 'Install app to desktop', + onClick: install, + }, + ] + : []), + ]; + + return ( + + + + + + + + {feedback.dialog} + + ); +} + +/** The user row: avatar and name. Opens the account menu. */ +function AccountTrigger({ + onClick, + menuId, + isActive, + ref, + id, +}: DropdownTriggerProps): JSX.Element { + const { triggerRef, unread } = useContext(AccountTriggerContext); + const combinedRef = useCombineRefs([ref, triggerRef]); + const [agent] = useCurrentAgent(); + const agentResource = useResource(agent?.subject ?? unknownSubject); + const name = agent + ? (agentResource.get(core.properties.name) ?? 'User') + : 'Login / New User'; + + return ( + + + {agent ? ( + // Your own avatar, by the same precedence every other resource + // row uses (icon image > emoji > class icon). `fallbackIcon` + // keeps the plain person glyph for agents without a picture. + + + + ) : ( + + )} + + {name} + {unread > 0 && } + + + ); +} + +/** + * Offers "Install App" when the browser fires `beforeinstallprompt`. Returns + * the install function and whether installing is possible. + */ +function useInstallPrompt(): [install: () => void, available: boolean] { + const event = useRef(null); + const [available, setAvailable] = useState(false); + + const install = useCallback(() => { + if (!event.current) { + return; + } + + event.current.prompt().then(result => { + if (result.outcome === 'accepted') { + setAvailable(false); + } + }); + }, []); + + useEffect(() => { + const listener = (e: Event) => { + e.preventDefault(); + setAvailable(true); + event.current = e as unknown as BeforeInstallPromptEvent; + }; + + window.addEventListener('beforeinstallprompt', listener); + + return () => window.removeEventListener('beforeinstallprompt', listener); + }, []); + + return [install, available]; +} + +const Row = styled.div` + display: flex; + align-items: center; + gap: 0.25rem; + box-sizing: border-box; + width: 100%; + min-width: 0; +`; + +const TriggerButton = styled(SideBarMenuRow)` + flex: 1; + border: 0; + font: inherit; + cursor: pointer; + gap: 0.25rem; + padding-inline-end: 0.5rem; + + &:focus-visible { + outline: 2px solid ${p => p.theme.colors.main}; + outline-offset: -2px; + } + + &[aria-expanded='true'] { + background-color: ${p => p.theme.colors.bg1}; + } +`; + +const IconSlot = styled.span` + display: inline-flex; +`; + +const UnreadDot = styled.span` + flex-shrink: 0; + width: 0.5rem; + height: 0.5rem; + border-radius: 50%; + background: ${p => p.theme.colors.main}; +`; + +const Count = styled.span` + flex-shrink: 0; + min-width: 1.2rem; + padding: 0 0.35rem; + border-radius: 999px; + background: ${p => p.theme.colors.main}; + color: white; + font-size: 0.7rem; + font-weight: 600; + line-height: 1.2rem; + text-align: center; +`; + +/** + * Sizes the avatar to the row rather than letting it inherit: `IconImg` is + * `1.2em`, and `SideBarMenuRowIcon` only shrinks `svg` children, so an image + * glyph would otherwise sit noticeably larger than the icons beside it. + */ +const AgentGlyphSlot = styled.span` + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 0.9rem; + line-height: 1; +`; diff --git a/browser/data-browser/src/components/SideBar/AppMenu.tsx b/browser/data-browser/src/components/SideBar/AppMenu.tsx deleted file mode 100644 index 0e600340bd..0000000000 --- a/browser/data-browser/src/components/SideBar/AppMenu.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { useCallback, useEffect, useRef, useState, type JSX } from 'react'; -import { styled } from 'styled-components'; -import { FaGear, FaInfo, FaCirclePlus, FaUser, FaPlug } from 'react-icons/fa6'; -import { constructOpenURL } from '../../helpers/navigation'; -import { useCurrentSubject } from '../../helpers/useCurrentSubject'; -import { SideBarMenuItem } from './SideBarMenuItem'; -import { paths } from '../../routes/paths'; -import { - core, - unknownSubject, - useCurrentAgent, - useResource, -} from '@tomic/react'; -import { FeedbackMenuItem } from './FeedbackMenuItem'; -import { SyncMenuItem } from './SyncMenuItem'; -import { NotificationsMenuItem } from './NotificationsMenuItem'; -import { ResourceGlyph } from '../ResourceGlyph'; - -// Non standard event type so we have to type it ourselfs for now. -type BeforeInstallPromptEvent = { - preventDefault: () => void; - prompt: () => Promise<{ outcome: 'accepted' | 'dismissed' }>; -}; - -export interface AppMenuProps { - onItemClick: () => void; -} - -export function AppMenu({ onItemClick }: AppMenuProps): JSX.Element { - const event = useRef(null); - const [subject] = useCurrentSubject(); - const [showInstallButton, setShowInstallButton] = useState(false); - const [agent] = useCurrentAgent(); - const agentResource = useResource(agent?.subject ?? unknownSubject); - const install = useCallback(() => { - if (!event.current) { - return; - } - - event.current.prompt().then(result => { - if (result.outcome === 'accepted') { - setShowInstallButton(false); - } - }); - }, []); - - useEffect(() => { - const listener = (e: Event) => { - e.preventDefault(); - setShowInstallButton(true); - event.current = e as unknown as BeforeInstallPromptEvent; - }; - - window.addEventListener('beforeinstallprompt', listener); - - return () => window.removeEventListener('beforeinstallprompt', listener); - }, []); - - return ( - - emoji > class icon). `fallbackIcon` - // keeps the plain person glyph for agents without a picture. - - - - ) : ( - - ) - } - label={ - agent - ? (agentResource.get(core.properties.name) ?? 'User') - : 'Login / New User' - } - helper='See and edit the current Agent / User (u)' - path={paths.agentSettings} - onClick={onItemClick} - /> - {agent && } - } - label='Settings' - helper='Change client settings (t)' - path={paths.appSettings} - onClick={onItemClick} - /> - } - label='Integrations' - helper='Discover published integrations' - path={paths.integrations} - onClick={onItemClick} - /> - - - } - label='About' - helper='Welcome page, tells about this app' - path={paths.about} - onClick={onItemClick} - /> - {showInstallButton && ( - } - label='Install App' - helper='Install app to desktop' - path={constructOpenURL(subject ?? window.location.href)} - onClick={install} - /> - )} - - ); -} - -const AppMenuSection = styled.section` - box-sizing: border-box; - width: 100%; - min-width: 0; -`; - -/** - * Sizes the avatar to the row rather than letting it inherit: `IconImg` is - * `1.2em`, and `SideBarMenuRowIcon` only shrinks `svg` children, so an image - * glyph would otherwise sit noticeably larger than the icons beside it. - */ -const AgentGlyphSlot = styled.span` - display: inline-flex; - align-items: center; - justify-content: center; - font-size: 0.9rem; - line-height: 1; -`; diff --git a/browser/data-browser/src/components/SideBar/FeedbackButton.tsx b/browser/data-browser/src/components/SideBar/FeedbackButton.tsx new file mode 100644 index 0000000000..0fdc13a8a5 --- /dev/null +++ b/browser/data-browser/src/components/SideBar/FeedbackButton.tsx @@ -0,0 +1,170 @@ +import { useId, useRef, useState, type RefObject } from 'react'; +import { FaComment } from 'react-icons/fa6'; +import * as Sentry from '@sentry/react'; +import { + Dialog, + DialogTitle, + DialogContent, + DialogActions, + useDialog, +} from '../Dialog'; +import { + InputStyled, + InputWrapper, + TextAreaStyled, +} from '../forms/InputStyles'; +import { Button } from '../Button'; +import { Column } from '../Row'; +import { errorFeedbackMessage, submitFeedback } from '../../helpers/feedback'; + +interface UseFeedbackDialogOptions { + /** Prefills the message with details of this error. */ + reportError?: Error; + /** Receives focus again when the dialog closes. */ + triggerRef?: RefObject; +} + +/** + * The "Send feedback" dialog. Returns a function that opens it and the dialog + * element, which the caller renders. Used by {@link FeedbackButton} and by the + * sidebar account menu. + */ +export function useFeedbackDialog({ + reportError, + triggerRef, +}: UseFeedbackDialogOptions = {}) { + const feedbackTitle = reportError ? 'Report this error' : 'Send feedback'; + const messageId = useId(); + const emailId = useId(); + const emailRef = useRef(null); + const [dialogProps, showDialog, hideDialog] = useDialog({ + triggerRef: triggerRef as RefObject, + }); + const [message, setMessage] = useState(''); + const [email, setEmail] = useState(''); + const [busy, setBusy] = useState(false); + const [failed, setFailed] = useState(false); + const [sent, setSent] = useState(false); + const enabled = Sentry.isEnabled(); + + async function send() { + if (!emailRef.current?.reportValidity()) return; + setBusy(true); + setFailed(false); + + try { + await submitFeedback(message, email, reportError ? 'error' : 'sidebar'); + setSent(true); + setMessage(''); + } catch { + setFailed(true); + } finally { + setBusy(false); + } + } + + function open() { + setSent(false); + if (reportError) setMessage(errorFeedbackMessage(reportError)); + showDialog(); + } + + const dialog = ( + + +

{feedbackTitle}

+
+ + {sent ? ( +

Thank you. Your feedback has been received.

+ ) : ( + +

+ Report a bug or suggest an improvement. Your message and optional + email go to the Atomic team through Sentry. Please leave out + private workspace content. +

+ + + {!enabled && ( +

+ Feedback reporting is unavailable on this installation. Email{' '} + + {/* @wc-ignore */ 'info@ontola.io'} + + . +

+ )} + {failed && ( +

+ Feedback could not be sent. Your text is still here. Try again + or email{' '} + + {/* @wc-ignore */ 'info@ontola.io'} + + . +

+ )} +
+ )} +
+ + + {!sent && ( + + )} + +
+ ); + + return { open, dialog }; +} + +/** A floating "Feedback" button that opens the feedback dialog. */ +export function FeedbackButton({ reportError }: { reportError?: Error }) { + const triggerRef = useRef(null); + const { open, dialog } = useFeedbackDialog({ reportError, triggerRef }); + + return ( + <> + + {dialog} + + ); +} diff --git a/browser/data-browser/src/components/SideBar/FeedbackMenuItem.tsx b/browser/data-browser/src/components/SideBar/FeedbackMenuItem.tsx deleted file mode 100644 index e39480659a..0000000000 --- a/browser/data-browser/src/components/SideBar/FeedbackMenuItem.tsx +++ /dev/null @@ -1,172 +0,0 @@ -import { useId, useRef, useState } from 'react'; -import { FaComment } from 'react-icons/fa6'; -import * as Sentry from '@sentry/react'; -import { - Dialog, - DialogTitle, - DialogContent, - DialogActions, - useDialog, -} from '../Dialog'; -import { - InputStyled, - InputWrapper, - TextAreaStyled, -} from '../forms/InputStyles'; -import { Button } from '../Button'; -import { Column } from '../Row'; -import { - SideBarMenuRow, - SideBarMenuRowIcon, - SideBarMenuRowLabel, -} from './SideBarMenuItem'; -import { errorFeedbackMessage, submitFeedback } from '../../helpers/feedback'; - -export function FeedbackMenuItem({ - floating = false, - reportError, -}: { - floating?: boolean; - reportError?: Error; -}) { - const feedbackTitle = reportError ? 'Report this error' : 'Send feedback'; - const messageId = useId(); - const emailId = useId(); - const triggerRef = useRef(null); - const emailRef = useRef(null); - const [dialogProps, showDialog, hideDialog] = useDialog({ triggerRef }); - const [message, setMessage] = useState(''); - const [email, setEmail] = useState(''); - const [busy, setBusy] = useState(false); - const [failed, setFailed] = useState(false); - const [sent, setSent] = useState(false); - const enabled = Sentry.isEnabled(); - - async function send() { - if (!emailRef.current?.reportValidity()) return; - setBusy(true); - setFailed(false); - - try { - await submitFeedback(message, email, reportError ? 'error' : 'sidebar'); - setSent(true); - setMessage(''); - } catch { - setFailed(true); - } finally { - setBusy(false); - } - } - - function open() { - setSent(false); - if (reportError) setMessage(errorFeedbackMessage(reportError)); - showDialog(); - } - - return ( - <> - {floating ? ( - - ) : ( - - - - - Feedback - - )} - - -

{feedbackTitle}

-
- - {sent ? ( -

Thank you. Your feedback has been received.

- ) : ( - -

- Report a bug or suggest an improvement. Your message and - optional email go to the Atomic team through Sentry. Please - leave out private workspace content. -

- - - {!enabled && ( -

- Feedback reporting is unavailable on this installation. Email{' '} - - {/* @wc-ignore */ 'info@ontola.io'} - - . -

- )} - {failed && ( -

- Feedback could not be sent. Your text is still here. Try again - or email{' '} - - {/* @wc-ignore */ 'info@ontola.io'} - - . -

- )} -
- )} -
- - - {!sent && ( - - )} - -
- - ); -} diff --git a/browser/data-browser/src/components/SideBar/NotificationsMenuItem.tsx b/browser/data-browser/src/components/SideBar/NotificationsMenuItem.tsx deleted file mode 100644 index c2fb3e94d0..0000000000 --- a/browser/data-browser/src/components/SideBar/NotificationsMenuItem.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { styled } from 'styled-components'; -import { FaBell } from 'react-icons/fa6'; -import { SideBarMenuItem } from './SideBarMenuItem'; -import { paths } from '../../routes/paths'; -import { useInbox } from '../../hooks/useInbox'; - -/** Opens the Notifications page; shows how many are unread. */ -export function NotificationsMenuItem({ - onClick, -}: { - onClick: () => void; -}): React.JSX.Element { - const { unread } = useInbox(); - const label = unread > 0 ? `Notifications, ${unread} unread` : undefined; - - return ( - } - label='Notifications' - helper={label ?? 'Messages, comments and replies for you'} - path={paths.notifications} - onClick={onClick} - suffix={ - unread > 0 && ( - {unread > 99 ? '99+' : unread} - ) - } - /> - ); -} - -const Count = styled.span` - flex-shrink: 0; - min-width: 1.2rem; - padding: 0 0.35rem; - border-radius: 999px; - background: ${p => p.theme.colors.main}; - color: white; - font-size: 0.7rem; - font-weight: 600; - line-height: 1.2rem; - text-align: center; -`; diff --git a/browser/data-browser/src/components/SideBar/SharedWithMeLink.tsx b/browser/data-browser/src/components/SideBar/SharedWithMeLink.tsx index 5913355246..39988464b8 100644 --- a/browser/data-browser/src/components/SideBar/SharedWithMeLink.tsx +++ b/browser/data-browser/src/components/SideBar/SharedWithMeLink.tsx @@ -14,7 +14,7 @@ type SharedWithMeLinkProps = { 'data-testid'?: string; }; -/** One shared resource: same row layout as {@link SideBarMenuItem} (icon + label). */ +/** One shared resource: same row layout as {@link SideBarMenuRow} (icon + label). */ export function SharedWithMeLink({ subject, onClick, diff --git a/browser/data-browser/src/components/SideBar/SideBarHomePanels.tsx b/browser/data-browser/src/components/SideBar/SideBarHomePanels.tsx index 0797fc0bea..ccffa46ab6 100644 --- a/browser/data-browser/src/components/SideBar/SideBarHomePanels.tsx +++ b/browser/data-browser/src/components/SideBar/SideBarHomePanels.tsx @@ -12,7 +12,7 @@ interface SideBarHomePanelsProps { /** * The per-user "home index" panels — Favorites and Shared-with-me — read from * the user's PRIVATE DRIVE (see {@link usePrivateDriveList}). Rendered in the - * sidebar's bottom-pinned area (above App settings) rather than scrolling with + * sidebar's bottom-pinned area (above the account menu) rather than scrolling with * the active drive's tree, since they are cross-drive and not part of the * current drive's contents. */ diff --git a/browser/data-browser/src/components/SideBar/SideBarMenuItem.tsx b/browser/data-browser/src/components/SideBar/SideBarMenuItem.tsx index b726890d36..dd9b4186d4 100644 --- a/browser/data-browser/src/components/SideBar/SideBarMenuItem.tsx +++ b/browser/data-browser/src/components/SideBar/SideBarMenuItem.tsx @@ -1,7 +1,6 @@ import { styled } from 'styled-components'; -import { AtomicLink, AtomicLinkProps } from '../AtomicLink'; +import { AtomicLink } from '../AtomicLink'; import { SideBarItem } from './SideBarItem'; -import { useLocation } from '@tanstack/react-router'; /** Full-width row; matches resource links in the tree (clean AtomicLink is inline by default). */ export const SideBarMenuItemLink = styled(AtomicLink)` @@ -27,48 +26,7 @@ export const SideBarMenuRowLabel = styled.span` text-align: start; `; -export interface SideBarMenuItemProps extends AtomicLinkProps { - label: string; - helper?: string; - icon?: React.ReactNode; - disabled?: boolean; - /** Is called when clicking on the item. Used for closing the menu. */ - onClick?: () => void; - /** Shown at the end of the row, e.g. a count. */ - suffix?: React.ReactNode; -} - -export function SideBarMenuItem({ - helper, - label, - icon, - path, - href, - subject, - onClick, - suffix, -}: SideBarMenuItemProps) { - const { pathname } = useLocation(); - const targetPath = path || href || subject; - const current: boolean = pathname === targetPath; - - return ( - - - {icon && {icon}} - {label} - {suffix} - - - ); -} - -/** Icon column for APP menu rows and Shared with me (matches tree LeadingSlot). */ +/** Icon column for sidebar menu rows (account, Shared with me) (matches tree LeadingSlot). */ export const SideBarMenuRowIcon = styled.span` display: inline-flex; align-items: center; diff --git a/browser/data-browser/src/components/SideBar/index.tsx b/browser/data-browser/src/components/SideBar/index.tsx index f151742d5a..ca2dc2becf 100644 --- a/browser/data-browser/src/components/SideBar/index.tsx +++ b/browser/data-browser/src/components/SideBar/index.tsx @@ -9,7 +9,7 @@ import { useResizable, } from '../../hooks/useResizable'; import { useCombineRefs } from '../../hooks/useCombineRefs'; -import { AppMenu } from './AppMenu'; +import { AccountMenu } from './AccountMenu'; import { SideBarHomePanels } from './SideBarHomePanels'; import { useMediaQuery } from '../../hooks/useMediaQuery'; import { useSidebarSwipe } from '../../hooks/useSidebarSwipe'; @@ -127,11 +127,7 @@ export function SideBar(): JSX.Element { )} - - - - - + {!isRearanging && ( diff --git a/browser/data-browser/src/components/SideBar/SyncMenuItem.tsx b/browser/data-browser/src/components/SideBar/syncStatus.tsx similarity index 81% rename from browser/data-browser/src/components/SideBar/SyncMenuItem.tsx rename to browser/data-browser/src/components/SideBar/syncStatus.tsx index 00d87704cf..8f4841f662 100644 --- a/browser/data-browser/src/components/SideBar/SyncMenuItem.tsx +++ b/browser/data-browser/src/components/SideBar/syncStatus.tsx @@ -3,14 +3,9 @@ import { StoreEvents, type StoreSyncStatus, useStore } from '@tomic/react'; import { FaWifi, FaArrowsRotate, FaCircleExclamation } from 'react-icons/fa6'; import { MdSignalWifiOff } from 'react-icons/md'; import { styled, keyframes } from 'styled-components'; -import { paths } from '../../routes/paths'; -import { SideBarMenuItem } from './SideBarMenuItem'; - -export function SyncMenuItem({ - onClick, -}: { - onClick?: () => void; -}): JSX.Element { + +/** The store's sync status, kept up to date as connection and sync change. */ +export function useSyncStatus(): StoreSyncStatus { const store = useStore(); const [status, setStatus] = useState(() => store.getSyncStatus(), @@ -33,21 +28,10 @@ export function SyncMenuItem({ }; }, [store]); - const icon = getSyncIcon(status); - const label = getSyncLabel(status); - - return ( - - ); + return status; } -function getSyncIcon(status: StoreSyncStatus): JSX.Element { +export function getSyncIcon(status: StoreSyncStatus): JSX.Element { if (!status.serverConnected) { return ( @@ -83,7 +67,7 @@ function getSyncIcon(status: StoreSyncStatus): JSX.Element { return ; } -function getSyncLabel(status: StoreSyncStatus): string { +export function getSyncLabel(status: StoreSyncStatus): string { if (!status.serverConnected) return 'Offline'; if (status.syncInProgress) return 'Syncing...'; diff --git a/browser/data-browser/src/locales/de.po b/browser/data-browser/src/locales/de.po index 03b95ff94f..8c6affdf00 100644 --- a/browser/data-browser/src/locales/de.po +++ b/browser/data-browser/src/locales/de.po @@ -566,8 +566,8 @@ msgstr "" #: src/components/AI/ProviderStatus.tsx #: src/components/AI/ProviderStatus.tsx -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Connected" @@ -737,7 +737,6 @@ msgid "Ontologies" msgstr "" #: src/chunks/AppPage/AppFrame.tsx -#: src/components/SideBar/index.tsx msgid "App" msgstr "" @@ -828,43 +827,42 @@ msgstr "" #~ msgid "User Settings" #~ msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Login / New User" msgstr "" -#: src/components/SideBar/AppMenu.tsx -msgid "See and edit the current Agent / User (u)" -msgstr "" +#~ msgid "See and edit the current Agent / User (u)" +#~ msgstr "" #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Settings" msgstr "" -#: src/components/SideBar/AppMenu.tsx -msgid "Change client settings (t)" -msgstr "" +#~ msgid "Change client settings (t)" +#~ msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "About" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Welcome page, tells about this app" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install App" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install app to desktop" msgstr "" -#: src/components/SideBar/AppMenu.tsx -msgid "App menu" -msgstr "" +#~ msgid "App menu" +#~ msgstr "" #: src/components/SideBar/SideBarDrive.tsx msgid "Unauthorized" @@ -1369,28 +1367,28 @@ msgstr "" #: src/chunks/PluginRuns/IntegrationConnection.tsx #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SyncRoute.tsx msgid "Sync" msgstr "" -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Offline" msgstr "" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Changes could not sync" msgstr "" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx msgid "Changes pending" msgstr "" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Syncing..." msgstr "" @@ -4064,12 +4062,12 @@ msgid "Create Invite" msgstr "" #. 0: status.blockedCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes could not sync (no access)" msgstr "" #. 0: status.pendingDirtyCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes pending" msgstr "" @@ -4525,7 +4523,7 @@ msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx #: src/chunks/PluginRuns/RunPluginDialog.tsx #: src/chunks/TablePage/Issues/IssueRow.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx #: src/components/pairing/PairingFlowProvider.tsx #: src/routes/NewDriveRoute.tsx msgid "Close" @@ -6703,42 +6701,42 @@ msgstr "" msgid "Local stays on your devices. Vault is encrypted backup. Server hosts a readable copy. Remote is another connected server." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Send feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Sending feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Thank you. Your feedback has been received." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback could not be sent. Your text is still here. Try again or email" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report a bug or suggest an improvement. Your message and optional email go to the Atomic team through Sentry. Please leave out private workspace content." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback <0/>" msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Email for a reply (optional) <0/>" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback reporting is unavailable on this installation. Email" msgstr "" @@ -7734,12 +7732,12 @@ msgstr "" msgid "Dismiss" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/IntegrationStore.tsx msgid "Integrations" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Discover published integrations" msgstr "" @@ -11620,7 +11618,7 @@ msgid "AI settings…" msgstr "" #: src/actions/appActions.ts -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SettingsAgent.tsx msgid "User" msgstr "" @@ -11663,8 +11661,8 @@ msgstr "" msgid "Local copy unavailable" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report this error" msgstr "" @@ -12427,7 +12425,7 @@ msgstr "" #: src/components/Notifications/NotificationList.tsx #: src/components/Notifications/NotificationList.tsx -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Notifications" msgstr "" @@ -12480,11 +12478,11 @@ msgid "Mark all as read" msgstr "" #. 0: unread -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Notifications, {0} unread" msgstr "" -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Messages, comments and replies for you" msgstr "" @@ -12504,3 +12502,23 @@ msgstr "Dein Arbeitsbereich konnte nicht in dein Konto übernommen werden. Versu #: src/components/IdentityReconcileGate.tsx msgid "Lets {0} edit the drives made on this browser, then switches to that identity. Everything stays editable and is backed up with your account." msgstr "Erlaubt {0}, die in diesem Browser erstellten Drives zu bearbeiten, und wechselt dann zu dieser Identität. Alles bleibt bearbeitbar und wird mit deinem Konto gesichert." + +#: src/components/SideBar/AccountMenu.tsx +msgid "Profile" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "See and edit the current Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Sign in, or create a new Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Report a bug or suggest an improvement" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Account and app menu" +msgstr "" diff --git a/browser/data-browser/src/locales/en.po b/browser/data-browser/src/locales/en.po index 66776c5f04..d4158c4db5 100644 --- a/browser/data-browser/src/locales/en.po +++ b/browser/data-browser/src/locales/en.po @@ -566,8 +566,8 @@ msgstr "Not configured" #: src/components/AI/ProviderStatus.tsx #: src/components/AI/ProviderStatus.tsx -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Connected" @@ -737,7 +737,6 @@ msgid "Ontologies" msgstr "Ontologies" #: src/chunks/AppPage/AppFrame.tsx -#: src/components/SideBar/index.tsx msgid "App" msgstr "App" @@ -828,43 +827,42 @@ msgstr "Click to enlarge" #~ msgid "User Settings" #~ msgstr "User Settings" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Login / New User" msgstr "Login / New User" -#: src/components/SideBar/AppMenu.tsx -msgid "See and edit the current Agent / User (u)" -msgstr "See and edit the current Agent / User (u)" +#~ msgid "See and edit the current Agent / User (u)" +#~ msgstr "See and edit the current Agent / User (u)" #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Settings" msgstr "Settings" -#: src/components/SideBar/AppMenu.tsx -msgid "Change client settings (t)" -msgstr "Change client settings (t)" +#~ msgid "Change client settings (t)" +#~ msgstr "Change client settings (t)" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "About" msgstr "About" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Welcome page, tells about this app" msgstr "Welcome page, tells about this app" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install App" msgstr "Install App" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install app to desktop" msgstr "Install app to desktop" -#: src/components/SideBar/AppMenu.tsx -msgid "App menu" -msgstr "App menu" +#~ msgid "App menu" +#~ msgstr "App menu" #: src/components/SideBar/SideBarDrive.tsx msgid "Unauthorized" @@ -1369,28 +1367,28 @@ msgstr "Document" #: src/chunks/PluginRuns/IntegrationConnection.tsx #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SyncRoute.tsx msgid "Sync" msgstr "Sync" -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Offline" msgstr "Offline" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Changes could not sync" msgstr "Changes could not sync" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx msgid "Changes pending" msgstr "Changes pending" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Syncing..." msgstr "Syncing..." @@ -4075,12 +4073,12 @@ msgid "Create Invite" msgstr "Create Invite" #. 0: status.blockedCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes could not sync (no access)" msgstr "{0} changes could not sync (no access)" #. 0: status.pendingDirtyCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes pending" msgstr "{0} changes pending" @@ -4536,7 +4534,7 @@ msgstr "Open workspace" #: src/chunks/AI/ReportAIChatDialog.tsx #: src/chunks/PluginRuns/RunPluginDialog.tsx #: src/chunks/TablePage/Issues/IssueRow.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx #: src/components/pairing/PairingFlowProvider.tsx #: src/routes/NewDriveRoute.tsx msgid "Close" @@ -6714,42 +6712,42 @@ msgstr "Storage and hosting" msgid "Local stays on your devices. Vault is encrypted backup. Server hosts a readable copy. Remote is another connected server." msgstr "Local stays on your devices. Vault is encrypted backup. Server hosts a readable copy. Remote is another connected server." -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback" msgstr "Feedback" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Send feedback" msgstr "Send feedback" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Sending feedback" msgstr "Sending feedback" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Thank you. Your feedback has been received." msgstr "Thank you. Your feedback has been received." -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback could not be sent. Your text is still here. Try again or email" msgstr "Feedback could not be sent. Your text is still here. Try again or email" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report a bug or suggest an improvement. Your message and optional email go to the Atomic team through Sentry. Please leave out private workspace content." msgstr "Report a bug or suggest an improvement. Your message and optional email go to the Atomic team through Sentry. Please leave out private workspace content." -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback <0/>" msgstr "Feedback <0/>" #: src/chunks/AI/ReportAIChatDialog.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Email for a reply (optional) <0/>" msgstr "Email for a reply (optional) <0/>" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback reporting is unavailable on this installation. Email" msgstr "Feedback reporting is unavailable on this installation. Email" @@ -7745,12 +7743,12 @@ msgstr "Fix it" msgid "Dismiss" msgstr "Dismiss" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/IntegrationStore.tsx msgid "Integrations" msgstr "Integrations" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Discover published integrations" msgstr "Discover published integrations" @@ -11659,7 +11657,7 @@ msgid "AI settings…" msgstr "AI settings…" #: src/actions/appActions.ts -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SettingsAgent.tsx msgid "User" msgstr "User" @@ -11702,8 +11700,8 @@ msgstr "This workspace could not be read on this device" msgid "Local copy unavailable" msgstr "Local copy unavailable" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report this error" msgstr "Report this error" @@ -12473,7 +12471,7 @@ msgstr "Use this secret and sign out" #: src/components/Notifications/NotificationList.tsx #: src/components/Notifications/NotificationList.tsx -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Notifications" msgstr "Notifications" @@ -12526,11 +12524,11 @@ msgid "Mark all as read" msgstr "Mark all as read" #. 0: unread -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Notifications, {0} unread" msgstr "Notifications, {0} unread" -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Messages, comments and replies for you" msgstr "Messages, comments and replies for you" @@ -12550,3 +12548,23 @@ msgstr "Your workspace could not be brought into your account. Try again, or cho #: src/components/IdentityReconcileGate.tsx msgid "Lets {0} edit the drives made on this browser, then switches to that identity. Everything stays editable and is backed up with your account." msgstr "Lets {0} edit the drives made on this browser, then switches to that identity. Everything stays editable and is backed up with your account." + +#: src/components/SideBar/AccountMenu.tsx +msgid "Profile" +msgstr "Profile" + +#: src/components/SideBar/AccountMenu.tsx +msgid "See and edit the current Agent / User" +msgstr "See and edit the current Agent / User" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Sign in, or create a new Agent / User" +msgstr "Sign in, or create a new Agent / User" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Report a bug or suggest an improvement" +msgstr "Report a bug or suggest an improvement" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Account and app menu" +msgstr "Account and app menu" diff --git a/browser/data-browser/src/locales/es.po b/browser/data-browser/src/locales/es.po index d34b3b733c..c29c273aa3 100644 --- a/browser/data-browser/src/locales/es.po +++ b/browser/data-browser/src/locales/es.po @@ -566,8 +566,8 @@ msgstr "No configurado" #: src/components/AI/ProviderStatus.tsx #: src/components/AI/ProviderStatus.tsx -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Connected" @@ -737,7 +737,6 @@ msgid "Ontologies" msgstr "Ontologías" #: src/chunks/AppPage/AppFrame.tsx -#: src/components/SideBar/index.tsx msgid "App" msgstr "App" @@ -828,43 +827,42 @@ msgstr "Haz clic para agrandar" #~ msgid "User Settings" #~ msgstr "Configuración de usuario" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Login / New User" msgstr "Iniciar sesión / Nuevo usuario" -#: src/components/SideBar/AppMenu.tsx -msgid "See and edit the current Agent / User (u)" -msgstr "Ver y editar el Agente / Usuario actual (u)" +#~ msgid "See and edit the current Agent / User (u)" +#~ msgstr "Ver y editar el Agente / Usuario actual (u)" #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Settings" msgstr "Configuración" -#: src/components/SideBar/AppMenu.tsx -msgid "Change client settings (t)" -msgstr "Cambiar la configuración del cliente (t)" +#~ msgid "Change client settings (t)" +#~ msgstr "Cambiar la configuración del cliente (t)" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "About" msgstr "Acerca de" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Welcome page, tells about this app" msgstr "Página de bienvenida, informa sobre esta aplicación" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install App" msgstr "Instalar aplicación" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install app to desktop" msgstr "Instalar la aplicación en el escritorio" -#: src/components/SideBar/AppMenu.tsx -msgid "App menu" -msgstr "Menú de la aplicación" +#~ msgid "App menu" +#~ msgstr "Menú de la aplicación" #: src/components/SideBar/SideBarDrive.tsx msgid "Unauthorized" @@ -1369,28 +1367,28 @@ msgstr "Documento" #: src/chunks/PluginRuns/IntegrationConnection.tsx #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SyncRoute.tsx msgid "Sync" msgstr "Sincronizar" -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Offline" msgstr "Sin conexión" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Changes could not sync" msgstr "No se pudieron sincronizar los cambios" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx msgid "Changes pending" msgstr "Cambios pendientes" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Syncing..." msgstr "Sincronizando..." @@ -4064,12 +4062,12 @@ msgid "Create Invite" msgstr "Crear invitación" #. 0: status.blockedCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes could not sync (no access)" msgstr "" #. 0: status.pendingDirtyCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes pending" msgstr "" @@ -4525,7 +4523,7 @@ msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx #: src/chunks/PluginRuns/RunPluginDialog.tsx #: src/chunks/TablePage/Issues/IssueRow.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx #: src/components/pairing/PairingFlowProvider.tsx #: src/routes/NewDriveRoute.tsx msgid "Close" @@ -6703,42 +6701,42 @@ msgstr "" msgid "Local stays on your devices. Vault is encrypted backup. Server hosts a readable copy. Remote is another connected server." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Send feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Sending feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Thank you. Your feedback has been received." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback could not be sent. Your text is still here. Try again or email" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report a bug or suggest an improvement. Your message and optional email go to the Atomic team through Sentry. Please leave out private workspace content." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback <0/>" msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Email for a reply (optional) <0/>" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback reporting is unavailable on this installation. Email" msgstr "" @@ -7734,12 +7732,12 @@ msgstr "" msgid "Dismiss" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/IntegrationStore.tsx msgid "Integrations" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Discover published integrations" msgstr "" @@ -11620,7 +11618,7 @@ msgid "AI settings…" msgstr "" #: src/actions/appActions.ts -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SettingsAgent.tsx msgid "User" msgstr "" @@ -11663,8 +11661,8 @@ msgstr "" msgid "Local copy unavailable" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report this error" msgstr "" @@ -12427,7 +12425,7 @@ msgstr "" #: src/components/Notifications/NotificationList.tsx #: src/components/Notifications/NotificationList.tsx -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Notifications" msgstr "" @@ -12480,11 +12478,11 @@ msgid "Mark all as read" msgstr "" #. 0: unread -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Notifications, {0} unread" msgstr "" -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Messages, comments and replies for you" msgstr "" @@ -12504,3 +12502,23 @@ msgstr "No se pudo traer tu espacio de trabajo a tu cuenta. Inténtalo de nuevo #: src/components/IdentityReconcileGate.tsx msgid "Lets {0} edit the drives made on this browser, then switches to that identity. Everything stays editable and is backed up with your account." msgstr "Permite que {0} edite las unidades creadas en este navegador y luego cambia a esa identidad. Todo sigue siendo editable y se respalda con tu cuenta." + +#: src/components/SideBar/AccountMenu.tsx +msgid "Profile" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "See and edit the current Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Sign in, or create a new Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Report a bug or suggest an improvement" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Account and app menu" +msgstr "" diff --git a/browser/data-browser/src/locales/fr.po b/browser/data-browser/src/locales/fr.po index bb7ee5ee81..b4951b76d2 100644 --- a/browser/data-browser/src/locales/fr.po +++ b/browser/data-browser/src/locales/fr.po @@ -566,8 +566,8 @@ msgstr "Non configuré" #: src/components/AI/ProviderStatus.tsx #: src/components/AI/ProviderStatus.tsx -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Connected" @@ -737,7 +737,6 @@ msgid "Ontologies" msgstr "Ontologies" #: src/chunks/AppPage/AppFrame.tsx -#: src/components/SideBar/index.tsx msgid "App" msgstr "Application" @@ -828,43 +827,42 @@ msgstr "Cliquez pour agrandir" #~ msgid "User Settings" #~ msgstr "Paramètres utilisateur" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Login / New User" msgstr "Connexion / Nouvel utilisateur" -#: src/components/SideBar/AppMenu.tsx -msgid "See and edit the current Agent / User (u)" -msgstr "Voir et modifier l'agent / l'utilisateur actuel (u)" +#~ msgid "See and edit the current Agent / User (u)" +#~ msgstr "Voir et modifier l'agent / l'utilisateur actuel (u)" #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Settings" msgstr "Paramètres" -#: src/components/SideBar/AppMenu.tsx -msgid "Change client settings (t)" -msgstr "Modifier les paramètres du client (t)" +#~ msgid "Change client settings (t)" +#~ msgstr "Modifier les paramètres du client (t)" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "About" msgstr "À propos" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Welcome page, tells about this app" msgstr "Page de bienvenue, qui parle de cette application" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install App" msgstr "Installer l'application" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Install app to desktop" msgstr "Installer l'application sur le bureau" -#: src/components/SideBar/AppMenu.tsx -msgid "App menu" -msgstr "Menu de l'application" +#~ msgid "App menu" +#~ msgstr "Menu de l'application" #: src/components/SideBar/SideBarDrive.tsx msgid "Unauthorized" @@ -1369,28 +1367,28 @@ msgstr "Document" #: src/chunks/PluginRuns/IntegrationConnection.tsx #: src/chunks/PluginRuns/PluginPage.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SyncRoute.tsx msgid "Sync" msgstr "Synchroniser" -#: src/components/SideBar/SyncMenuItem.tsx -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx #: src/routes/SyncRoute.tsx msgid "Offline" msgstr "Hors ligne" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Changes could not sync" msgstr "Les modifications n'ont pas pu être synchronisées" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx #: src/routes/SyncRoute.tsx msgid "Changes pending" msgstr "Modifications en attente" -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "Syncing..." msgstr "Synchronisation..." @@ -4064,12 +4062,12 @@ msgid "Create Invite" msgstr "Créer une invitation" #. 0: status.blockedCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes could not sync (no access)" msgstr "" #. 0: status.pendingDirtyCount -#: src/components/SideBar/SyncMenuItem.tsx +#: src/components/SideBar/syncStatus.tsx msgid "{0} changes pending" msgstr "" @@ -4525,7 +4523,7 @@ msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx #: src/chunks/PluginRuns/RunPluginDialog.tsx #: src/chunks/TablePage/Issues/IssueRow.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx #: src/components/pairing/PairingFlowProvider.tsx #: src/routes/NewDriveRoute.tsx msgid "Close" @@ -6703,42 +6701,42 @@ msgstr "" msgid "Local stays on your devices. Vault is encrypted backup. Server hosts a readable copy. Remote is another connected server." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Send feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Sending feedback" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Thank you. Your feedback has been received." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback could not be sent. Your text is still here. Try again or email" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report a bug or suggest an improvement. Your message and optional email go to the Atomic team through Sentry. Please leave out private workspace content." msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback <0/>" msgstr "" #: src/chunks/AI/ReportAIChatDialog.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Email for a reply (optional) <0/>" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Feedback reporting is unavailable on this installation. Email" msgstr "" @@ -7734,12 +7732,12 @@ msgstr "" msgid "Dismiss" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/IntegrationStore.tsx msgid "Integrations" msgstr "" -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Discover published integrations" msgstr "" @@ -11620,7 +11618,7 @@ msgid "AI settings…" msgstr "" #: src/actions/appActions.ts -#: src/components/SideBar/AppMenu.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/SettingsAgent.tsx msgid "User" msgstr "" @@ -11663,8 +11661,8 @@ msgstr "" msgid "Local copy unavailable" msgstr "" -#: src/components/SideBar/FeedbackMenuItem.tsx -#: src/components/SideBar/FeedbackMenuItem.tsx +#: src/components/SideBar/FeedbackButton.tsx +#: src/components/SideBar/FeedbackButton.tsx msgid "Report this error" msgstr "" @@ -12427,7 +12425,7 @@ msgstr "" #: src/components/Notifications/NotificationList.tsx #: src/components/Notifications/NotificationList.tsx -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx #: src/routes/AppSettings.tsx msgid "Notifications" msgstr "" @@ -12480,11 +12478,11 @@ msgid "Mark all as read" msgstr "" #. 0: unread -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Notifications, {0} unread" msgstr "" -#: src/components/SideBar/NotificationsMenuItem.tsx +#: src/components/SideBar/AccountMenu.tsx msgid "Messages, comments and replies for you" msgstr "" @@ -12504,3 +12502,23 @@ msgstr "Votre espace de travail n’a pas pu être ajouté à votre compte. Rée #: src/components/IdentityReconcileGate.tsx msgid "Lets {0} edit the drives made on this browser, then switches to that identity. Everything stays editable and is backed up with your account." msgstr "Permet à {0} de modifier les drives créés dans ce navigateur, puis bascule vers cette identité. Tout reste modifiable et est sauvegardé avec votre compte." + +#: src/components/SideBar/AccountMenu.tsx +msgid "Profile" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "See and edit the current Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Sign in, or create a new Agent / User" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Report a bug or suggest an improvement" +msgstr "" + +#: src/components/SideBar/AccountMenu.tsx +msgid "Account and app menu" +msgstr "" diff --git a/browser/data-browser/src/views/CrashPage.tsx b/browser/data-browser/src/views/CrashPage.tsx index 5fa482dfe4..9093f311d5 100644 --- a/browser/data-browser/src/views/CrashPage.tsx +++ b/browser/data-browser/src/views/CrashPage.tsx @@ -1,4 +1,4 @@ -import { FeedbackMenuItem } from '../components/SideBar/FeedbackMenuItem'; +import { FeedbackButton } from '../components/SideBar/FeedbackButton'; import { DialogGlobalContextProvider } from '../components/Dialog/DialogGlobalContextProvider'; import * as React from 'react'; import { Resource } from '@tomic/react'; @@ -48,7 +48,7 @@ function CrashPage({ Try Again - + diff --git a/browser/e2e/tests/feedback.spec.ts b/browser/e2e/tests/feedback.spec.ts index f05ec5680b..aae39b86c9 100644 --- a/browser/e2e/tests/feedback.spec.ts +++ b/browser/e2e/tests/feedback.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from './fixtures'; -import { before } from './test-utils'; +import { before, clickAccountMenuItem } from './test-utils'; // The SDK uses a fake project and intercepted transport: no real reports in CI. test.beforeEach(async ({ page }) => { @@ -38,8 +38,7 @@ test('sidebar feedback retains a failed report and retries successfully', async headers: { 'access-control-allow-origin': '*' }, }); }); - await page.getByTestId('sidebar').hover(); - await page.getByRole('button', { name: 'Feedback', exact: true }).click(); + await clickAccountMenuItem(page, 'Feedback'); const dialog = page.getByRole('dialog'); const message = dialog.getByRole('textbox', { name: 'Feedback', @@ -72,8 +71,7 @@ test('disabled feedback explains availability without claiming a failed send', a }; }); await page.reload(); - await page.getByTestId('sidebar').hover(); - await page.getByRole('button', { name: 'Feedback', exact: true }).click(); + await clickAccountMenuItem(page, 'Feedback'); const dialog = page.getByRole('dialog'); await expect(dialog).toContainText('Feedback reporting is unavailable'); await expect(dialog).not.toContainText('could not be sent'); diff --git a/browser/e2e/tests/notifications.spec.ts b/browser/e2e/tests/notifications.spec.ts index da8c62e6e3..e2d6eedd18 100644 --- a/browser/e2e/tests/notifications.spec.ts +++ b/browser/e2e/tests/notifications.spec.ts @@ -14,6 +14,8 @@ import { test, expect, type Page } from './fixtures'; import { before, + clickAccountMenuItem, + openAccountMenu, editableTitle, getCurrentSubject, newResource, @@ -33,7 +35,6 @@ declare global { } const chatInput = (page: Page) => page.getByLabel('Chat input'); -const appMenu = (page: Page) => page.getByRole('region', { name: 'App menu' }); async function send(page: Page, text: string) { await chatInput(page).fill(text); @@ -130,7 +131,7 @@ test.describe('notifications', () => { // The owner is in the app, but somewhere else. Navigated in-app rather // than by reloading, so the owner's session keeps its live connection. - await appMenu(page).getByText('Settings', { exact: true }).click(); + await page.getByTestId('sidebar-settings-button').click(); await expect( page.getByRole('heading', { name: 'Settings', exact: true }), ).toBeVisible(); @@ -173,14 +174,15 @@ test.describe('notifications', () => { // Both are in the Inbox: the one opened from the toast is read, the one // announced while away is not. await page.evaluate(() => (window.__blurred = false)); - await appMenu(page).getByText('Notifications', { exact: true }).click(); + await clickAccountMenuItem(page, 'Notifications'); const list = page.getByRole('list', { name: 'Notifications' }); await expect(list.getByRole('listitem')).toHaveCount(2, { timeout: 30_000, }); await expect( - appMenu(page).getByLabel('Notifications, 1 unread'), + (await openAccountMenu(page)).getByLabel('Notifications, 1 unread'), ).toBeVisible(); + await page.keyboard.press('Escape'); const awayItem = list.getByRole('button', { name: new RegExp(away) }); await expect(awayItem.getByLabel('Unread')).toBeVisible(); await expect( @@ -191,7 +193,12 @@ test.describe('notifications', () => { await page.getByRole('button', { name: 'Mark all as read' }).click(); await expect(awayItem.getByLabel('Unread')).toHaveCount(0); - await expect(page.getByLabel('Notifications, 1 unread')).toHaveCount(0); + const menu = await openAccountMenu(page); + await expect( + menu.getByRole('menuitem', { name: /^Notifications\b/ }), + ).toBeVisible(); + await expect(menu.getByLabel(/^Notifications, \d+ unread$/)).toHaveCount(0); + await page.keyboard.press('Escape'); await awayItem.click(); await expect( diff --git a/browser/e2e/tests/offline-tables.spec.ts b/browser/e2e/tests/offline-tables.spec.ts index ad3cffaa49..8aeee21054 100644 --- a/browser/e2e/tests/offline-tables.spec.ts +++ b/browser/e2e/tests/offline-tables.spec.ts @@ -1,5 +1,6 @@ import { test, expect } from './fixtures'; import { + clickAccountMenuItem, FRONTEND_URL, editableTitle, setGridCell, @@ -39,10 +40,7 @@ test.describe('offline tables', () => { }); // 2. Go to the Sync page and disconnect from the server. - await page - .getByTestId('sidebar') - .getByRole('link', { name: 'Sync' }) - .click(); + await clickAccountMenuItem(page, 'Sync'); await page.getByRole('button', { name: 'Disconnect' }).click(); await expect .poll(() => diff --git a/browser/e2e/tests/ollama-feedback.spec.ts b/browser/e2e/tests/ollama-feedback.spec.ts index d9687f5c00..12297d45b0 100644 --- a/browser/e2e/tests/ollama-feedback.spec.ts +++ b/browser/e2e/tests/ollama-feedback.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from './fixtures'; -import { before, FRONTEND_URL } from './test-utils'; +import { before, FRONTEND_URL, openAccountMenu } from './test-utils'; test.beforeEach(async ({ page }) => { await page.route('http://localhost:3030/api/me', route => @@ -8,9 +8,12 @@ test.beforeEach(async ({ page }) => { }); test.beforeEach(before); -test('feedback uses the sidebar hover background', async ({ page }) => { - await page.getByTestId('sidebar').hover(); - const feedback = page.getByRole('button', { name: 'Feedback', exact: true }); +test('feedback in the account menu highlights on hover', async ({ page }) => { + const menu = await openAccountMenu(page); + const feedback = menu.getByRole('menuitem', { + name: 'Feedback', + exact: true, + }); await page.mouse.move(1000, 300); const resting = await feedback.evaluate( el => getComputedStyle(el).backgroundColor, diff --git a/browser/e2e/tests/right-panel-lifecycle.spec.ts b/browser/e2e/tests/right-panel-lifecycle.spec.ts index c3a648f1fc..d059f7ddbe 100644 --- a/browser/e2e/tests/right-panel-lifecycle.spec.ts +++ b/browser/e2e/tests/right-panel-lifecycle.spec.ts @@ -1,5 +1,5 @@ import { test, expect, type Page } from './fixtures'; -import { before } from './test-utils'; +import { before, clickAccountMenuItem } from './test-utils'; async function expectLeftSidebarClosed(page: Page) { const sidebar = page.getByTestId('sidebar'); @@ -102,7 +102,7 @@ test('comments close when navigating to a page without a resource', async ({ 'data-open', '', ); - await page.getByRole('link', { name: /Sync$/ }).click(); + await clickAccountMenuItem(page, 'Sync'); await expect(page.getByTestId('comments-panel')).not.toHaveAttribute( 'data-open', '', diff --git a/browser/e2e/tests/signout-signin-data.spec.ts b/browser/e2e/tests/signout-signin-data.spec.ts index 0febcfec29..c3230654c9 100644 --- a/browser/e2e/tests/signout-signin-data.spec.ts +++ b/browser/e2e/tests/signout-signin-data.spec.ts @@ -24,6 +24,7 @@ import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { before, + clickAccountMenuItem, getCurrentSubject, getDevDriveSecret, newResource, @@ -141,7 +142,7 @@ async function signOut(page: Page) { dialog.accept(); }); - await page.locator('a[href$="/app/agent"]').click(); + await clickAccountMenuItem(page, 'Profile'); await page.click('[data-test="sign-out"]'); await expect( page.getByRole('button', { name: 'Create account' }), @@ -173,7 +174,9 @@ async function signInAgain(page: Page, secret: string) { await expect( page.getByRole('heading', { name: 'Your data is on another device' }), ).toBeHidden({ timeout: 15000 }); - await expect(page.locator('a[href$="/app/agent"]')).toBeVisible(); + await expect( + page.locator('[data-testid="account-menu-trigger"][data-signed-in="true"]'), + ).toBeVisible(); await expect(page).toHaveURL(/(?:did(?:%3A|:)ad|atomic)(?:%3A|:)/); } diff --git a/browser/e2e/tests/test-utils.ts b/browser/e2e/tests/test-utils.ts index 3873f9cf7f..fbb4cf6001 100644 --- a/browser/e2e/tests/test-utils.ts +++ b/browser/e2e/tests/test-utils.ts @@ -531,8 +531,8 @@ function waitForCommitForSubject(page: Page, subject: string, since: number) { * Handles three entry states: * 1. Already signed in (e.g. post-`before()`/`devDrive()`): no-op. * 2. Welcome gate visible: click its "Sign in" button → paste secret. - * 3. On a drive page with a "Login / New User" sidebar link: click it, then - * follow the welcome-gate flow, then navigate back. + * 3. On a drive page with a "Login / New User" sidebar row: go to the + * welcome gate and follow its flow. * * There is no button to confirm the secret, by design: a secret either parses * or it doesn't, so GettingStartedFlow signs in the moment the value is valid @@ -565,10 +565,15 @@ export async function signIn(page: Page, secret?: string) { name: 'Sign in', exact: true, }); - const settings = page - .locator('a[href$="/app/agent"]') - .filter({ hasNotText: 'Login / New User' }); - const login = page.getByRole('link', { name: 'Login / New User' }); + // The sidebar's user row, which opens the account menu. It carries + // `data-signed-in` once there is an agent, and reads "Login / New User" + // before that. + const settings = page.locator( + '[data-testid="account-menu-trigger"][data-signed-in="true"]', + ); + const login = page + .getByTestId('account-menu-trigger') + .filter({ hasText: 'Login / New User' }); // The first thing this helper waits for is a cold app boot in whatever // context it was handed: wasm, store init and the route all have to land // before any of these four appear. It was on the 10s default while the two @@ -1972,6 +1977,30 @@ export async function editTitle(title: string, page: Page) { await waiter; } +/** + * Opens the account menu behind the user row at the bottom of the sidebar + * (Profile, Notifications, Integrations, Sync, Feedback, About) and returns + * it. Settings is not in it: that is the gear button beside the user row, + * `sidebar-settings-button`. + */ +export async function openAccountMenu(page: Page): Promise { + const sidebar = page.getByTestId('sidebar'); + await sidebar.hover(); + await sidebar.getByTestId('account-menu-trigger').click(); + const menu = page.getByRole('menu'); + await expect(menu).toBeVisible(); + + return menu; +} + +/** Picks an item from the sidebar's account menu. */ +export async function clickAccountMenuItem(page: Page, name: string) { + const menu = await openAccountMenu(page); + // Not `exact`: an item's trailing badge (Notifications' unread count) is + // part of its accessible name. + await menu.getByRole('menuitem', { name: new RegExp(`^${name}\\b`) }).click(); +} + export async function clickSidebarItem(text: string, page: Page) { await page.getByTestId('sidebar').getByRole('link', { name: text }).click(); }