Skip to content

Commit

Permalink
transferボタン追加、user画面編集
Browse files Browse the repository at this point in the history
  • Loading branch information
aki-0517 committed Dec 6, 2024
1 parent 64099ec commit d320df9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 669 deletions.
57 changes: 27 additions & 30 deletions packages/nextjs/app/enterpreneur/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { Typography } from "@mui/material";
import { Card } from "~~/components/Card";
import { CardList } from "~~/components/CardList";
import DividerWithText from "~~/components/DividerWithText";
import { useAccount } from "wagmi";
import { useERC721List } from "~~/hooks/scaffold-eth/useERC721List";
import Button from "@mui/material/Button";

// タブの種類を表すユニオン型を定義
type TabType = "割引券" | "引換券" | "会員券";
Expand All @@ -24,41 +27,24 @@ const content = {
export default function TicketTabs() {
const [value, setValue] = useState<TabType>("割引券");

const { address } = useAccount();
const { vouchers } = useERC721List(address || '');

const handleChange = (event: React.SyntheticEvent, newValue: number) => {
const tabLabels: TabType[] = ["割引券", "引換券", "会員券"];
setValue(tabLabels[newValue]);
};

const cards = [
{
title: "引換券",
issueDate: "2024.12.05",
amount: 7000,
expiryDate: "2025.06.30",
usageScope: "店舗全体",
},
{
title: "引換券",
issueDate: "2024.12.05",
amount: 7000,
expiryDate: "2025.06.30",
usageScope: "店舗全体",
},
{
title: "引換券",
issueDate: "2024.12.05",
amount: 7000,
expiryDate: "2025.06.30",
usageScope: "店舗全体",
},
{
title: "引換券",
issueDate: "2024.12.05",
amount: 7000,
expiryDate: "2025.06.30",
usageScope: "店舗全体",
},
];
const cards = vouchers?.map((voucher) => {
const amount = voucher.amount;
return {
title: voucher.title,
issueDate: voucher.issueDate.toString(),
amount: Number(amount),
expiryDate: voucher.expiryDate.toString(),
usageScope: voucher.usageScope,
};
}) || [];

return (
<div>
Expand All @@ -72,6 +58,17 @@ export default function TicketTabs() {
</Box>
<DividerWithText />
<CardList cards={cards} />
<Button
variant="contained"
color="error"
sx={{
fontWeight: "bold",
display: "block", // 中央揃えのためにブロック要素に
margin: "100px auto", // 上下に20pxのマージンを追加、左右は自動で中央揃え
}}
>
クーポンを送る
</Button>
</div>
);
}
20 changes: 19 additions & 1 deletion packages/nextjs/app/user/list/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { Button, Typography } from '@mui/material';
import type { NextPage } from 'next';
import { useAccount } from 'wagmi';
import { CardList } from '~~/components/CardList';
Expand All @@ -21,7 +22,24 @@ const UserListPage: NextPage = () => {
}) || [];


return <CardList cards={cards} />;
return (
<div>
<Typography variant="h5" sx={{ textAlign: "center", mt: 5 }}>
取得クーポン一覧
</Typography>
<CardList cards={cards} />
<Button
variant="contained"
color="error"
sx={{
fontWeight: "bold",
display: "block", // 中央揃えのためにブロック要素に
margin: "100px auto", // 上下に20pxのマージンを追加、左右は自動で中央揃え
}}
>
クーポンを売る
</Button>
</div>) ;
};

export default UserListPage;
2 changes: 1 addition & 1 deletion packages/nextjs/components/ScaffoldEthAppWithProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
<div className={`flex flex-col min-h-screen `}>
<Header />
<main className="relative flex flex-col flex-1">{children}</main>
<Footer />
{/* <Footer /> */}
</div>
<Toaster />
</>
Expand Down
Loading

0 comments on commit d320df9

Please sign in to comment.