Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

サブディレクトリーによるルーティング #57

Merged
merged 5 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 18 additions & 3 deletions app/(authenticated)/images/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Alert, Breadcrumbs, Button, Link, Stack, Typography} from "@mui/material
import CardBackground from "@/components/layout/cardBackground";
import {imageFactory} from "@/src/models/ImageModel";
import ImageEditor from "@/components/images/imageEditor";
import NextLink from "next/link";

export default async function ImageEditPage({params}: { params: { id: string } }) {
const imageId = parseInt(params.id, 10)
Expand All @@ -14,7 +15,11 @@ export default async function ImageEditPage({params}: { params: { id: string } }
<Typography>画像が削除されました。</Typography>
</Alert>

<Button variant="contained" href="/images/">
<Button
variant="contained"
href="/images/"
component={NextLink}
>
画像管理に戻る
</Button>
</Stack>
Expand All @@ -24,10 +29,20 @@ export default async function ImageEditPage({params}: { params: { id: string } }
return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href={"/images/"}>
<Link
underline="hover"
color="inherit"
href={"/images/"}
component={NextLink}
>
画像管理
</Link>
<Typography color="text.primary">{image.id}</Typography>
Expand Down
15 changes: 13 additions & 2 deletions app/(authenticated)/images/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import {Stack, Breadcrumbs, Link, Typography} from "@mui/material";
import CardBackground from "@/components/layout/cardBackground";
import ImageCreator from "@/components/images/imageCreator";
import NextLink from "next/link";

export default function ImageCreatePage() {

return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href={"/images/"}>
<Link
underline="hover"
color="inherit"
href={"/images/"}
component={NextLink}
>
画像管理
</Link>
<Typography color="text.primary">画像作成</Typography>
Expand Down
16 changes: 14 additions & 2 deletions app/(authenticated)/images/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import {Stack, Breadcrumbs, Link, Typography, Avatar, Button} from "@mui/materia
import CardBackground from "@/components/layout/cardBackground";
import {imageFactory} from "@/src/models/ImageModel";
import React from "react";
import NextLink from "next/link";

export default async function ImagesPage() {
const images = await imageFactory().index()

return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Typography color="text.primary">画像管理</Typography>
Expand All @@ -21,7 +27,13 @@ export default async function ImagesPage() {
>
<Stack spacing={1}>
{images?.map((image) => (
<Button variant={"contained"} fullWidth href={`/images/${image.id}`} key={image.id}>
<Button
variant={"contained"}
fullWidth
href={`/images/${image.id}`}
component={NextLink}
key={image.id}
>
<Stack direction={"row"} spacing={2} alignItems={"center"} sx={{width:"100%"}}>
<Avatar src={`${process.env.NEXT_PUBLIC_API_URL}/images/${image.id}/file`}/>
<Typography>
Expand Down
8 changes: 7 additions & 1 deletion app/(authenticated)/locations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import {Breadcrumbs, Link, Stack, Typography} from "@mui/material";
import CardBackground from "@/components/layout/cardBackground";
import NextLink from "next/link";

export default function LocationPage() {
return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl:2}}>
<Link underline="hover" color="inherit" href="/public">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Typography color="text.primary">場所管理</Typography>
Expand Down
21 changes: 18 additions & 3 deletions app/(authenticated)/roles/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CardBackground from "@/components/layout/cardBackground";
import {roleFactory} from "@/src/models/RoleModel";
import {permissionFactory} from "@/src/models/PermissionModel";
import RoleEditor from "@/components/roles/roleEditor";
import NextLink from "next/link";

export default async function RoleDetailPage({params}: { params: { id: string } }) {
const roleId = parseInt(params.id, 10)
Expand All @@ -16,7 +17,11 @@ export default async function RoleDetailPage({params}: { params: { id: string }
<Typography>ロールが存在しません。</Typography>
</Alert>

<Button variant="contained" href="/roles/">
<Button
variant="contained"
href="/roles/"
component={NextLink}
>
ロール管理に戻る
</Button>
</Stack>
Expand All @@ -26,10 +31,20 @@ export default async function RoleDetailPage({params}: { params: { id: string }
return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href="/roles/">
<Link
underline="hover"
color="inherit"
href="/roles/"
component={NextLink}
>
ロール管理
</Link>
<Typography color="text.primary">{role.name}</Typography>
Expand Down
15 changes: 13 additions & 2 deletions app/(authenticated)/roles/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import {Stack, Breadcrumbs, Link, Typography} from "@mui/material";
import CardBackground from "@/components/layout/cardBackground";
import RoleCreator from "@/components/roles/roleCreator";
import NextLink from "next/link";

export default function RoleCreatePage() {


return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
component={NextLink}
href="/"
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href="/roles/">
<Link
underline="hover"
color="inherit"
href="/roles/"
component={NextLink}
>
ロール管理
</Link>
<Typography color="text.primary">ロール作成</Typography>
Expand Down
8 changes: 7 additions & 1 deletion app/(authenticated)/roles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import {Stack, Breadcrumbs, Link, Typography} from "@mui/material";
import {roleFactory} from "@/src/models/RoleModel";
import RolesAgGrid from "@/components/roles/rolesAgGrid";
import CardBackground from "@/components/layout/cardBackground";
import NextLink from "next/link";

export default async function RolesPage() {
const roles = await roleFactory().index()

return (
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Typography color="text.primary">ロール管理</Typography>
Expand Down
22 changes: 19 additions & 3 deletions app/(authenticated)/sports/[id]/automatic-match-editor/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Stack, Link, Typography, Breadcrumbs} from "@mui/material";
import {sportFactory} from "@/src/models/SportModel";
import {gameFactory} from "@/src/models/GameModel";
import {CrossGameAutomaticMatchEditor} from "@/components/automation/CrossGameAutomaticMatchEditor";
import NextLink from "next/link";

export default async function CrossGameAutomaticMatchEditorPage({params}: { params: { id: string } }) {
const sportId = parseInt(params.id, 10)
Expand All @@ -13,13 +14,28 @@ export default async function CrossGameAutomaticMatchEditorPage({params}: { para
return(
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl:2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href={"/sports"}>
<Link
underline="hover"
color="inherit"
href={"/sports"}
component={NextLink}
>
競技管理
</Link>
<Link underline="hover" color="inherit" href={`/sports/${sportId}`}>
<Link
underline="hover"
color="inherit"
href={`/sports/${sportId}`}
component={NextLink}
>
{sport.name}
</Link>
<Typography color="text.primary">一括試合編集(Cross Game)</Typography>
Expand Down
22 changes: 19 additions & 3 deletions app/(authenticated)/sports/[id]/create-league/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CardBackground from "@/components/layout/cardBackground";
import {sportFactory} from "@/src/models/SportModel";
import GameForm from "@/components/league/legacy/GameForm";
import {tagFactory} from "@/src/models/TagModel";
import NextLink from "next/link";

export default async function LeaguePage({params}: { params: { id: string } }) {
const sportId = parseInt(params.id, 10)
Expand All @@ -12,13 +13,28 @@ export default async function LeaguePage({params}: { params: { id: string } }) {
return (
<Stack spacing={2} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Link underline="hover" color="inherit" href="/public">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href={"/sports"}>
<Link
underline="hover"
color="inherit"
href={"/sports"}
component={NextLink}
>
競技管理
</Link>
<Link underline="hover" color="inherit" href={`/sports/${sportId}`}>
<Link
underline="hover"
color="inherit"
href={`/sports/${sportId}`}
component={NextLink}
>
{sport.name}
</Link>
<Typography color="text.primary">リーグを作成・編集</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Stack, Link, Typography, Breadcrumbs} from "@mui/material";
import {sportFactory} from "@/src/models/SportModel";
import {gameFactory} from "@/src/models/GameModel";
import {AutomaticMatchEditor} from "@/components/automation/AutomaticMatchEditor";
import NextLink from "next/link";

export default async function AutomaticMatchEditorPage({params}: { params: { gameId:string, id: string } }) {
const gameId = parseInt(params.gameId, 10)
Expand All @@ -13,16 +14,36 @@ export default async function AutomaticMatchEditorPage({params}: { params: { gam
return(
<Stack spacing={1} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl:2}}>
<Link underline="hover" color="inherit" href="/">
<Link
underline="hover"
color="inherit"
href="/"
component={NextLink}
>
管理者のダッシュボード
</Link>
<Link underline="hover" color="inherit" href={"/sports"}>
<Link
underline="hover"
color="inherit"
href={"/sports"}
component={NextLink}
>
競技管理
</Link>
<Link underline="hover" color="inherit" href={`/sports/${sport.id}`}>
<Link
underline="hover"
color="inherit"
href={`/sports/${sport.id}`}
component={NextLink}
>
{sport.name}
</Link>
<Link underline="hover" color="inherit" href={`/sports/${sport.id}/games/${game.id}`}>
<Link
underline="hover"
color="inherit"
href={`/sports/${sport.id}/games/${game.id}`}
component={NextLink}
>
{game.name}(ID:{gameId})
</Link>
<Typography color="text.primary">試合一括編集</Typography>
Expand Down
Loading
Loading