generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create split board screen - board name input and tip bar (#139)
- Loading branch information
1 parent
b16f4fd
commit a1db025
Showing
13 changed files
with
370 additions
and
24 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,26 @@ | ||
import React from "react"; | ||
import Input from "../../Primitives/Input"; | ||
import Text from "../../Primitives/Text"; | ||
|
||
const BoardName = (props: { mainBoardName: string }) => { | ||
const { mainBoardName } = props; | ||
return ( | ||
<> | ||
<Text heading="3">Main Board Name</Text> | ||
<Text css={{ mt: "$8", mb: "$16", color: "$primary500" }}> | ||
The main board is the board into which all sub-team boards will be merged. | ||
</Text> | ||
<Input | ||
state="default" | ||
id="text" | ||
type="text" | ||
placeholder="Main board name" | ||
forceState | ||
currentValue={mainBoardName} | ||
maxChars="30" | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default BoardName; |
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,73 @@ | ||
import { zodResolver } from "@hookform/resolvers/zod"; | ||
import { useForm, FormProvider, useWatch } from "react-hook-form"; | ||
import { SetterOrUpdater, useRecoilValue } from "recoil"; | ||
import ClickEvent from "../../../types/events/clickEvent"; | ||
import Flex from "../../Primitives/Flex"; | ||
import { styled } from "../../../stitches.config"; | ||
import SchemaCreateBoard from "../../../schema/schemaCreateBoardForm"; | ||
import Button from "../../Primitives/Button"; | ||
import BoardName from "./BoardName"; | ||
import { createBoardDataState } from "../../../store/createBoard/atoms/create-board.atom"; | ||
|
||
const StyledForm = styled("form", Flex, {}); | ||
|
||
const CreateBoardContent: React.FC<{ setOpened: SetterOrUpdater<boolean> }> = ({ setOpened }) => { | ||
const { | ||
board: { maxVotes }, | ||
} = useRecoilValue(createBoardDataState); | ||
|
||
const methods = useForm<{ text: string; maxVotes: string }>({ | ||
mode: "onBlur", | ||
reValidateMode: "onBlur", | ||
defaultValues: { | ||
text: "Main board -", | ||
maxVotes: maxVotes ?? "", | ||
}, | ||
resolver: zodResolver(SchemaCreateBoard), | ||
}); | ||
|
||
const mainBoardName = useWatch({ | ||
control: methods.control, | ||
name: "text", | ||
}); | ||
|
||
const handleOnClickSaveBoard = (e: ClickEvent<HTMLButtonElement, MouseEvent>) => { | ||
e?.preventDefault(); | ||
setOpened(false); | ||
}; | ||
|
||
return ( | ||
<StyledForm | ||
direction="column" | ||
css={{ width: "100%", height: "100%", backgroundColor: "$background" }} | ||
onSubmit={methods.handleSubmit(() => { | ||
// saveBoard(text, maxVotes); | ||
})} | ||
> | ||
<Flex | ||
direction="column" | ||
css={{ | ||
width: "100%", | ||
height: "100%", | ||
pt: "$64", | ||
pl: "$152", | ||
pr: "$92", | ||
overflow: "auto", | ||
}} | ||
> | ||
<FormProvider {...methods}> | ||
<BoardName mainBoardName={mainBoardName} /> | ||
{/* <Settings /> */} | ||
</FormProvider> | ||
</Flex> | ||
<Flex justify="end" gap="24" css={{ backgroundColor: "white", py: "$16", pr: "$32" }}> | ||
<Button variant="lightOutline" onClick={handleOnClickSaveBoard}> | ||
Cancel | ||
</Button> | ||
<Button type="submit">Create board</Button> | ||
</Flex> | ||
</StyledForm> | ||
); | ||
}; | ||
|
||
export default CreateBoardContent; |
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,46 @@ | ||
import { useSetRecoilState } from "recoil"; | ||
import { styled } from "../../stitches.config"; | ||
import { createBoardState } from "../../store/createBoard/atoms/create-board.atom"; | ||
import CrossIcon from "../icons/CrossIcon"; | ||
import Button from "../Primitives/Button"; | ||
import Flex from "../Primitives/Flex"; | ||
import Separator from "../Primitives/Separator"; | ||
import Text from "../Primitives/Text"; | ||
import CreateBoardContent from "./Content/Content"; | ||
import CreateBoardTipBar from "./TipBar"; | ||
|
||
const MainContainter = styled(Flex, { | ||
backgroundColor: "white", | ||
width: "100%", | ||
maxHeight: "100vh", | ||
}); | ||
|
||
const CreateBoard: React.FC = () => { | ||
const setCreateBoardState = useSetRecoilState(createBoardState); | ||
|
||
return ( | ||
<MainContainter direction="column"> | ||
<Flex | ||
justify="between" | ||
align="center" | ||
css={{ px: "$40", py: "$32", backgroundColor: "white", width: "100%", maxHeight: "$92" }} | ||
> | ||
<Text heading="3">Add new SPLIT board</Text> | ||
<Button | ||
css={{ "& svg": { size: "$40 !important", color: "$primary800" } }} | ||
isIcon | ||
onClick={() => setCreateBoardState(false)} | ||
> | ||
<CrossIcon size="24" /> | ||
</Button> | ||
</Flex> | ||
<Separator orientation="horizontal" css={{ backgroundColor: "$primary100" }} /> | ||
<Flex justify="between" css={{ overflow: "hidden", height: "100%" }}> | ||
<CreateBoardContent setOpened={setCreateBoardState} /> | ||
<CreateBoardTipBar /> | ||
</Flex> | ||
</MainContainter> | ||
); | ||
}; | ||
|
||
export default CreateBoard; |
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,50 @@ | ||
import LampIcon from "../icons/LampIcon"; | ||
import Flex from "../Primitives/Flex"; | ||
import { styled } from "../../stitches.config"; | ||
import Text from "../Primitives/Text"; | ||
|
||
const TextWhite = styled(Text, { color: "white", mt: "$24" }); | ||
const LiWhite = styled("li", Text, { color: "$primary100", fontSize: "$14", lineHeight: "$20" }); | ||
const UnorderedList = styled("ul", { paddingInlineStart: "$26" }); | ||
|
||
const CreateBoardTipBar: React.FC = () => { | ||
return ( | ||
<Flex | ||
direction="column" | ||
css={{ | ||
backgroundColor: "$primary800", | ||
pt: "9.37%", | ||
pl: "$32", | ||
pr: "$36", | ||
maxWidth: "$384", | ||
}} | ||
> | ||
<LampIcon /> | ||
<TextWhite heading="6">Sub-teams</TextWhite> | ||
<UnorderedList> | ||
<LiWhite>The participants of the sub-teams are generated randomly.</LiWhite> | ||
|
||
<LiWhite>The number of participants is splitted equally between all sub-teams.</LiWhite> | ||
|
||
<LiWhite>For each sub-team there is one responsible selected.</LiWhite> | ||
</UnorderedList> | ||
<TextWhite heading="6">Responsibles</TextWhite> | ||
<UnorderedList> | ||
<LiWhite> | ||
Responsibles are normal users with the rights to merge the cards at the end of each | ||
sub-teams retro into the main board. | ||
</LiWhite> | ||
|
||
<LiWhite> | ||
Responsibles also are in charge of scheduling and conducting the sub-teams retrospective. | ||
</LiWhite> | ||
</UnorderedList> | ||
<TextWhite heading="6" css={{ mb: "$8" }}> | ||
Stakeholder | ||
</TextWhite> | ||
<LiWhite as="span">The stakeholder will not be assigned to any sub-team.</LiWhite> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default CreateBoardTipBar; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const LampIcon: React.FC = () => { | ||
return ( | ||
<svg width="47" height="48" viewBox="0 0 47 48" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M9.54931 45.412C21.1736 52.1454 37.9024 44.9674 43.4931 32.7831C49.0839 20.5988 46.2516 11.402 34.6273 4.66855C23.003 -2.06492 9.30592 -2.44303 3.71517 9.74129C-1.87559 21.9256 -2.07495 38.6785 9.54931 45.412Z" | ||
fill="#73FBF7" | ||
/> | ||
<path | ||
d="M22.5773 17.0958C20.2508 17.0958 18.3585 18.9881 18.3585 21.3146C18.3585 21.7031 18.6731 22.0177 19.0616 22.0177C19.4501 22.0177 19.7647 21.7031 19.7647 21.3146C19.7647 19.7633 21.0269 18.502 22.5773 18.502C22.9658 18.502 23.2804 18.1874 23.2804 17.7989C23.2804 17.4104 22.9658 17.0958 22.5773 17.0958ZM19.0642 33.7588C19.0642 33.8973 19.1051 34.0322 19.182 34.1473L20.2591 35.7663C20.3897 35.9623 20.6094 36.0801 20.8445 36.0801H24.3097C24.5452 36.0801 24.7649 35.9623 24.895 35.7663L25.9721 34.1473C26.0486 34.0322 26.0895 33.8968 26.0899 33.7588L26.0921 31.8612H19.0625L19.0642 33.7588ZM22.5773 13.5801C18.0825 13.5801 14.8428 17.2263 14.8428 21.3146C14.8428 23.2645 15.5657 25.0434 16.7571 26.4027C17.4883 27.2372 18.6353 28.9867 19.0607 30.4528V30.4554H21.1701V30.4501C21.1697 30.2405 21.1385 30.0322 21.0757 29.8318C20.83 29.0491 20.0728 26.9854 18.3435 25.0122C17.4409 23.9826 16.9583 22.6765 16.9544 21.3146C16.9456 18.0784 19.5767 15.6895 22.5773 15.6895C25.679 15.6895 28.2024 18.2129 28.2024 21.3146C28.2024 22.6756 27.7085 23.9887 26.8115 25.0122C25.0928 26.9727 24.3321 29.032 24.0825 29.8226C24.018 30.0259 23.9851 30.2378 23.9849 30.451V30.4554H26.0943V30.4532C26.5197 28.9867 27.6667 27.2372 28.398 26.4031C29.5889 25.0434 30.3118 23.2645 30.3118 21.3146C30.3118 17.043 26.8489 13.5801 22.5773 13.5801Z" | ||
fill="#060D16" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default LampIcon; |
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,7 +1,8 @@ | ||
import * as z from "zod"; | ||
|
||
const SchemaCreateBoard = z.object({ | ||
title: z.string().max(15, "Maximum of 15 characters").nonempty("Please enter a title."), | ||
text: z.string().nonempty("Please enter the board name.").max(30, "Maximum of 30 characters"), | ||
maxVotes: z.string().min(1, "Please set the maximum number of votes.").optional(), | ||
}); | ||
|
||
export default SchemaCreateBoard; |
Oops, something went wrong.