diff --git a/app/(authenticated)/sports/[id]/create-league/page.tsx b/app/(authenticated)/sports/[id]/create-league/page.tsx
index 34e7cc9..806fd76 100644
--- a/app/(authenticated)/sports/[id]/create-league/page.tsx
+++ b/app/(authenticated)/sports/[id]/create-league/page.tsx
@@ -1,6 +1,6 @@
import {Breadcrumbs, Link, Stack, Typography} from "@mui/material";
import CardBackground from "@/components/layout/cardBackground";
-import LeagueDnd from "@/components/league/leagueDnd";
+import LeagueDnd from "@/components/league/create/leagueDnd";
import {sportFactory} from "@/src/models/SportModel";
export default async function LeaguePage({params}: { params: { id: string } }) {
diff --git a/app/(authenticated)/sports/[id]/games/[gameId]/page.tsx b/app/(authenticated)/sports/[id]/games/[gameId]/page.tsx
index bde3291..b24ab32 100644
--- a/app/(authenticated)/sports/[id]/games/[gameId]/page.tsx
+++ b/app/(authenticated)/sports/[id]/games/[gameId]/page.tsx
@@ -3,6 +3,7 @@ import {Stack, Grid, Link, Typography, Breadcrumbs} from "@mui/material";
import CardList from "@/components/layout/cardList";
import {sportFactory} from "@/src/models/SportModel";
import {gameFactory} from "@/src/models/GameModel";
+import LeagueTable from "@/components/league/table/leagueTable";
export default async function GamePage({params}: { params: { gameId:string, id: string } }) {
const gameId = parseInt(params.gameId, 10)
@@ -25,6 +26,7 @@ export default async function GamePage({params}: { params: { gameId:string, id:
{game.name}(ID:{gameId})
+
diff --git a/components/league/dndContainer.tsx b/components/league/create/dndContainer.tsx
similarity index 100%
rename from components/league/dndContainer.tsx
rename to components/league/create/dndContainer.tsx
diff --git a/components/league/dndItem.tsx b/components/league/create/dndItem.tsx
similarity index 100%
rename from components/league/dndItem.tsx
rename to components/league/create/dndItem.tsx
diff --git a/components/league/dndPlaceHolder.tsx b/components/league/create/dndPlaceHolder.tsx
similarity index 100%
rename from components/league/dndPlaceHolder.tsx
rename to components/league/create/dndPlaceHolder.tsx
diff --git a/components/league/dndSortableItem.tsx b/components/league/create/dndSortableItem.tsx
similarity index 100%
rename from components/league/dndSortableItem.tsx
rename to components/league/create/dndSortableItem.tsx
diff --git a/components/league/leagueDnd.tsx b/components/league/create/leagueDnd.tsx
similarity index 100%
rename from components/league/leagueDnd.tsx
rename to components/league/create/leagueDnd.tsx
diff --git a/components/league/table/leagueTable.tsx b/components/league/table/leagueTable.tsx
new file mode 100644
index 0000000..921e66c
--- /dev/null
+++ b/components/league/table/leagueTable.tsx
@@ -0,0 +1,90 @@
+import {Game, gameFactory} from "@/src/models/GameModel";
+import {Sport} from "@/src/models/SportModel";
+import {Stack} from "@mui/material";
+import {ReactNode} from "react";
+import TeamCell from "@/components/league/table/teamCell";
+import SlashCell from "@/components/league/table/slashCell";
+import MatchCell from "@/components/league/table/matchCell";
+
+export type LeagueTableProps = {
+ game: Game
+ sport: Sport
+}
+
+export default async function LeagueTable(props: LeagueTableProps) {
+ const entries = await gameFactory().getGameEntries(props.game.id)
+ const matches = await gameFactory().getGameMatches(props.game.id)
+
+ const cells: ReactNode[] = []
+
+ // create 2 dimensional Stack components
+ // 1st dimension: rows
+ // 2nd dimension: columns
+ // each cell is a LeagueTableCell component
+ for (let i = 0; i < (entries.length + 1); i++) {
+ const rows: ReactNode[] = []
+ for (let j = 0; j < (entries.length + 1); j++) {
+ if (i === 0 && j === 0) {
+ // meaningless data
+ rows.push(
+
+ )
+ }
+ else if (i === 0 || j === 0) {
+ const index = (i === 0) ? (j - 1) : (i - 1)
+ const team = entries[index]
+
+ // Team name
+ rows.push(
+
+ )
+ }
+ else if (i === j) {
+ // meaningless match data
+ rows.push(
+
+ )
+ }
+ else {
+ const leftTeam = entries[i - 1]
+ const rightTeam = entries[j - 1]
+
+ // find the match between leftTeam and rightTeam
+ const match = matches.find(match => {
+ return (match.leftTeamId === leftTeam.id && match.rightTeamId === rightTeam.id) ||
+ (match.leftTeamId === rightTeam.id && match.rightTeamId === leftTeam.id)
+ })
+
+ if (match) {
+ // create a LeagueTableCell component
+ rows.push(
+
+ )
+ }
+ else {
+ // create a LeagueTableCell component
+ rows.push(
+
+ )
+ }
+ }
+ }
+ cells.push({rows})
+ }
+
+
+ return (
+
+ {cells}
+
+ )
+}
diff --git a/components/league/table/matchCell.tsx b/components/league/table/matchCell.tsx
new file mode 100644
index 0000000..6a538f7
--- /dev/null
+++ b/components/league/table/matchCell.tsx
@@ -0,0 +1,53 @@
+import {Box, Typography} from "@mui/material";
+import Link from "next/link";
+import {Match} from "@/src/models/MatchModel";
+import {Sport} from "@/src/models/SportModel";
+import {Game} from "@/src/models/GameModel";
+import {Team} from "@/src/models/TeamModel";
+
+
+export type MatchCellProps = {
+ sport: Sport
+ game: Game
+ match: Match
+ teams: Team[]
+}
+
+export default function MatchCell(props: MatchCellProps) {
+ const leftTeam = props.teams.find(team => team.id === props.match.leftTeamId)
+ const rightTeam = props.teams.find(team => team.id === props.match.rightTeamId)
+
+ if (!leftTeam || !rightTeam) {
+ return (
+
+
+ エラー
+
+
+ )
+ }
+
+ return (
+
+
+ {leftTeam.name} vs {rightTeam.name}
+
+
+ )
+}
\ No newline at end of file
diff --git a/components/league/table/slashCell.tsx b/components/league/table/slashCell.tsx
new file mode 100644
index 0000000..bcfcda2
--- /dev/null
+++ b/components/league/table/slashCell.tsx
@@ -0,0 +1,14 @@
+import {Box} from "@mui/material";
+
+export default function SlashCell() {
+ // display slash
+ return (
+
+
+ )
+}
\ No newline at end of file
diff --git a/components/league/table/teamCell.tsx b/components/league/table/teamCell.tsx
new file mode 100644
index 0000000..b37ab43
--- /dev/null
+++ b/components/league/table/teamCell.tsx
@@ -0,0 +1,28 @@
+import {Box, Typography} from "@mui/material";
+import {Team} from "@/src/models/TeamModel";
+import Link from "next/link";
+
+
+export type TeamCellProps = {
+ team: Team
+}
+
+export default function TeamCell(props: TeamCellProps) {
+
+ return (
+
+
+ {props.team.name}
+
+
+ )
+}
\ No newline at end of file