Skip to content

Commit eab0ef3

Browse files
committed
bug: fixed typos, wrong homework title
1 parent cb0360b commit eab0ef3

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/content/homeworks/homework1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ On MacOS and Linux (including online terminal):
6767
ssh-keygen -t ed25519 -C "{your-email}"
6868
```
6969

70-
On Window with `Git for Windows` using the bash console.
70+
**On Windows** with `Git for Windows` using the bash console.
7171
More details how to install git with bash for windows will be listed below.
7272

7373
```bash
@@ -111,7 +111,7 @@ dnf install git # for Fedora
111111
brew install git
112112
```
113113

114-
**On Window**, install git and git bash from the [git website](https://git-scm.com/downloads)
114+
**On Windows**, install git and git bash from the [git website](https://git-scm.com/downloads)
115115
![install git](/hw1/windows-install-git.png)
116116

117117
After installation, git bash should appear in your start menu

src/helpers.astro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import type { LessonState } from './types';
44
55
export type AstroLesson = Awaited<ReturnType<typeof getLessons>>[number];
66
7+
type DisplayableArticle = {
8+
data : {
9+
title: string;
10+
order?: number;
11+
state?: keyof LessonState;
12+
};
13+
};
14+
715
export async function getLessons() {
816
return (await getCollection('lessons'))
917
.sort((a, b) => a.data.order - b.data.order);
@@ -33,7 +41,7 @@ export function pagePath(category?: categories) {
3341
return "lessons/";
3442
}
3543
36-
export function pageTitle(lesson: AstroLesson, category?: categories) {
44+
export function pageTitle(lesson: DisplayableArticle, category?: categories) {
3745
switch (category) {
3846
case 'lesson':
3947
return `${lessonMarker(lesson.data.state)} ${lesson.data.order}. ${lesson.data.title}`;

src/layouts/LessonLayout.astro

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { baseUrl } from '../helpers.astro';
2+
import { baseUrl, pageTitle } from '../helpers.astro';
33
import ArticleLayout from './ArticleLayout.astro';
44
55
export interface Props {
@@ -13,14 +13,12 @@ export interface Props {
1313
updatedDate?: Date;
1414
image?: string;
1515
tags?: string[];
16-
category?: 'lesson' | 'bonus',
16+
category?: 'lesson' | 'bonus' | 'homework',
1717
}
1818
1919
const { hideContent, state, order, title, description, image, tags = [], altViewUrl, category = 'lesson' } = Astro.props;
2020
21-
const topTitle = category == 'bonus'
22-
? `Bonus: ${title}`
23-
: order && order >= 0 ? `${order}. ${title}` : title;
21+
const topTitle = pageTitle({ data : { title, order, state } }, category);
2422
---
2523

2624
<ArticleLayout title={title} description={description} image={image} altViewUrl={altViewUrl} altViewType="slides">

src/pages/homeworks/[...slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const altViewProps = !hw.data.hasSlides
2121
: { altViewUrl: `${baseUrl}slides/${hw.slug}`, altViewText: 'show slides'};
2222
---
2323

24-
<LessonLayout {...altViewProps} {...hw.data} category='bonus'>
24+
<LessonLayout {...altViewProps} {...hw.data} category='homework'>
2525
<HomeWorkContent />
2626
</LessonLayout>
2727

0 commit comments

Comments
 (0)