File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,15 @@ const CodeSnippet: React.FC<CodeSnippetProps> = ({
260260 return `${ resolvedSdk } _${ lang } ` ;
261261 }
262262
263- if ( lang ) return lang ;
263+ if ( lang ) {
264+ // Check if lang matches directly in the available languages
265+ if ( languages . includes ( lang ) ) return lang ;
266+ // Check if lang matches a prefixed language when stripped
267+ // (e.g., lang="android" matches "chat_android" after stripping)
268+ const prefixedMatch = languages . find ( ( l ) => stripSdkType ( l ) === lang ) ;
269+ if ( prefixedMatch ) return prefixedMatch ;
270+ return lang ;
271+ }
264272
265273 if ( filteredLanguages . length > 0 ) return filteredLanguages [ 0 ] ;
266274
Original file line number Diff line number Diff line change @@ -125,24 +125,29 @@ const languages: LanguageMap = {
125125 icon : "icon-tech-flutter" ,
126126 syntaxHighlighterKey : "dart" ,
127127 } ,
128- jetpack : {
129- label : "Jetpack Compose " ,
130- icon : "icon-tech-jetpack " ,
128+ chat_android : {
129+ label : "Android " ,
130+ icon : "icon-tech-android-head " ,
131131 syntaxHighlighterKey : "kotlin" ,
132132 } ,
133133} ;
134134
135135export const stripSdkType = ( lang : string ) => {
136- if ( lang . startsWith ( "realtime_" ) || lang . startsWith ( "rest_" ) ) {
136+ if ( lang . startsWith ( "realtime_" ) || lang . startsWith ( "rest_" ) || lang . startsWith ( "chat_" ) ) {
137137 return lang . split ( "_" ) . slice ( 1 ) . join ( "_" ) ;
138138 }
139139 return lang ;
140140} ;
141141
142142// Fallback function to handle languages not in the map
143143export const getLanguageInfo = ( langKey : string ) : LanguageInfo => {
144- const key = stripSdkType ( langKey ) . toLowerCase ( ) ;
144+ // Check full key first (e.g., "chat_android" has its own entry)
145+ if ( languages [ langKey . toLowerCase ( ) ] ) {
146+ return languages [ langKey . toLowerCase ( ) ] ;
147+ }
145148
149+ // Then try stripping the SDK type prefix
150+ const key = stripSdkType ( langKey ) . toLowerCase ( ) ;
146151 if ( languages [ key ] ) {
147152 return languages [ key ] ;
148153 }
You can’t perform that action at this time.
0 commit comments