@@ -7,24 +7,27 @@ import {DOrganizationReactiveService} from "./DOrganization.service";
77import CardSection from "../card/CardSection" ;
88import { DOrganizationContent } from "./DOrganizatonContent" ;
99import { DOrganizationView } from "./DOrganization.view" ;
10- import { Scalars } from "@code0-tech/sagittarius-graphql-types" ;
10+ import { Organization , Scalars } from "@code0-tech/sagittarius-graphql-types" ;
1111
12- export interface DOrganizationListProps extends Omit < Card , "children" > {
12+ export interface DOrganizationListProps extends Omit < Card , "children" | "onSelect" > {
1313 filter ?: ( organizations : DOrganizationView , index : number ) => boolean
14- onSetting ?: ( organizationId : Scalars [ 'OrganizationID' ] [ 'output' ] ) => void
15- onLeave ?: ( organizationId : Scalars [ 'OrganizationID' ] [ 'output' ] ) => void
14+ onSetting ?: ( organizationId : Organization [ 'id' ] ) => void
15+ onLeave ?: ( organizationId : Organization [ 'id' ] ) => void
16+ onSelect ?: ( organizationId : Organization [ 'id' ] ) => void
1617}
1718
1819export const DOrganizationList : React . FC < DOrganizationListProps > = ( props ) => {
1920
2021 const organizationService = useService ( DOrganizationReactiveService )
2122 const organizationStore = useStore ( DOrganizationReactiveService )
2223 const organizations = React . useMemo ( ( ) => organizationService . values ( ) , [ organizationStore ] )
23- const { filter = ( ) => true , onLeave, onSetting, ...rest } = props
24+ const { filter = ( ) => true , onLeave, onSetting, onSelect , ...rest } = props
2425
2526 return < Card { ...rest } >
2627 { organizations . filter ( filter ) . map ( ( organization ) => organization . id && (
27- < CardSection border key = { organization . id } >
28+ < CardSection border hover onClick = { ( ) => {
29+ if ( onSelect ) onSelect ( organization . id )
30+ } } key = { organization . id } >
2831 < DOrganizationContent onLeave = { onLeave } onSetting = { onSetting } organizationId = { organization ?. id } />
2932 </ CardSection >
3033 ) ) }
0 commit comments