11import React , { useMemo , useState , useRef , useEffect , KeyboardEvent } from "react" ;
22import styles from "./styles.module.css" ;
3+ import 'flag-icons/css/flag-icons.min.css' ;
4+ import useBaseUrl from '@docusaurus/useBaseUrl' ;
35
46export type OtcCategory =
57 | "Application"
@@ -132,6 +134,7 @@ export default function OtcServicesColumns() {
132134 const ALL_CATS = Array . from ( new Set ( SERVICES . map ( s => s . category ) ) ) . sort ( ) ;
133135 const [ categoryFilter , setCategoryFilter ] = useState < string > ( "all" ) ;
134136 const OTC_CATEGORY_OPTIONS : string [ ] = [ "all" , ...ALL_CATS ] ;
137+ const noDataImg = useBaseUrl ( '/img/undraw_no-data_ig65.svg' ) ;
135138
136139 const toggleChip = ( c : Chip ) =>
137140 setChips ( ( prev ) => {
@@ -245,6 +248,41 @@ export default function OtcServicesColumns() {
245248 }
246249 }
247250
251+ const renderRegionChip = ( region : Region ) => {
252+ if ( region === "global" ) return null ;
253+
254+ const cls =
255+ region === "eu-de" ? "fi fi-de" :
256+ region === "eu-nl" ? "fi fi-nl" :
257+ region === "eu-ch" ? "fi fi-ch fis" : "" ;
258+
259+ return (
260+ < span
261+ className = { `${ styles . flag } ${ cls } ` }
262+ key = { region }
263+ title = { region }
264+ > </ span >
265+ ) ;
266+ } ;
267+
268+ const renderRegionFooter = ( region : Region ) => {
269+ if ( region === "global" ) {
270+ return < span key = { region } > GLOBAL</ span > ;
271+ }
272+
273+ const cls =
274+ region === "eu-de" ? "fi fi-de" :
275+ region === "eu-nl" ? "fi fi-nl" :
276+ region === "eu-ch" ? "fi fi-ch fis" : "" ;
277+
278+ return (
279+ < span
280+ className = { `${ styles . flag } ${ cls } ` }
281+ key = { region }
282+ > </ span >
283+ ) ;
284+ } ;
285+
248286 return (
249287 < div className = { styles . otcWrap } >
250288 < div className = { styles . otcMax } >
@@ -305,13 +343,8 @@ export default function OtcServicesColumns() {
305343 selected = { isRegionActive ( r ) ? true : undefined }
306344 title = { r . toUpperCase ( ) }
307345 >
308- { r === "global"
309- ? "GLOBAL"
310- : r === "eu-de"
311- ? "🇩🇪 EU-DE"
312- : r === "eu-nl"
313- ? "🇳🇱 EU-NL"
314- : "🇨🇭 EU-CH" }
346+ { renderRegionChip ( r ) }
347+ { ` ${ r . toUpperCase ( ) } ` }
315348 </ scale-chip >
316349 ) ) }
317350 </ div >
@@ -323,7 +356,7 @@ export default function OtcServicesColumns() {
323356 { filtered . length === 0 ? (
324357 < div className = { styles . emptyFill } >
325358 < div className = { styles . emptyState } >
326- < img src = "/img/undraw_no-data_ig65.svg" alt = "No results" />
359+ < img src = { noDataImg } />
327360 < h3 > No results match your filters.</ h3 >
328361 </ div >
329362 </ div >
@@ -347,15 +380,7 @@ export default function OtcServicesColumns() {
347380 < div className = { styles . flags } >
348381 { s . regions . map ( ( r ) => (
349382 < span className = { styles . flag } key = { r } >
350- { r === "global"
351- ? "🌐"
352- : r === "eu-de"
353- ? "🇩🇪"
354- : r === "eu-nl"
355- ? "🇳🇱"
356- : r === "eu-ch"
357- ? "🇨🇭"
358- : r }
383+ { renderRegionFooter ( r ) }
359384 </ span >
360385 ) ) }
361386 </ div >
0 commit comments