Skip to content

Commit

Permalink
✨feat: add 3rd program to history
Browse files Browse the repository at this point in the history
  • Loading branch information
Marukome0743 committed Jul 26, 2024
1 parent 4ba8180 commit 3934d8c
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/@modal/(.)history/hiroshima/[key]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function HiroshimaModal({
params: { key },
}: Readonly<{ params: { key: string } }>): JSX.Element {
const history: EventDate = HIROSHIMA_HISTORY.find(
(history) => history.date === key,
(history) => history.href === key,
) as EventDate

return (
Expand Down
2 changes: 1 addition & 1 deletion app/@modal/default.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactNode } from "react"

export default function Default(): ReactNode {
return "..."
return null
}
2 changes: 1 addition & 1 deletion app/default.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactNode } from "react"

export default function Default(): ReactNode {
return "..."
return null
}
2 changes: 1 addition & 1 deletion app/history/hiroshima/[key]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function HiroshimaVideo({
params: { key },
}: Readonly<{ params: { key: string } }>): JSX.Element {
const eventDate: EventDate = HIROSHIMA_HISTORY.find(
(history) => history.date === key,
(history) => history.href === key,
) as EventDate

return (
Expand Down
52 changes: 8 additions & 44 deletions app/history/hiroshima/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LineRegister } from "@/app/components/button/lineAddFriends"
import { Heading } from "@/app/components/layout/heading"
import { Schedules } from "@/app/history/schedules"
import type { Schedule } from "@/app/interfaces/schedule"
import { Programs } from "@/app/history/programs"
import type { Program } from "@/app/interfaces/schedule"
import {
HIROSHIMA,
HIROSHIMA_HISTORY,
Expand All @@ -17,14 +17,15 @@ export default function Hiroshima(): JSX.Element {
<>
<Heading menu={HISTORY} submenu={HIROSHIMA} />
{HIROSHIMA_HISTORY.map((history) => (
<section key={history.date} className="grid gap-4">
<section key={history.href} className="grid gap-4">
<h2 className="font-bold font-zenMaruGothic text-3xl">
{history.title}
</h2>
{history === HIROSHIMA_HISTORY[3] ? (
<ForthEvent />
) : (
<Link href={`/history/hiroshima/${history.date}`}>
{history.programs && (
<Programs programs={history.programs as Program[]} />
)}
{history !== HIROSHIMA_HISTORY[3] && (
<Link href={`/history/hiroshima/${history.href}`}>
<button
type="button"
className="bg-sky-400 blue-shine btn shadow-lg text-lg text-white w-full"
Expand All @@ -42,40 +43,3 @@ export default function Hiroshima(): JSX.Element {
</>
)
}

function ForthEvent(): JSX.Element {
const schedules: Schedule[] = [
{
alt: "はんだ付け",
src: "/202311/eda_island/soldering.avif",
color: "bg-teal-400",
title: "前半:ロボット制作\n後半:サマーキャンプ",
date: { month: "7", day: "6", dayOfWeek: "土" },
venue: "広島大学東広島キャンパス",
address: "広島県東広島市鏡山1-3-2",
tags: ["ロボット制作", "自然学習"],
},
{
alt: "SUP体験",
src: "/202206/eda_island/sup_on_the_sea.avif",
color: "bg-sky-400",
title: "前半:プログラミング体験\n後半:江田島の海でSUP体験",
date: { month: "7", day: "13", dayOfWeek: "土" },
venue: "能美市民センター",
address: "広島県江田島市能美町中町4859-9",
tags: ["プログラミング", "自然学習"],
},
{
alt: "結婚式体験",
src: "/202311/wedding/wrapping_bouquet.avif",
color: "bg-rose-400",
title: "午前:ロボサバ大会\n午後:結婚式体験",
date: { month: "7", day: "20", dayOfWeek: "土" },
venue: "アーククラブ迎賓館福山",
address: "広島県福山市西町1-6-28",
tags: ["ロボサバ", "結婚式体験"],
},
] as const

return <Schedules schedules={schedules} />
}
18 changes: 9 additions & 9 deletions app/history/schedules.tsx → app/history/programs.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import type { Schedule } from "@/app/interfaces/schedule"
import type { Program } from "@/app/interfaces/schedule"
import type { JSX } from "react"

export function Schedules({
schedules,
}: Readonly<{ schedules: Schedule[] }>): JSX.Element {
export function Programs({
programs,
}: Readonly<{ programs: Program[] }>): JSX.Element {
return (
<section className="bg-amber-50 font-bold grid mx-auto relative w-full">
<span className="absolute bg-sky-400 justify-self-start left-0 p-1 top-0">
開催日時
</span>
<ul>
{schedules.map((schedule) => (
<li key={schedule.alt} className="grid gap-1 border-b p-2">
{programs.map((program) => (
<li key={program.venue} className="grid gap-1 border-b p-2">
<p>
2024年{schedule.date.month}{schedule.date.day}日(
{schedule.date.dayOfWeek})
{program.date.year}{program.date.month}{program.date.day}日(
{program.date.dayOfWeek})
</p>
<p>
<span className="badge badge-outline badge-xs mr-1">場所</span>
{schedule.venue}
{program.venue}
</p>
</li>
))}
Expand Down
8 changes: 7 additions & 1 deletion app/interfaces/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export type Schedule = {
tags: string[]
}

export type Program = {
date: { year: string; month: string; day: string; dayOfWeek: string }
venue: string
}

export type EventDate = {
date: string
href: string
title: string
programs?: Program[]
}
95 changes: 90 additions & 5 deletions app/lib/constant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Guideline } from "@/app/interfaces/guideline"
import type { Menu, Submenu } from "@/app/interfaces/menu"
import type { EventDate } from "@/app/interfaces/schedule"
import type { EventDate, Program } from "@/app/interfaces/schedule"
import {
GlobeAsiaAustraliaIcon,
HeartIcon,
Expand Down Expand Up @@ -70,21 +70,106 @@ export const TOKYO_CHIBA_GUIDELINE: Guideline = {
lineLink: TOKYO_CHIBA_LINE,
}

// const HIROSHIMA_202407_SCHEDULES: Schedule[] = [
// {
// alt: "はんだ付け",
// src: "/202311/eda_island/soldering.avif",
// color: "bg-teal-400",
// title: "前半:ロボット制作\n後半:サマーキャンプ",
// date: { month: "7", day: "6", dayOfWeek: "土" },
// venue: "広島大学東広島キャンパス",
// address: "広島県東広島市鏡山1-3-2",
// tags: ["ロボット制作", "自然学習"],
// },
// {
// alt: "SUP体験",
// src: "/202206/eda_island/sup_on_the_sea.avif",
// color: "bg-sky-400",
// title: "前半:プログラミング体験\n後半:江田島の海でSUP体験",
// date: { month: "7", day: "13", dayOfWeek: "土" },
// venue: "能美市民センター",
// address: "広島県江田島市能美町中町4859-9",
// tags: ["プログラミング", "自然学習"],
// },
// {
// alt: "結婚式体験",
// src: "/202311/wedding/wrapping_bouquet.avif",
// color: "bg-rose-400",
// title: "午前:ロボサバ大会\n午後:結婚式体験",
// date: { month: "7", day: "20", dayOfWeek: "土" },
// venue: "アーククラブ迎賓館福山",
// address: "広島県福山市西町1-6-28",
// tags: ["ロボサバ", "結婚式体験"],
// },
// ] as const

const HIROSHIMA_SECOND_PROGRAMS: Program[] = [
{
date: { year: "2023", month: "5", day: "27", dayOfWeek: "木" },
venue: "ひと・まちプラザ",
},
{
date: { year: "2023", month: "6", day: "3", dayOfWeek: "土" },
venue: "能美市民センター",
},
{
date: { year: "2023", month: "6", day: "10", dayOfWeek: "土" },
venue: "三段峡ホテル",
},
{
date: { year: "2023", month: "6", day: "24", dayOfWeek: "土" },
venue: "ひろぎんホールディングス",
},
] as const

const HIROSHIMA_THIRD_PROGRAMS: Program[] = [
{
date: { year: "2023", month: "11", day: "23", dayOfWeek: "木" },
venue: "コミュニティスペース「フウド」",
},
{
date: { year: "2023", month: "11", day: "25", dayOfWeek: "土" },
venue: "三段峡ホテル",
},
{
date: { year: "2023", month: "12", day: "2", dayOfWeek: "土" },
venue: "アーククラブ迎賓館広島",
},
] as const

const HIROSHIMA_FOURTH_PROGRAMS: Program[] = [
{
date: { year: "2024", month: "7", day: "6", dayOfWeek: "土" },
venue: "広島大学東広島キャンパス",
},
{
date: { year: "2024", month: "7", day: "13", dayOfWeek: "土" },
venue: "能美市民センター",
},
{
date: { year: "2024", month: "7", day: "20", dayOfWeek: "土" },
venue: "アーククラブ迎賓館福山",
},
] as const

export const HIROSHIMA_HISTORY: EventDate[] = [
{
date: "202206",
href: "202206",
title: "第1回 2022年6月",
},
{
date: "202306",
href: "202306",
title: "第2回 2023年6月",
programs: HIROSHIMA_SECOND_PROGRAMS,
},
{
date: "202311",
href: "202311",
title: "第3回 2023年11月",
programs: HIROSHIMA_THIRD_PROGRAMS,
},
{
date: "202407",
href: "202407",
title: "第4回 2024年7月",
programs: HIROSHIMA_FOURTH_PROGRAMS,
},
]

0 comments on commit 3934d8c

Please sign in to comment.