hide projects for now

This commit is contained in:
Zane Staggs
2025-07-08 16:22:55 -07:00
parent 428857b144
commit 6ae1d475da
3 changed files with 155 additions and 155 deletions
+62 -62
View File
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { IpcRendererEvent } from 'electron';
import { HashRouter, Routes, Route, useNavigate, useLocation } from 'react-router-dom';
import { openSharedSessionFromDeepLink, type SessionLinksViewOptions } from './sessionLinks';
@@ -40,7 +40,7 @@ import PermissionSettingsView from './components/settings/permission/PermissionS
import { type SessionDetails } from './sessions';
import ExtensionsView, { ExtensionsViewOptions } from './components/extensions/ExtensionsView';
import ProjectsContainer from './components/projects/ProjectsContainer';
// import ProjectsContainer from './components/projects/ProjectsContainer';
import RecipesView from './components/RecipesView';
import RecipeEditor from './components/RecipeEditor';
@@ -61,8 +61,8 @@ export type View =
| 'loading'
| 'recipeEditor'
| 'recipes'
| 'permission'
| 'projects';
| 'permission';
// | 'projects';
export type ViewOptions = {
// Settings view options
@@ -477,56 +477,56 @@ const ExtensionsRoute = () => {
);
};
const ProjectsRoute = () => {
const navigate = useNavigate();
const setView = (view: View, viewOptions?: ViewOptions) => {
// Convert view to route navigation
switch (view) {
case 'chat':
navigate('/');
break;
case 'pair':
navigate('/pair', { state: viewOptions });
break;
case 'settings':
navigate('/settings', { state: viewOptions });
break;
case 'sessions':
navigate('/sessions');
break;
case 'schedules':
navigate('/schedules');
break;
case 'recipes':
navigate('/recipes');
break;
case 'permission':
navigate('/permission', { state: viewOptions });
break;
case 'ConfigureProviders':
navigate('/configure-providers');
break;
case 'sharedSession':
navigate('/shared-session', { state: viewOptions });
break;
case 'recipeEditor':
navigate('/recipe-editor', { state: viewOptions });
break;
case 'welcome':
navigate('/welcome');
break;
default:
navigate('/');
}
};
return (
<React.Suspense fallback={<div>Loading projects...</div>}>
<ProjectsContainer setView={setView} />
</React.Suspense>
);
};
// const ProjectsRoute = () => {
// const navigate = useNavigate();
//
// const setView = (view: View, viewOptions?: ViewOptions) => {
// // Convert view to route navigation
// switch (view) {
// case 'chat':
// navigate('/');
// break;
// case 'pair':
// navigate('/pair', { state: viewOptions });
// break;
// case 'settings':
// navigate('/settings', { state: viewOptions });
// break;
// case 'sessions':
// navigate('/sessions');
// break;
// case 'schedules':
// navigate('/schedules');
// break;
// case 'recipes':
// navigate('/recipes');
// break;
// case 'permission':
// navigate('/permission', { state: viewOptions });
// break;
// case 'ConfigureProviders':
// navigate('/configure-providers');
// break;
// case 'sharedSession':
// navigate('/shared-session', { state: viewOptions });
// break;
// case 'recipeEditor':
// navigate('/recipe-editor', { state: viewOptions });
// break;
// case 'welcome':
// navigate('/welcome');
// break;
// default:
// navigate('/');
// }
// };
//
// return (
// <React.Suspense fallback={<div>Loading projects...</div>}>
// <ProjectsContainer setView={setView} />
// </React.Suspense>
// );
// };
export default function App() {
const [fatalError, setFatalError] = useState<string | null>(null);
@@ -1093,14 +1093,14 @@ export default function App() {
<Route path="permission" element={<PermissionRoute />} />
<Route path="configure-providers" element={<ConfigureProvidersRoute />} />
<Route path="welcome" element={<WelcomeRoute />} />
<Route
path="projects"
element={
<ChatProvider chat={chat} setChat={setChat}>
<ProjectsRoute />
</ChatProvider>
}
/>
{/*<Route*/}
{/* path="projects"*/}
{/* element={*/}
{/* <ChatProvider chat={chat} setChat={setChat}>*/}
{/* <ProjectsRoute />*/}
{/* </ChatProvider>*/}
{/* }*/}
{/*/>*/}
</Route>
</Routes>
</div>
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { FileText, Clock, Home, Puzzle, History, FolderKanban } from 'lucide-react';
import { FileText, Clock, Home, Puzzle, History } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { motion } from 'framer-motion';
import {
@@ -196,23 +196,23 @@ const AppSidebar: React.FC<SidebarProps> = ({ currentPath }) => {
{/* Content Group */}
<SidebarGroup>
<SidebarGroupContent className="space-y-1">
<motion.div
initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }}
transition={{ type: 'spring', stiffness: 300, damping: 25, delay: 0.35 }}
>
<SidebarMenuItem>
<SidebarMenuButton
onClick={() => navigate('/projects')}
isActive={isActivePath('/projects')}
tooltip="Manage your projects"
className="w-full justify-start px-3 rounded-lg h-fit hover:bg-background-medium/50 transition-all duration-200 data-[active=true]:bg-background-medium"
>
<FolderKanban className="w-4 h-4" />
<span>Projects</span>
</SidebarMenuButton>
</SidebarMenuItem>
</motion.div>
{/*<motion.div*/}
{/* initial={{ opacity: 0, x: 20 }}*/}
{/* animate={{ opacity: 1, x: 0 }}*/}
{/* transition={{ type: 'spring', stiffness: 300, damping: 25, delay: 0.35 }}*/}
{/*>*/}
{/* <SidebarMenuItem>*/}
{/* <SidebarMenuButton*/}
{/* onClick={() => navigate('/projects')}*/}
{/* isActive={isActivePath('/projects')}*/}
{/* tooltip="Manage your projects"*/}
{/* className="w-full justify-start px-3 rounded-lg h-fit hover:bg-background-medium/50 transition-all duration-200 data-[active=true]:bg-background-medium"*/}
{/* >*/}
{/* <FolderKanban className="w-4 h-4" />*/}
{/* <span>Projects</span>*/}
{/* </SidebarMenuButton>*/}
{/* </SidebarMenuItem>*/}
{/*</motion.div>*/}
<motion.div
initial={{ opacity: 0, x: 20 }}
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react';
import { Card, CardContent, CardDescription } from '../ui/card';
import { Folder } from 'lucide-react';
// import { Folder } from 'lucide-react';
import { getApiUrl, getSecretKey } from '../../config';
import { Greeting } from '../common/Greeting';
import { fetchSessions, type Session } from '../../sessions';
import { fetchProjects, type ProjectMetadata } from '../../projects';
// import { fetchProjects, type ProjectMetadata } from '../../projects';
import { useNavigate } from 'react-router-dom';
import { Button } from '../ui/button';
import { ChatSmart } from '../icons/';
@@ -22,7 +22,7 @@ export function SessionInsights() {
const [insights, setInsights] = useState<SessionInsightsType | null>(null);
const [_error, setError] = useState<string | null>(null);
const [recentSessions, setRecentSessions] = useState<Session[]>([]);
const [recentProjects, setRecentProjects] = useState<ProjectMetadata[]>([]);
// const [recentProjects, setRecentProjects] = useState<ProjectMetadata[]>([]);
const navigate = useNavigate();
useEffect(() => {
@@ -57,18 +57,18 @@ export function SessionInsights() {
}
};
const loadRecentProjects = async () => {
try {
const projects = await fetchProjects();
setRecentProjects(projects.slice(0, 3));
} catch (error) {
console.error('Failed to load recent projects:', error);
}
};
// const loadRecentProjects = async () => {
// try {
// const projects = await fetchProjects();
// setRecentProjects(projects.slice(0, 3));
// } catch (error) {
// console.error('Failed to load recent projects:', error);
// }
// };
loadInsights();
loadRecentSessions();
loadRecentProjects();
// loadRecentProjects();
}, []);
const handleSessionClick = (sessionId: string) => {
@@ -82,16 +82,16 @@ export function SessionInsights() {
navigate('/sessions');
};
const navigateToProjects = () => {
navigate('/projects');
};
const handleProjectClick = (projectId: string) => {
navigate('/projects', {
state: { selectedProjectId: projectId },
replace: true,
});
};
// const navigateToProjects = () => {
// navigate('/projects');
// };
//
// const handleProjectClick = (projectId: string) => {
// navigate('/projects', {
// state: { selectedProjectId: projectId },
// replace: true,
// });
// };
// Format date to show only the date part (without time)
const formatDateOnly = (dateStr: string) => {
@@ -160,60 +160,60 @@ export function SessionInsights() {
</div>
{/* Bottom row with two equal columns */}
<div className="grid grid-cols-2 gap-[2px]">
<div className="grid grid-cols-1 gap-[2px]">
{/* Recent Projects Card */}
<Card className="w-full py-6 px-4 border-none rounded-tl-none rounded-bl-none">
<CardContent className="animate-in fade-in duration-500 px-4">
<div className="flex justify-between items-center mb-2 px-2">
<CardDescription className="mb-0">
<span className="text-lg text-text-default">Recent projects</span>
</CardDescription>
<Button
variant="ghost"
size="sm"
className="text-xs text-text-muted flex items-center gap-1 !px-0 hover:bg-transparent hover:underline hover:text-text-default"
onClick={navigateToProjects}
>
See all
</Button>
</div>
<div className="space-y-1 min-h-[96px] transition-all duration-300 ease-in-out">
<AnimatePresence>
{recentProjects.length > 0 ? (
recentProjects.map((project, index) => (
<motion.div
key={project.id}
className="flex items-center justify-between text-sm py-1 px-2 rounded-md hover:bg-background-muted cursor-pointer transition-colors"
onClick={() => handleProjectClick(project.id)}
role="button"
tabIndex={0}
initial={{ opacity: 0, y: 5 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3, delay: index * 0.1 }}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
handleProjectClick(project.id);
}
}}
>
<div className="flex items-center space-x-2">
<Folder className="h-4 w-4 text-text-muted" />
<span className="truncate max-w-[200px]">{project.name}</span>
</div>
<span className="text-text-muted font-mono font-light">
{formatDateOnly(project.updatedAt)}
</span>
</motion.div>
))
) : (
<div className="text-text-muted text-sm py-2 px-2">
No recent projects found.
</div>
)}
</AnimatePresence>
</div>
</CardContent>
</Card>
{/*<Card className="w-full py-6 px-4 border-none rounded-tl-none rounded-bl-none">*/}
{/* <CardContent className="animate-in fade-in duration-500 px-4">*/}
{/* <div className="flex justify-between items-center mb-2 px-2">*/}
{/* <CardDescription className="mb-0">*/}
{/* <span className="text-lg text-text-default">Recent projects</span>*/}
{/* </CardDescription>*/}
{/* <Button*/}
{/* variant="ghost"*/}
{/* size="sm"*/}
{/* className="text-xs text-text-muted flex items-center gap-1 !px-0 hover:bg-transparent hover:underline hover:text-text-default"*/}
{/* onClick={navigateToProjects}*/}
{/* >*/}
{/* See all*/}
{/* </Button>*/}
{/* </div>*/}
{/* <div className="space-y-1 min-h-[96px] transition-all duration-300 ease-in-out">*/}
{/* <AnimatePresence>*/}
{/* {recentProjects.length > 0 ? (*/}
{/* recentProjects.map((project, index) => (*/}
{/* <motion.div*/}
{/* key={project.id}*/}
{/* className="flex items-center justify-between text-sm py-1 px-2 rounded-md hover:bg-background-muted cursor-pointer transition-colors"*/}
{/* onClick={() => handleProjectClick(project.id)}*/}
{/* role="button"*/}
{/* tabIndex={0}*/}
{/* initial={{ opacity: 0, y: 5 }}*/}
{/* animate={{ opacity: 1, y: 0 }}*/}
{/* transition={{ duration: 0.3, delay: index * 0.1 }}*/}
{/* onKeyDown={(e) => {*/}
{/* if (e.key === 'Enter' || e.key === ' ') {*/}
{/* handleProjectClick(project.id);*/}
{/* }*/}
{/* }}*/}
{/* >*/}
{/* <div className="flex items-center space-x-2">*/}
{/* <Folder className="h-4 w-4 text-text-muted" />*/}
{/* <span className="truncate max-w-[200px]">{project.name}</span>*/}
{/* </div>*/}
{/* <span className="text-text-muted font-mono font-light">*/}
{/* {formatDateOnly(project.updatedAt)}*/}
{/* </span>*/}
{/* </motion.div>*/}
{/* ))*/}
{/* ) : (*/}
{/* <div className="text-text-muted text-sm py-2 px-2">*/}
{/* No recent projects found.*/}
{/* </div>*/}
{/* )}*/}
{/* </AnimatePresence>*/}
{/* </div>*/}
{/* </CardContent>*/}
{/*</Card>*/}
{/* Recent Chats Card */}
<Card className="w-full py-6 px-4 border-none rounded-tr-none rounded-br-none">