This repository was archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/legacy-automation-components
- Loading branch information
Showing
7 changed files
with
352 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {Alert, Breadcrumbs, Button, Link, Stack, Typography} from "@mui/material"; | ||
import CardBackground from "@/components/layout/cardBackground"; | ||
import {tagFactory} from "@/src/models/TagModel"; | ||
import TagEditor from "@/components/tags/tagEditor"; | ||
|
||
export default async function RoleDetailPage({params}: { params: { id: string } }) { | ||
const tagId = parseInt(params.id, 10) | ||
const tag = await tagFactory().show(tagId) | ||
|
||
if (isNaN(tagId) || !tag) { | ||
return ( | ||
<Stack spacing={1} mx={2} my={3}> | ||
<Alert severity="error"> | ||
<Typography>タグが存在しません。</Typography> | ||
</Alert> | ||
|
||
<Button variant="contained" href="/tags/"> | ||
タグ管理に戻る | ||
</Button> | ||
</Stack> | ||
) | ||
} | ||
|
||
return ( | ||
<Stack spacing={1} mx={2} my={3}> | ||
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}> | ||
<Link underline="hover" color="inherit" href="/"> | ||
管理者のダッシュボード | ||
</Link> | ||
<Link underline="hover" color="inherit" href={"/tags/"}> | ||
タグ管理 | ||
</Link> | ||
<Typography color="text.primary">{tag.name}</Typography> | ||
</Breadcrumbs> | ||
|
||
<CardBackground title={`タグ情報`}> | ||
<TagEditor tag={tag} /> | ||
</CardBackground> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Stack, Breadcrumbs, Link, Typography} from "@mui/material"; | ||
import CardBackground from "@/components/layout/cardBackground"; | ||
import TagCreator from "@/components/tags/tagCreator"; | ||
|
||
export default function TagCreatePage() { | ||
|
||
return ( | ||
<Stack spacing={1} mx={2} my={3}> | ||
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}> | ||
<Link underline="hover" color="inherit" href="/"> | ||
管理者のダッシュボード | ||
</Link> | ||
<Link underline="hover" color="inherit" href={"/tags/"}> | ||
タグ管理 | ||
</Link> | ||
<Typography color="text.primary">タグ作成</Typography> | ||
</Breadcrumbs> | ||
<CardBackground | ||
title={"タグ作成"} | ||
> | ||
<TagCreator /> | ||
</CardBackground> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Stack, Breadcrumbs, Link, Typography} from "@mui/material"; | ||
import CardBackground from "@/components/layout/cardBackground"; | ||
import {tagFactory} from "@/src/models/TagModel"; | ||
import TagsAgGrid from "@/components/tags/tagsAgGrid"; | ||
|
||
export default async function TagsPage() { | ||
const tags = await tagFactory().index() | ||
|
||
return ( | ||
<Stack spacing={1} mx={2} my={3}> | ||
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}> | ||
<Link underline="hover" color="inherit" href="/"> | ||
管理者のダッシュボード | ||
</Link> | ||
<Typography color="text.primary">タグ管理</Typography> | ||
</Breadcrumbs> | ||
<CardBackground | ||
title={"すべてのタグ"} | ||
button={"作成"} | ||
link={"/tags/create"} | ||
> | ||
<TagsAgGrid tags={tags}/> | ||
</CardBackground> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use client' | ||
import {Button, Stack, TextField, TextFieldProps} from "@mui/material"; | ||
import {useRouter} from "next/navigation"; | ||
import {useRef} from "react"; | ||
import {tagFactory} from "@/src/models/TagModel"; | ||
|
||
export default function TagCreator() { | ||
const router = useRouter() | ||
const nameRef = useRef<TextFieldProps>(null) | ||
|
||
const handleCreate = async () => { | ||
// create role | ||
const name = nameRef.current?.value as string | ||
|
||
if (!name) { | ||
alert("名前を入力してください") | ||
return | ||
} | ||
|
||
await tagFactory().create({ | ||
name: name, | ||
enabled: true, | ||
}) | ||
|
||
// redirect to role page | ||
router.push('/tags') | ||
} | ||
|
||
return ( | ||
<Stack | ||
spacing={1} | ||
> | ||
<TextField | ||
fullWidth | ||
inputRef={nameRef} | ||
label="名前" | ||
sx={{ | ||
width: "50%" | ||
}} | ||
required | ||
/> | ||
|
||
<Stack | ||
direction="row" | ||
spacing={1} | ||
> | ||
<Button | ||
onClick={handleCreate} | ||
variant="contained" | ||
> | ||
作成 | ||
</Button> | ||
|
||
<Button | ||
href="/tags" | ||
variant="contained" | ||
> | ||
キャンセル | ||
</Button> | ||
</Stack> | ||
</Stack> | ||
) | ||
} |
Oops, something went wrong.