@@ -57,12 +57,6 @@ export interface TemplatesPageViewProps {
57
57
error ?: unknown ;
58
58
}
59
59
60
- const sortOrgs = ( templatesByOrg : TemplatesByOrg ) => {
61
- return templatesByOrg
62
- ? Object . keys ( templatesByOrg ) . sort ( ( a , b ) => a . localeCompare ( b ) )
63
- : undefined ;
64
- } ;
65
-
66
60
export const TemplatesPageView : FC < TemplatesPageViewProps > = ( {
67
61
templatesByOrg,
68
62
examples,
@@ -72,7 +66,6 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
72
66
const navigate = useNavigate ( ) ;
73
67
const [ urlParams ] = useSearchParams ( ) ;
74
68
const isEmpty = templatesByOrg && templatesByOrg [ "all" ] . length === 0 ;
75
- const orgs = templatesByOrg ? sortOrgs ( templatesByOrg ) : undefined ;
76
69
const activeOrg = urlParams . get ( "org" ) ?? "all" ;
77
70
const visibleTemplates = templatesByOrg
78
71
? templatesByOrg [ activeOrg ]
@@ -110,19 +103,17 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
110
103
css = { { width : 208 , flexShrink : 0 , position : "sticky" , top : 48 } }
111
104
>
112
105
< span css = { styles . filterCaption } > ORGANIZATION</ span >
113
- { orgs . map ( ( org ) => (
106
+ { Object . entries ( templatesByOrg ) . map ( ( org ) => (
114
107
< Link
115
- key = { org }
116
- to = { `?org=${ org } ` }
108
+ key = { org [ 0 ] }
109
+ to = { `?org=${ org [ 0 ] } ` }
117
110
css = { [
118
111
styles . tagLink ,
119
- org === activeOrg && styles . tagLinkActive ,
112
+ org [ 0 ] === activeOrg && styles . tagLinkActive ,
120
113
] }
121
114
>
122
- { org === "all"
123
- ? org
124
- : templatesByOrg [ org ] [ 0 ] . organization_display_name }
125
- ({ templatesByOrg [ org ] . length } )
115
+ { org [ 0 ] === "all" ? "all" : org [ 1 ] [ 0 ] . organization_display_name } { " " }
116
+ ({ org [ 1 ] . length } )
126
117
</ Link >
127
118
) ) }
128
119
</ Stack >
0 commit comments