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

ダッシュボードにお知らせリストを追加 feat: information list in dashboard #64

Merged
merged 1 commit into from
Oct 8, 2024
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 app/(authenticated)/information/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function InformationCreatePage() {
<Link
underline="hover"
color="inherit"
href={"/tags/"}
href={"/information/"}
component={NextLink}
>
お知らせ管理
Expand Down
13 changes: 7 additions & 6 deletions app/(authenticated)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import {Breadcrumbs, Grid, Stack, Typography, useTheme} from "@mui/material"
import {Breadcrumbs, Grid, Stack, Typography} from "@mui/material"
import CardBackground from "@/components/layout/cardBackground"
import CardLarge from "@/components/layout/cardLarge"
import SportsList from "@/components/sports/sportsList"
import {sportFactory} from "@/src/models/SportModel"
import InProgressMatchList from "@/components/match/inProgressMatchList"
import {informationFactory} from "@/src/models/InformationModel";
import InformationList from "@/components/information/informationList";

export default async function Home() {
const sports = await sportFactory().index()
const informationList = await informationFactory().index()

return (
<Stack spacing={2} mx={2} my={3}>
<Breadcrumbs aria-label="breadcrumb" sx={{pl: 2}}>
<Typography color="text.primary">管理者のダッシュボード</Typography>
</Breadcrumbs>
<CardBackground title={"配信中のお知らせ"} button={"お知らせを作成・編集"}>
<CardLarge>
この機能は開発中です
</CardLarge>
<CardBackground title={"配信中のお知らせ"} button={"お知らせを作成・編集"} link={"/information"}>
<InformationList informationList={informationList}/>
</CardBackground>
<CardBackground title={"競技から選ぶ"} button={"競技を作成・編集する"} link={"/sports"}>
<Grid container spacing={1}>
Expand Down
3 changes: 2 additions & 1 deletion components/information/informationAgGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ModuleRegistry.registerModules([ClientSideRowModelModule]);

export type InformationAgGridProps = {
informationList: Information[]
dashboard?: boolean
}

// Row Data Interface
Expand All @@ -24,7 +25,7 @@ type IRow = {

// Create new GridExample component
export default function InformationAgGrid(props: InformationAgGridProps) {
const height = 'calc(100vh - 230px)';
const height = props.dashboard ? '200px' : 'calc(100vh - 230px)';
const router = useRouter()
// Row Data: The data to be displayed.
const [rowData, setRowData] = useState<IRow[]>([])
Expand Down
57 changes: 57 additions & 0 deletions components/information/informationList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {Information} from "@/src/models/InformationModel";
import {Stack, Typography, IconButton, Button} from "@mui/material";
import {HiOutlineInformationCircle} from "react-icons/hi";
import React from "react";

export type InformationListProps = {
informationList: Information[]
}

export default function InformationList(props: InformationListProps) {
const list = props.informationList.map((information) => {
return (
<Button href={`/information/${information.id}`} sx={{py:1.5, px:2,mb:1, width:"100%", backgroundColor:"secondary.main", color:"text.primary"}} key={information.id}>
<Stack spacing={1} direction={"row"} width={"100%"} justifyContent={"flex-start"} alignItems="center">
<Typography
color={"text.primary"}
sx={{fontSize: "12px", mx:2}}
lineHeight={"1.2em"}
>
{information.id}
</Typography>
<IconButton
sx={{backgroundColor: "background.default"}}
>
<HiOutlineInformationCircle color={"text.primary"}/>
</IconButton>
<Stack
direction={"column"}
justifyContent={"space-between"}
alignItems={"flex-start"}
spacing={1}
>
<Typography
color={"text.primary"}
sx={{fontSize: "14px", fontWeight: "bold"}}
lineHeight={"1.2em"}
>
{information.name}
</Typography>
<Typography
color={"text.primary"}
sx={{fontSize: "14px"}}
lineHeight={"1.2em"}
>
{information.content}
</Typography>
</Stack>
</Stack>
</Button>
)
})
return (
<>
{list}
</>
)
}
24 changes: 0 additions & 24 deletions components/layout/cardLarge.tsx

This file was deleted.

Loading