Raid Instance Creator working
This commit is contained in:
51
src/ui/raidInstance/creator/RaidInstanceCreatorTable.tsx
Normal file
51
src/ui/raidInstance/creator/RaidInstanceCreatorTable.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import PrimaryButton from "@/components/button/PrimaryButton";
|
||||
import { RaidInstance } from "@/interface/RaidInstance";
|
||||
import { useRaidInstanceContext } from "@/providers/RaidInstanceLayoutProvider";
|
||||
import RaidInstanceCreatorTableBody from "./RaidInstanceCreatorTableBody";
|
||||
import RaidInstanceCreatorTableHeader from "./RaidInstanceCreatorTableHeader";
|
||||
|
||||
|
||||
export default function RaidInstanceCreatorTable({
|
||||
onClickHeaderCell,
|
||||
onClickBodyCell
|
||||
}:{
|
||||
onClickHeaderCell: (col: number) => void;
|
||||
onClickBodyCell: (row: number, col: number) => void;
|
||||
}){
|
||||
const { raidInstance, setRaidInstance } = useRaidInstanceContext();
|
||||
|
||||
|
||||
const addRun = () => {
|
||||
const newRaidInstance = {...raidInstance};
|
||||
newRaidInstance.numberRuns = (newRaidInstance.numberRuns ?? 0) + 1;
|
||||
setRaidInstance(newRaidInstance as RaidInstance);
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<div
|
||||
className="flex flex-col items-center justify-center"
|
||||
>
|
||||
<div
|
||||
className="flex flex-col items-start justify-start max-w-full overflow-auto pb-16"
|
||||
>
|
||||
<table>
|
||||
{/* Header */}
|
||||
<RaidInstanceCreatorTableHeader
|
||||
onClickHeaderCell={onClickHeaderCell}
|
||||
/>
|
||||
{/* Body */}
|
||||
<RaidInstanceCreatorTableBody
|
||||
onClickBodyCell={onClickBodyCell}
|
||||
/>
|
||||
</table>
|
||||
</div>
|
||||
{/* Buttons */}
|
||||
<PrimaryButton
|
||||
onClick={addRun}
|
||||
>
|
||||
Add Run
|
||||
</PrimaryButton>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user