diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index 68118da8..b0815ce4 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -1,3 +1,5 @@ +import ProjectSearchLayout from '@/layouts/ProjectSearch'; +import ProjectsScreen from '@/pages/org-slug/ProjectsScreen'; import { ThemeProvider } from 'next-themes'; import { useEffect } from 'react'; import { createBrowserRouter, RouterProvider } from 'react-router-dom'; @@ -7,7 +9,10 @@ import AuthPage from './pages/AuthPage'; import BuyPrepaidService from './pages/BuyPrepaidService'; import OnboardingDemoPage from './pages/OnboardingDemoPage'; import OnboardingPage from './pages/OnboardingPage'; -import { projectsRoutesWithoutSearch } from './pages/org-slug/projects/project-routes'; +import { + projectsRoutesWithoutSearch, + projectsRoutesWithSearch, +} from './pages/org-slug/projects/project-routes'; import Settings from './pages/org-slug/Settings'; import { BASE_URL } from './utils/constants'; @@ -16,19 +21,19 @@ const router = createBrowserRouter([ path: ':orgSlug', element: , children: [ - // { - // element: , - // children: [` - // { - // path: '', - // element: ,` - // }, - // { - // path: 'projects', - // children: projectsRoutesWithSearch, - // }, - // ], - // }, + { + element: , + children: [ + { + path: '', + element: , + }, + { + path: 'projects', + children: projectsRoutesWithSearch, + }, + ], + }, { path: 'settings', element: , @@ -50,6 +55,7 @@ const router = createBrowserRouter([ { path: '/buy-prepaid-service', element: , + errorElement:
Something went wrong!
, }, { path: '/onboarding', @@ -69,13 +75,15 @@ const router = createBrowserRouter([ function App() { // Hacky way of checking session // TODO: Handle redirect backs + useEffect(() => { fetch(`${BASE_URL}/auth/session`, { credentials: 'include', }).then((res) => { const path = window.location.pathname; const publicPaths = ['/login', '/onboarding', '/onboarding-demo']; - + console.log(res); + if (res.status !== 200) { localStorage.clear(); if (!publicPaths.includes(path)) { diff --git a/packages/frontend/src/components/layout/navigation/components/WalletSessionId.tsx b/packages/frontend/src/components/layout/navigation/components/WalletSessionId.tsx index 5c642f68..02d97750 100644 --- a/packages/frontend/src/components/layout/navigation/components/WalletSessionId.tsx +++ b/packages/frontend/src/components/layout/navigation/components/WalletSessionId.tsx @@ -1,5 +1,5 @@ +import { useWallet } from '@/context/WalletContextProvider'; import type React from 'react'; - /** * WalletSessionIdProps interface defines the props for the WalletSessionId component. */ @@ -24,18 +24,18 @@ export const WalletSessionId: React.FC = ({ walletId, className = '', }) => { - // const { wallet } = useWallet(); - const wallet = { id: 'x123xxx' }; - const displayId = walletId || wallet?.id || 'Not Connected'; - + const { wallet, isConnected } = useWallet(); + // const wallet = { id: 'x123xxx' }; + console.log(wallet, 'from WalletSessionId.tsx'); + const displayId = wallet?.id || 'Wallet'; return (
- + {displayId}
diff --git a/packages/frontend/src/components/layout/screen-wrapper/ScreenWrapper.tsx b/packages/frontend/src/components/layout/screen-wrapper/ScreenWrapper.tsx index bb868d41..54ec54f8 100644 --- a/packages/frontend/src/components/layout/screen-wrapper/ScreenWrapper.tsx +++ b/packages/frontend/src/components/layout/screen-wrapper/ScreenWrapper.tsx @@ -27,7 +27,7 @@ export function ScreenWrapper({
void; +} + +/** + * A card component that displays GitHub repository information in a clickable button format. + * + * @param {Object} props - The component props + * @param {Repository} props.repo - The repository object containing repository details + * @param {() => void} props.onClick - Callback function triggered when the card is clicked + * @returns {JSX.Element} A button element styled as a repository card + */ +function RepoCard({ repo, onClick }: RepoCardProps) { + return ( + + ); +} + /** * RepositoryList Component * * This component renders a list of repositories fetched from GitHub based on the selected account * and search criteria. It allows users to select an organization or their personal account and search * for repositories within that account. - * It uses `useOctokit` to fetch repositories and `ProjectRepoCard` to display each repository. * * @returns {JSX.Element} - The RepositoryList component. */ +/** + * A component that displays a list of GitHub repositories with search and filtering capabilities. + * + * @component + * @description + * This component provides a user interface for: + * - Selecting between personal and organization repositories + * - Searching repositories by name + * - Displaying repository cards with basic repository information + * - Navigating to repository configuration + * + * @remarks + * The component uses: + * - GitHub Octokit for API interactions + * - Debounced search functionality + * - Responsive layout for desktop and mobile views + * + * @dependencies + * - useNavigate - For navigation between routes + * - useParams - For accessing URL parameters + * - useOctokit - Custom hook for GitHub API access + * - useDebounce - Custom hook for search debouncing + * + * @returns JSX.Element - A section containing repository selection, search, and list components + * + * @example + * ```tsx + * + * ``` + */ export const RepositoryList = () => { + const navigate = useNavigate(); + const { orgSlug } = useParams(); const [searchedRepo, setSearchedRepo] = useState(DEFAULT_SEARCHED_REPO); const [selectedAccount, setSelectedAccount] = useState(); const [orgs, setOrgs] = useState([]); @@ -134,16 +201,37 @@ export const RepositoryList = () => { return (
{/* Dropdown and search */} -
-
-