Skip to content

Commit 1f9d789

Browse files
heiskrCopilot
andauthored
Cleanup TODOs and implement English fallbacks for learning tracks (#58767)
Co-authored-by: Copilot <[email protected]>
1 parent 3efb05a commit 1f9d789

File tree

9 files changed

+19
-13
lines changed

9 files changed

+19
-13
lines changed

src/content-linter/lib/linting-rules/image-file-kebab-case.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const imageFileKebabCase = {
1818
suggestedFileName,
1919
imageFileName,
2020
[token.line.indexOf(imageFileName) + 1, imageFileName.length],
21-
null, // Todo add fix
21+
null,
2222
)
2323
}
2424
})

src/deployments/production/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Production deploys
22

3-
For internal Docs relating to our production deploys see [TODO Docs-Engineering URL]
3+
44

55
## Auto deploys
66

src/landings/components/ProductGuidesContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type LearningTrack = {
77
trackProduct: string
88
title: string
99
description: string
10-
guides?: Array<{ href: string; page?: { type: string }; title: string; intro: string }>
10+
guides?: Array<{ href: string; type: string | null; title: string; intro: string }>
1111
}
1212

1313
export type ArticleGuide = {
@@ -60,7 +60,7 @@ export const getProductGuidesContextFromRequest = (req: ExtendedRequest): Produc
6060
title: (guide.title as string) || '',
6161
intro: (guide.intro as string) || '',
6262
href: (guide.href as string) || '',
63-
page: guide.page as { type: string } | undefined,
63+
type: ((guide.page as any)?.type as string) || null,
6464
}),
6565
),
6666
}),

src/learning-track/components/guides/LearningTrack.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export const LearningTrack = ({ track }: Props) => {
3131
<ol className="pl-4 my-3 f4">
3232
{track.guides.map((guide) => (
3333
<li key={guide.href + track.trackName}>
34-
<span className="mr-2">
35-
{tObject('guide_types')[guide.page?.type || ''] as string}
36-
</span>
34+
<span className="mr-2">{tObject('guide_types')[guide.type || ''] as string}</span>
3735
<Link
3836
href={`${guide.href}?learn=${track.trackName}&learnProduct=${track.trackProduct}`}
3937
className="text-underline"

src/learning-track/lib/get-link-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function processLink(
5252
? await executeWithFallback(
5353
context,
5454
() => renderContent(linkHref, context, opts),
55-
() => '', // todo get english linkHref
55+
(enContext: Context) => renderContent(linkHref, enContext, opts),
5656
)
5757
: linkHref
5858
// If the link was `{% ifversion ghes %}/admin/foo/bar{% endifversion %}`

src/learning-track/lib/process-learning-tracks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function processLearningTracks(
2525
? await executeWithFallback(
2626
context,
2727
() => renderContent(rawTrackName, context, renderOpts),
28-
() => '', // todo use english rawTrackName
28+
(enContext: Context) => renderContent(rawTrackName, enContext, renderOpts),
2929
)
3030
: rawTrackName
3131
if (!renderedTrackName) continue

src/learning-track/middleware/learning-track.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,17 @@ export default async function learningTrack(
8686
const trackTitle = await executeWithFallback(
8787
req.context,
8888
() => renderContent(track.title, req.context, renderOpts),
89-
() => '', // todo use english track.title
89+
(enContext: Context) => {
90+
const allEnglishLearningTracks = getDeepDataByLanguage(
91+
'learning-tracks',
92+
'en',
93+
) as LearningTracks
94+
const enTrack = allEnglishLearningTracks[trackProduct]?.[trackName]
95+
if (!enTrack) {
96+
throw new Error(`English learning track not found: ${trackProduct}.${trackName}`)
97+
}
98+
return renderContent(enTrack.title, enContext, renderOpts)
99+
},
90100
)
91101

92102
const currentLearningTrack: CurrentLearningTrack = { trackName, trackProduct, trackTitle }
@@ -176,7 +186,7 @@ async function indexOfLearningTrackGuide(
176186
const renderedGuidePath = await executeWithFallback(
177187
context,
178188
() => renderContent(trackGuidePaths[i], context, renderOpts),
179-
() => '', // todo use english trackGuidePaths[i]
189+
(enContext: Context) => renderContent(trackGuidePaths[i], enContext, renderOpts),
180190
)
181191

182192
if (!renderedGuidePath) continue

src/pages/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,3 @@ npm run dev
140140
```
141141

142142
Routes should load without errors and render correct content from subject directories.
143-

src/shielding/tests/shielding.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ describe('index.md and .md suffixes', () => {
7171
}
7272
})
7373

74-
// TODO-ARTICLEAPI: unskip tests or replace when ready to ship article API
7574
test('any URL that ends with /.md redirects', async () => {
7675
// With language prefix
7776
{

0 commit comments

Comments
 (0)