UI: project as seperated workspace
This commit is contained in:
@@ -40,7 +40,7 @@ export function ProjectSwitcher() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2 px-4 py-2 bg-background h-12">
|
||||
<div className="flex items-center gap-2 bg-transparent h-10">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger className="flex h-8 items-center gap-1 rounded-md px-2 font-semibold hover:bg-accent hover:text-accent-foreground outline-none transition-colors">
|
||||
<Folder className="h-4 w-4 mr-1 text-blue-500" />
|
||||
|
||||
@@ -359,7 +359,7 @@ function DashboardSection({
|
||||
className="text-red-600 focus:text-red-600 focus:bg-red-50"
|
||||
>
|
||||
<Trash2 className="mr-2 h-4 w-4" />
|
||||
<span>{t('deleteSession')}</span>
|
||||
<span>{t('delete')}</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@@ -409,7 +409,10 @@ function SidebarBody() {
|
||||
|
||||
const fetchSessions = async () => {
|
||||
try {
|
||||
const data = await api.get<SessionInfo[]>("/nanobot/sessions");
|
||||
const url = currentProject
|
||||
? `/nanobot/sessions?project_id=${currentProject.id}`
|
||||
: "/nanobot/sessions";
|
||||
const data = await api.get<SessionInfo[]>(url);
|
||||
setSessions(data);
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch sessions", e);
|
||||
@@ -418,7 +421,7 @@ function SidebarBody() {
|
||||
|
||||
useEffect(() => {
|
||||
fetchSessions();
|
||||
}, [location.pathname, location.search]);
|
||||
}, [location.pathname, location.search, currentProject?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
const onFocus = () => fetchSessions();
|
||||
@@ -453,7 +456,8 @@ function SidebarBody() {
|
||||
const handleNewThread = async () => {
|
||||
const newSessionId = `api:${Date.now()}`;
|
||||
try {
|
||||
await api.post(`/nanobot/sessions/${encodeURIComponent(newSessionId)}/ensure`, {});
|
||||
const payload = currentProject ? { project_id: currentProject.id } : {};
|
||||
await api.post(`/nanobot/sessions/${encodeURIComponent(newSessionId)}/ensure`, payload);
|
||||
await fetchSessions();
|
||||
window.dispatchEvent(new Event("nanobot:sessions-changed"));
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user