github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/frontend-service/src/ui/Pages/Home/Home.tsx (about) 1 /*This file is part of kuberpult. 2 3 Kuberpult is free software: you can redistribute it and/or modify 4 it under the terms of the Expat(MIT) License as published by 5 the Free Software Foundation. 6 7 Kuberpult is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 MIT License for more details. 11 12 You should have received a copy of the MIT License 13 along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>. 14 15 Copyright 2023 freiheit.com*/ 16 import { ServiceLane } from '../../components/ServiceLane/ServiceLane'; 17 import { useSearchParams } from 'react-router-dom'; 18 import { useApplicationsFilteredAndSorted, useGlobalLoadingState } from '../../utils/store'; 19 import React from 'react'; 20 import { LoadingStateSpinner } from '../../utils/LoadingStateSpinner'; 21 import { TopAppBar } from '../../components/TopAppBar/TopAppBar'; 22 import { hideWithoutWarnings } from '../../utils/Links'; 23 24 export const Home: React.FC = () => { 25 const [params] = useSearchParams(); 26 const appNameParam = params.get('application') || ''; 27 const teamsParam = (params.get('teams') || '').split(',').filter((val) => val !== ''); 28 29 const searchedApp = useApplicationsFilteredAndSorted(teamsParam, hideWithoutWarnings(params), appNameParam); 30 31 const apps = Object.values(searchedApp); 32 33 const [everythingLoaded, loadingState] = useGlobalLoadingState(); 34 if (!everythingLoaded) { 35 return <LoadingStateSpinner loadingState={loadingState} />; 36 } 37 38 return ( 39 <div> 40 <TopAppBar showAppFilter={true} showTeamFilter={true} showWarningFilter={true} /> 41 <main className="main-content"> 42 {apps.map((app) => ( 43 <ServiceLane application={app} key={app.name} /> 44 ))} 45 </main> 46 </div> 47 ); 48 };