Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/activities/fukuoka_mitou_2023.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ title:
ja: "福岡未踏 Solve に採択され,LLM-chatbot をチームで開発しました."
en: "Selected for Fukuoka Mitou (Solve) and built LLM-chatbot with a team."
url: "https://note.com/mitou_fukuoka/n/n397fe44895c6"
type: "program"
type: "selection"
8 changes: 8 additions & 0 deletions src/components/activity_entry.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const title = pickLocale(item.title, lang);
background: #7c8cf5;
}

.badge-selection {
background: #f5a623;
}

.badge-study-abroad {
background: #f28cb1;
}

@media (width < 640px) {
.activity-entry {
flex-wrap: wrap;
Expand Down
6 changes: 3 additions & 3 deletions src/data/site_record_schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test("rejects activity dates outside the ISO date format", () => {
expect(result.success).toBe(false);
});

test("accepts a program activity with an end date", () => {
test("accepts a study-abroad activity with an end date", () => {
const result = activitySchema.safeParse({
date: "2024-08-16",
endDate: "2024-09-23",
Expand All @@ -44,8 +44,8 @@ test("rejects an activity that ends before it starts", () => {
const result = activitySchema.safeParse({
date: "2024-01-31",
endDate: "2023-11-01",
title: { ja: "プログラム", en: "Program" },
type: "program",
title: { ja: "採択", en: "Selection" },
type: "selection",
});

expect(result.success).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion src/data/site_record_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const activitySchema = z
endDate: z.iso.date().optional(),
title: localizedTextSchema,
url: z.url().optional(),
type: z.enum(["paper", "talk", "award", "program", "study-abroad", "general"]),
type: z.enum(["paper", "talk", "award", "selection", "study-abroad", "general"]),
})
.strict()
.refine(({ date, endDate }) => endDate === undefined || date <= endDate, {
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ui = {
"activity.type.paper": "論文",
"activity.type.talk": "発表",
"activity.type.award": "受賞",
"activity.type.program": "プログラム",
"activity.type.selection": "採択",
"activity.type.study-abroad": "留学",
"activity.type.general": "お知らせ",
"blog.readMore": "続きを読む",
Expand Down Expand Up @@ -67,7 +67,7 @@ export const ui = {
"activity.type.paper": "Paper",
"activity.type.talk": "Talk",
"activity.type.award": "Award",
"activity.type.program": "Program",
"activity.type.selection": "Selected",
"activity.type.study-abroad": "Study abroad",
"activity.type.general": "News",
"blog.readMore": "Read more",
Expand Down
11 changes: 6 additions & 5 deletions tests/e2e/site.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ test("renders activity collection records with localized type labels", async ({
const entry = page.locator(".activity-entry").first();
await expect(entry).toBeVisible();
await expect(entry.locator("time").first()).toHaveAttribute("datetime", /^\d{4}-\d{2}-\d{2}$/);
await expect(entry.locator(".badge")).toHaveText(/^(論文|発表|受賞|プログラム|留学|お知らせ)$/);
await expect(entry.locator(".badge")).toHaveText(/^(論文|発表|受賞|採択|留学|お知らせ)$/);
});

test("shows dated programs with their periods and links", async ({ page }) => {
test("shows dated activities with their periods, labels, and links", async ({ page }) => {
await page.goto("/en/");

const activities = page.locator('section[aria-labelledby="activities"]');
Expand All @@ -164,9 +164,10 @@ test("shows dated programs with their periods and links", async ({ page }) => {
"href",
"https://www.eng.kyushu-u.ac.jp/programs/program-q2pec/",
);
const program = activities.locator(".activity-entry", { hasText: "Fukuoka Mitou" });
await expect(program).toContainText("2023.11–2024.01");
await expect(program.getByRole("link")).toHaveAttribute(
const selection = activities.locator(".activity-entry", { hasText: "Fukuoka Mitou" });
await expect(selection).toContainText("2023.11–2024.01");
await expect(selection.locator(".badge")).toHaveText("Selected");
await expect(selection.getByRole("link")).toHaveAttribute(
"href",
"https://note.com/mitou_fukuoka/n/n397fe44895c6",
);
Expand Down
Loading