-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from h8570rg/develop
Prd
- Loading branch information
Showing
15 changed files
with
209 additions
and
79 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
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
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
4 changes: 3 additions & 1 deletion
4
app/(main)/(routes)/matches/(routes)/[matchId]/(components)/MatchPlayerInputModal/hooks.ts
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { useQueryControlledModal } from "@/components/Modal"; | ||
|
||
export const matchPlayerInputModalKey = "player-input"; | ||
|
||
export const useMatchPlayerInputModal = () => { | ||
return useQueryControlledModal("player-input"); | ||
return useQueryControlledModal(matchPlayerInputModalKey); | ||
}; |
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
24 changes: 0 additions & 24 deletions
24
...matches/(routes)/[matchId]/(components)/MatchTable/(components)/AddPlayerButton/index.tsx
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
.../(routes)/[matchId]/(components)/MatchTable/(components)/MatchPlayerInputButton/index.tsx
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,11 @@ | ||
"use client"; | ||
|
||
import { useMatchPlayerInputModal } from "../../../MatchPlayerInputModal/hooks"; | ||
|
||
export function MatchPlayerInputButton( | ||
props: React.ComponentPropsWithoutRef<"button">, | ||
) { | ||
const gameInputModal = useMatchPlayerInputModal(); | ||
|
||
return <button onClick={gameInputModal.onOpen} {...props}></button>; | ||
} |
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
93 changes: 93 additions & 0 deletions
93
app/(main)/(routes)/matches/(routes)/[matchId]/(components)/RuleModal/index.tsx
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,93 @@ | ||
"use client"; | ||
|
||
import { forwardRef } from "react"; | ||
import { | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
useQueryControlledModal, | ||
} from "@/components/Modal"; | ||
import { calcMethodLabel, chipRateLabel, rateLabel } from "@/lib/config"; | ||
import { Rule } from "@/lib/type"; | ||
|
||
export const useRuleModal = () => { | ||
return useQueryControlledModal("rule"); | ||
}; | ||
|
||
export function RuleModal({ rule }: { rule: Rule }) { | ||
const { isOpen, onClose } = useRuleModal(); | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<ModalContent> | ||
<ModalHeader>ルール</ModalHeader> | ||
<ModalBody> | ||
<table className="table-fixed border-separate border-spacing-y-1"> | ||
<tbody className="[&_td]:text-center"> | ||
<tr> | ||
<th>プレイ人数</th> | ||
<td>{rule.playersCount}人</td> | ||
</tr> | ||
<tr> | ||
<th>レート</th> | ||
<td>{rateLabel[rule.rate]}</td> | ||
</tr> | ||
<tr> | ||
<th>チップ</th> | ||
<td>{chipRateLabel[rule.chipRate]}</td> | ||
</tr> | ||
<tr> | ||
<th>ウマ</th> | ||
<td className="space-x-4"> | ||
<span>{rule.incline.incline1}</span> | ||
<span>{rule.incline.incline2}</span> | ||
<span>{rule.incline.incline3}</span> | ||
{rule.playersCount === 4 && ( | ||
<span>{rule.incline.incline4}</span> | ||
)} | ||
</td> | ||
</tr> | ||
<tr> | ||
<th>飛び賞</th> | ||
<td>{rule.crackBoxBonus}点</td> | ||
</tr> | ||
<tr> | ||
<th>持ち点</th> | ||
<td>{rule.defaultPoints}点</td> | ||
</tr> | ||
<tr> | ||
<th>オカ</th> | ||
<td>{rule.defaultCalcPoints}点</td> | ||
</tr> | ||
<tr> | ||
<th>計算</th> | ||
<td>{calcMethodLabel[rule.calcMethod]}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</ModalBody> | ||
{/* スペーサーとして */} | ||
<ModalFooter /> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
} | ||
|
||
export const RuleModalTrigger = forwardRef< | ||
HTMLButtonElement, | ||
React.ComponentPropsWithoutRef<"button"> | ||
>(function RuleModalTrigger({ onClick, ...props }, ref) { | ||
const ruleModal = useRuleModal(); | ||
return ( | ||
<button | ||
ref={ref} | ||
onClick={(e) => { | ||
ruleModal.onOpen(); | ||
onClick?.(e); | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}); |
Oops, something went wrong.