@@ -48,6 +48,7 @@ interface BaseQueryParams {
4848
4949interface StatCardProps {
5050 label : string ;
51+ countKey : string ;
5152 count : number ;
5253 patternName : string ;
5354 pattern : Pattern ;
@@ -57,7 +58,7 @@ interface StatCardProps {
5758 status : string ;
5859 id : string ;
5960 onCardClick : ( pattern : Pattern ) => void ;
60- onIconClick : ( ) => void ;
61+ onIconClick : ( sortOrder : string ) => void ;
6162 onAuthorClick : ( userId : string ) => void ;
6263 onStatusClick : ( status : string ) => void ;
6364}
@@ -121,6 +122,7 @@ const createQueryParams = (metric: MetricType): BaseQueryParams => ({
121122
122123const StatCardComponent : React . FC < StatCardProps > = ( {
123124 label,
125+ countKey,
124126 count,
125127 patternName,
126128 pattern,
@@ -138,9 +140,9 @@ const StatCardComponent: React.FC<StatCardProps> = ({
138140 onCardClick ( pattern ) ;
139141 } ;
140142
141- const handleIconClick = ( e : React . MouseEvent ) => {
143+ const handleIconClick = ( e : React . MouseEvent , sortOrder : string ) => {
142144 e . stopPropagation ( ) ;
143- onIconClick ( ) ;
145+ onIconClick ( sortOrder ) ;
144146 } ;
145147
146148 const handleAuthorClick = ( e : React . MouseEvent ) => {
@@ -157,10 +159,10 @@ const StatCardComponent: React.FC<StatCardProps> = ({
157159 < StyledCard elevation = { 0 } status = { status } onClick = { handleCardClick } >
158160 < ContentWrapper cardId = { id } >
159161 < HeaderSection >
160- < HeaderTitle > { label } </ HeaderTitle >
161- < IconContainer onClick = { handleIconClick } >
162+ < IconContainer onClick = { ( e ) => handleIconClick ( e , `${ countKey } +desc` ) } >
162163 < Icon className = { id } />
163164 </ IconContainer >
165+ < HeaderTitle > { label } </ HeaderTitle >
164166 </ HeaderSection >
165167
166168 < StatsValue > { count } </ StatsValue >
@@ -238,6 +240,7 @@ const processQueryData = (
238240
239241 return {
240242 label : config . label ,
243+ countKey : config . countKey ,
241244 count : pattern [ config . countKey ] ,
242245 patternName : pattern . name || 'Unknown' ,
243246 pattern : pattern ,
0 commit comments