@@ -19,6 +19,7 @@ import {
1919 PageTitleRow ,
2020} from "~/components/primitives/PageHeader" ;
2121import { Paragraph } from "~/components/primitives/Paragraph" ;
22+ import { Switch } from "~/components/primitives/Switch" ;
2223import { TextLink } from "~/components/primitives/TextLink" ;
2324import { useFilterJobs } from "~/hooks/useFilterJobs" ;
2425import { useOrganization } from "~/hooks/useOrganizations" ;
@@ -62,8 +63,11 @@ export default function Page() {
6263 const organization = useOrganization ( ) ;
6364 const project = useProject ( ) ;
6465 const { jobs } = useTypedLoaderData < typeof loader > ( ) ;
65- const { filterText, setFilterText, filteredItems } = useFilterJobs ( jobs ) ;
66- const hasJobs = jobs . length > 0 ;
66+ const { filterText, setFilterText, filteredItems, onlyActiveJobs, setOnlyActiveJobs } =
67+ useFilterJobs ( jobs ) ;
68+ const totalJobs = jobs . length ;
69+ const hasJobs = totalJobs > 0 ;
70+ const activeJobCount = jobs . filter ( ( j ) => j . status === "ACTIVE" ) . length ;
6771
6872 return (
6973 < PageContainer className = { hasJobs ? "" : "grid-rows-1" } >
@@ -74,7 +78,8 @@ export default function Page() {
7478 </ PageTitleRow >
7579 < PageInfoRow >
7680 < PageInfoGroup >
77- < PageInfoProperty icon = { "job" } label = { "Active Jobs" } value = { jobs . length } />
81+ < PageInfoProperty icon = { "job" } label = { "All Jobs" } value = { totalJobs } />
82+ < PageInfoProperty icon = { "job" } label = { "Active Jobs" } value = { activeJobCount } />
7883 </ PageInfoGroup >
7984 </ PageInfoRow >
8085 </ PageHeader >
@@ -96,7 +101,7 @@ export default function Page() {
96101 </ Callout >
97102 ) }
98103 < div className = "mb-2 flex flex-col" >
99- < div className = "flex w-full" >
104+ < div className = "flex w-full gap-x-2 " >
100105 < Input
101106 placeholder = "Search Jobs"
102107 variant = "tertiary"
@@ -106,6 +111,13 @@ export default function Page() {
106111 onChange = { ( e ) => setFilterText ( e . target . value ) }
107112 autoFocus
108113 />
114+ < Switch
115+ variant = "small"
116+ label = "Active Jobs"
117+ checked = { onlyActiveJobs }
118+ onCheckedChange = { setOnlyActiveJobs }
119+ className = { "shrink-0" }
120+ />
109121 < HelpTrigger title = "Example Jobs and inspiration" />
110122 </ div >
111123 </ div >
0 commit comments