mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-04 11:45:38 +08:00
refactor: update onNewSession to accept workspaceId for navigation
This commit is contained in:
@@ -126,8 +126,8 @@ export const useWorkspaces = () => {
|
|||||||
[navigate, workspaces],
|
[navigate, workspaces],
|
||||||
);
|
);
|
||||||
|
|
||||||
const openNewSession = useCallback(() => {
|
const openNewSession = useCallback((workspaceId: string) => {
|
||||||
navigate('/');
|
navigate(`/workspaces/${encodeURIComponent(workspaceId)}/chat`);
|
||||||
}, [navigate]);
|
}, [navigate]);
|
||||||
|
|
||||||
const toggleWorkspaceStar = useCallback(async (workspaceId: string) => {
|
const toggleWorkspaceStar = useCallback(async (workspaceId: string) => {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ type SidebarWorkspaceItemProps = {
|
|||||||
onDeleteWorkspace: (workspace: WorkspaceRecord) => void;
|
onDeleteWorkspace: (workspace: WorkspaceRecord) => void;
|
||||||
onSessionSelect: (workspacePath: string, sessionId: string) => void;
|
onSessionSelect: (workspacePath: string, sessionId: string) => void;
|
||||||
onSessionDelete: (workspacePath: string, sessionId: string) => void;
|
onSessionDelete: (workspacePath: string, sessionId: string) => void;
|
||||||
onNewSession: () => void;
|
onNewSession: (workspaceId: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SidebarWorkspaceItem({
|
export function SidebarWorkspaceItem({
|
||||||
@@ -396,7 +396,7 @@ export function SidebarWorkspaceItem({
|
|||||||
className="flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]"
|
className="flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
onNewSession();
|
onNewSession(workspace.workspaceId);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Plus className="h-3 w-3" />
|
<Plus className="h-3 w-3" />
|
||||||
@@ -408,7 +408,7 @@ export function SidebarWorkspaceItem({
|
|||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="mt-1 hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex"
|
className="mt-1 hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex"
|
||||||
onClick={onNewSession}
|
onClick={() => onNewSession(workspace.workspaceId)}
|
||||||
>
|
>
|
||||||
<Plus className="h-3 w-3" />
|
<Plus className="h-3 w-3" />
|
||||||
New Session
|
New Session
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type SidebarWorkspaceListProps = {
|
|||||||
onDeleteWorkspace: (workspace: WorkspaceRecord) => void;
|
onDeleteWorkspace: (workspace: WorkspaceRecord) => void;
|
||||||
onSessionSelect: (workspacePath: string, sessionId: string) => void;
|
onSessionSelect: (workspacePath: string, sessionId: string) => void;
|
||||||
onSessionDelete: (workspacePath: string, sessionId: string) => void;
|
onSessionDelete: (workspacePath: string, sessionId: string) => void;
|
||||||
onNewSession: () => void;
|
onNewSession: (workspaceId: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SectionHeading = ({ title }: { title: string }) => (
|
const SectionHeading = ({ title }: { title: string }) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user