import React, { Fragment, FunctionComponent, ReactNode, useCallback } from 'react'; import { ACTIVITY_HOME, GlobalActivity } from '../../common/constants'; import coreLogo from '../images/insomnia-core-logo.png'; import { strings } from '../../common/strings'; import WorkspaceDropdown from './dropdowns/workspace-dropdown'; import ActivityToggle from './activity-toggle'; import type { WrapperProps } from './wrapper'; import { Header, Breadcrumb } from 'insomnia-components'; import AccountDropdown from './dropdowns/account-dropdown'; import SettingsButton from './buttons/settings-button'; import { isCollection, isDesign } from '../../models/workspace'; interface Props { wrapperProps: WrapperProps; handleActivityChange: (workspaceId: string, activity: GlobalActivity) => Promise; gridRight: ReactNode; } const WorkspacePageHeader: FunctionComponent = ({ gridRight, handleActivityChange, wrapperProps: { activeApiSpec, activeWorkspace, activeEnvironment, settings, activity, isLoading, }, }) => { const collection = isCollection(activeWorkspace); const design = isDesign(activeWorkspace); const homeCallback = useCallback( () => handleActivityChange(activeWorkspace._id, ACTIVITY_HOME), [activeWorkspace._id, handleActivityChange], ); const workspace = ( ); return (
Insomnia {workspace} }]}/> } gridCenter={ design && ( ) } gridRight={ <> {gridRight} } /> ); }; export default WorkspacePageHeader;