feat: brought back mobile new session sidebar action
Adds a mobile-only new session button to the sidebar header Opens a draft session from the sidebar Keeps desktop sidebar actions unchanged
This commit is contained in:
@@ -1534,6 +1534,14 @@ export const SessionSidebar: React.FC<SessionSidebarProps> = ({
|
|||||||
openMultiRunLauncher();
|
openMultiRunLauncher();
|
||||||
}, [mobileVariant, openMultiRunLauncher, setActiveMainTab, setSessionSwitcherOpen]);
|
}, [mobileVariant, openMultiRunLauncher, setActiveMainTab, setSessionSwitcherOpen]);
|
||||||
|
|
||||||
|
const handleOpenNewSessionDraftFromHeader = React.useCallback(() => {
|
||||||
|
setActiveMainTab('chat');
|
||||||
|
if (mobileVariant) {
|
||||||
|
setSessionSwitcherOpen(false);
|
||||||
|
}
|
||||||
|
openNewSessionDraft();
|
||||||
|
}, [mobileVariant, openNewSessionDraft, setActiveMainTab, setSessionSwitcherOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={sessionSearchContainerRef}
|
ref={sessionSearchContainerRef}
|
||||||
@@ -1544,7 +1552,9 @@ export const SessionSidebar: React.FC<SessionSidebarProps> = ({
|
|||||||
>
|
>
|
||||||
<SidebarHeader
|
<SidebarHeader
|
||||||
hideDirectoryControls={hideDirectoryControls}
|
hideDirectoryControls={hideDirectoryControls}
|
||||||
|
mobileVariant={mobileVariant}
|
||||||
handleOpenDirectoryDialog={handleOpenDirectoryDialog}
|
handleOpenDirectoryDialog={handleOpenDirectoryDialog}
|
||||||
|
openNewSessionDraft={handleOpenNewSessionDraftFromHeader}
|
||||||
canOpenMultiRun={projects.length > 0}
|
canOpenMultiRun={projects.length > 0}
|
||||||
openMultiRunLauncher={handleOpenMultiRunFromHeader}
|
openMultiRunLauncher={handleOpenMultiRunFromHeader}
|
||||||
headerActionIconClass={headerActionIconClass}
|
headerActionIconClass={headerActionIconClass}
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import { useI18n } from '@/lib/i18n';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
hideDirectoryControls: boolean;
|
hideDirectoryControls: boolean;
|
||||||
|
mobileVariant: boolean;
|
||||||
handleOpenDirectoryDialog: () => void;
|
handleOpenDirectoryDialog: () => void;
|
||||||
|
openNewSessionDraft: () => void;
|
||||||
canOpenMultiRun: boolean;
|
canOpenMultiRun: boolean;
|
||||||
openMultiRunLauncher: () => void;
|
openMultiRunLauncher: () => void;
|
||||||
headerActionIconClass: string;
|
headerActionIconClass: string;
|
||||||
@@ -38,7 +40,9 @@ export function SidebarHeader(props: Props): React.ReactNode {
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const {
|
const {
|
||||||
hideDirectoryControls,
|
hideDirectoryControls,
|
||||||
|
mobileVariant,
|
||||||
handleOpenDirectoryDialog,
|
handleOpenDirectoryDialog,
|
||||||
|
openNewSessionDraft,
|
||||||
canOpenMultiRun,
|
canOpenMultiRun,
|
||||||
openMultiRunLauncher,
|
openMultiRunLauncher,
|
||||||
headerActionIconClass,
|
headerActionIconClass,
|
||||||
@@ -85,6 +89,22 @@ export function SidebarHeader(props: Props): React.ReactNode {
|
|||||||
<TooltipContent side="bottom" sideOffset={4}><p>{t('sessions.sidebar.header.actions.addProject')}</p></TooltipContent>
|
<TooltipContent side="bottom" sideOffset={4}><p>{t('sessions.sidebar.header.actions.addProject')}</p></TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
|
{mobileVariant ? (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={openNewSessionDraft}
|
||||||
|
className={headerActionButtonClass}
|
||||||
|
aria-label={t('sessions.sidebar.header.actions.newSession')}
|
||||||
|
>
|
||||||
|
<Icon name="chat-new" className={headerActionIconClass} />
|
||||||
|
</button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="bottom" sideOffset={4}><p>{t('sessions.sidebar.header.actions.newSession')}</p></TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user