File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import { isV2Only } from "../common/model";
22
22
import IdeaCard from "./IdeaCard" ;
23
23
import { Idea } from "./model" ;
24
24
import OfflineImageFallback from "../OfflineImageFallback" ;
25
+ import { microbitOrgMiciProjectsUrl } from "../../external-links" ;
26
+ import { useSettings } from "../../settings/settings" ;
25
27
26
28
interface IdeasDocumentationProps {
27
29
ideas : Idea [ ] ;
@@ -64,6 +66,7 @@ const ActiveLevel = ({
64
66
} : ActiveLevelProps ) => {
65
67
const activeIdea = ideas . find ( ( idea ) => idea . slug . current === ideaId ) ;
66
68
const intl = useIntl ( ) ;
69
+ const [ { languageId } ] = useSettings ( ) ;
67
70
const headingString = intl . formatMessage ( { id : "ideas-tab" } ) ;
68
71
const ref = useRef < HTMLDivElement > ( null ) ;
69
72
const contentRect = useResizeObserverContentRect ( ref ) ;
@@ -156,7 +159,7 @@ const ActiveLevel = ({
156
159
link : ( chunks : ReactNode ) => (
157
160
< Link
158
161
color = "brand.500"
159
- href = "https://microbit.org/projects/make-it-code-it/?filters=python"
162
+ href = { microbitOrgMiciProjectsUrl ( languageId ) }
160
163
target = "_blank"
161
164
rel = "noopener"
162
165
>
Original file line number Diff line number Diff line change
1
+ const microbitOrgSupportedLangs = [
2
+ "ar" ,
3
+ "ca" ,
4
+ "cy" ,
5
+ "es-es" ,
6
+ "fr" ,
7
+ "hr" ,
8
+ "ja" ,
9
+ "ko" ,
10
+ "nl" ,
11
+ "pl" ,
12
+ "pt-br" ,
13
+ "pt-pt" ,
14
+ "sr" ,
15
+ "zh-cn" ,
16
+ "zh-tw" ,
17
+ ] ;
18
+
19
+ const langPath = ( languageId : string ) => {
20
+ const lang = languageId . toLowerCase ( ) ;
21
+ return microbitOrgSupportedLangs . includes ( lang ) ? `${ lang } /` : "" ;
22
+ } ;
23
+
24
+ export const microbitOrgUrl = ( languageId : string ) =>
25
+ `https://microbit.org/${ langPath ( languageId ) } ` ;
26
+
27
+ export const microbitOrgMiciProjectsUrl = ( languageId : string ) =>
28
+ `https://microbit.org/${ langPath (
29
+ languageId
30
+ ) } projects/make-it-code-it/?filters=python`;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import { topBarHeight } from "../deployment/misc";
30
30
import { supportedSearchLanguages } from "../documentation/search/search.worker" ;
31
31
import { useSearch } from "../documentation/search/search-hooks" ;
32
32
import SearchDialog from "../documentation/search/SearchDialog" ;
33
+ import { microbitOrgUrl } from "../external-links" ;
33
34
import { useLogging } from "../logging/logging-hooks" ;
34
35
import { RouterState , useRouterState } from "../router-hooks" ;
35
36
import { useSettings } from "../settings/settings" ;
@@ -186,7 +187,7 @@ const SideBarHeader = ({
186
187
>
187
188
< Link
188
189
display = "block"
189
- href = "https://microbit.org/code/"
190
+ href = { microbitOrgUrl ( languageId ) }
190
191
target = "_blank"
191
192
rel = "noopener noreferrer"
192
193
aria-label = { intl . formatMessage ( { id : "visit-dot-org" } ) }
You can’t perform that action at this time.
0 commit comments