-
Notifications
You must be signed in to change notification settings - Fork 0
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
213 feature UI changes for logon onboarding and create/upload signature #219
Merged
kaiyangzheng
merged 5 commits into
main
from
213-feature-ui-changes-for-logon-onboarding
Dec 1, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,8 @@ | ||
/* | ||
Warnings: | ||
|
||
- Added the required column `signatureLink` to the `Employee` table without a default value. This is not possible if the table is not empty. | ||
|
||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Employee" ADD COLUMN "signatureLink" VARCHAR(255) NOT NULL; |
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ const DIGITAL_MFA_ID_BADGE_REQUEST_UUID = uuidv4(); | |
const TRAVEL_AUTHORIZATION_UUID = uuidv4(); | ||
|
||
const DEV_FORM_DOC_LINK = 'http://localhost:3002/test.pdf'; | ||
const DEV_SIGNATURE_LINK = 'http://localhost:3002/signature.png'; | ||
|
||
// type definition for employee data used in upsertEmployee | ||
type EmployeeData = { | ||
|
@@ -47,6 +48,7 @@ type EmployeeData = { | |
lastName: string; | ||
email: string; | ||
positionId: string; | ||
signatureLink: string; | ||
}; | ||
|
||
// update or insert employee to database based on the employee id | ||
|
@@ -59,6 +61,7 @@ async function upsertEmployee(empData: EmployeeData) { | |
firstName: empData.firstName, | ||
lastName: empData.lastName, | ||
email: empData.email, | ||
signatureLink: empData.signatureLink, | ||
position: { | ||
connect: { id: empData.positionId }, | ||
}, | ||
|
@@ -383,27 +386,31 @@ async function main() { | |
lastName: 'Zhang', | ||
email: '[email protected]', | ||
positionId: CHIEF_OF_STAFF_UUID, | ||
signatureLink: DEV_SIGNATURE_LINK, | ||
}, | ||
{ | ||
id: KAI_ZHENG_UUID, | ||
firstName: 'Kai', | ||
lastName: 'Zheng', | ||
email: '[email protected]', | ||
positionId: CHIEF_FIN_OFFICER_UUID, | ||
signatureLink: DEV_SIGNATURE_LINK, | ||
}, | ||
{ | ||
id: ANGELA_WEIGL_UUID, | ||
firstName: 'Angela', | ||
lastName: 'Weigl', | ||
email: '[email protected]', | ||
positionId: AGG_DIR_UUID, | ||
signatureLink: DEV_SIGNATURE_LINK, | ||
}, | ||
{ | ||
id: ANSHUL_SHIRUDE_UUID, | ||
firstName: 'Anshul', | ||
lastName: 'Shirude', | ||
email: '[email protected]', | ||
positionId: CHIEF_LEARNING_ENGAGEMENT_UUID, | ||
signatureLink: DEV_SIGNATURE_LINK, | ||
}, | ||
]; | ||
|
||
|
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
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
Binary file not shown.
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 |
---|---|---|
|
@@ -9,5 +9,6 @@ export type CreateEmployeeDto = { | |
positionId: string; | ||
email: string; | ||
password: string; | ||
signatureLink: string; | ||
}; | ||
|
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,63 @@ | ||
import { Box } from '@chakra-ui/react'; | ||
|
||
export const ButtonSwitch = ({ | ||
isToggleLeft, | ||
onClickLeft, | ||
onClickRight, | ||
activeColor, | ||
leftLabel, | ||
rightLabel, | ||
}: { | ||
isToggleLeft: boolean; | ||
onClickLeft: () => void; | ||
onClickRight: () => void; | ||
activeColor: string; | ||
leftLabel: string; | ||
rightLabel: string; | ||
}) => { | ||
const Button = ({ | ||
label, | ||
side, | ||
isActive, | ||
onToggle, | ||
}: { | ||
label: string; | ||
side: 'left' | 'right'; | ||
isActive: boolean; | ||
onToggle: () => void; | ||
}) => { | ||
return ( | ||
<Box | ||
as="button" | ||
flex="1" | ||
borderWidth="1px" | ||
borderRadius={side === 'left' ? '4px 0 0 4px' : '0 4px 4px 0'} | ||
padding="6px 12px" | ||
fontWeight="500" | ||
fontSize="15px" | ||
borderColor={isActive ? activeColor : '#C0C0C0'} | ||
color={isActive ? activeColor : '#63646B'} | ||
onClick={onToggle} | ||
> | ||
{label} | ||
</Box> | ||
); | ||
}; | ||
|
||
return ( | ||
<Box display="inline-flex"> | ||
<Button | ||
label={leftLabel} | ||
isActive={isToggleLeft} | ||
side="left" | ||
onToggle={onClickLeft} | ||
/> | ||
<Button | ||
label={rightLabel} | ||
isActive={!isToggleLeft} | ||
side="right" | ||
onToggle={onClickRight} | ||
/> | ||
</Box> | ||
); | ||
}; |
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,98 @@ | ||
import { Box, Flex, Input, Link } from '@chakra-ui/react'; | ||
import { useRef } from 'react'; | ||
import SignatureCanvas from 'react-signature-canvas'; | ||
import { ButtonSwitch } from '@web/components/ButtonSwitch'; | ||
|
||
interface SignaturePadProps { | ||
createSignatureType: string; | ||
setCreateSignatureType: (type: string) => void; | ||
signature: string; | ||
setSignature: (signature: string) => void; | ||
signatureCanvas: React.RefObject<SignatureCanvas>; | ||
onClear?: () => void; | ||
} | ||
|
||
export const SignaturePad = ({ | ||
createSignatureType, | ||
setCreateSignatureType, | ||
signature, | ||
setSignature, | ||
signatureCanvas, | ||
onClear, | ||
}: SignaturePadProps) => { | ||
const clearSignature = () => { | ||
if (signatureCanvas.current) { | ||
signatureCanvas.current.clear(); | ||
} | ||
setSignature(''); | ||
onClear?.(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Box width="100%" display="flex" flexDirection="column"> | ||
<label htmlFor="signature">Create Signature</label> | ||
<Flex marginTop="8px" display="flex" justifyContent={'space-between'}> | ||
<Flex flex="1" flexDirection="column"> | ||
<ButtonSwitch | ||
isToggleLeft={createSignatureType === 'draw'} | ||
onClickLeft={() => setCreateSignatureType('draw')} | ||
onClickRight={() => setCreateSignatureType('type')} | ||
activeColor="#1367EA" | ||
leftLabel="Draw" | ||
rightLabel="Type" | ||
/> | ||
</Flex> | ||
<Flex flex="1" justifyContent="flex-end" alignItems="flex-end"> | ||
<Link | ||
as="button" | ||
color="#1367EA" | ||
fontSize="14px" | ||
onClick={clearSignature} | ||
> | ||
Clear | ||
</Link> | ||
</Flex> | ||
</Flex> | ||
<Box | ||
borderRadius="6px" | ||
border="1px solid #C0C0C0" | ||
marginTop="8px" | ||
position="relative" | ||
> | ||
{createSignatureType === 'draw' ? ( | ||
<> | ||
<SignatureCanvas | ||
penColor="black" | ||
canvasProps={{ | ||
width: 500, | ||
height: 120, | ||
}} | ||
ref={signatureCanvas} | ||
/> | ||
<Box | ||
position="absolute" | ||
bottom="16px" | ||
width="90%" | ||
height="1px" | ||
bg="#7C7F86" | ||
left="50%" | ||
transform="translateX(-50%)" | ||
/> | ||
</> | ||
) : ( | ||
<Input | ||
type="text" | ||
placeholder="Type your signature here" | ||
padding="8px" | ||
borderRadius="6px" | ||
border="1px solid #C0C0C0" | ||
onChange={(e) => setSignature(e.target.value)} | ||
value={signature} | ||
/> | ||
)} | ||
</Box> | ||
</Box> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these colors be constants stored somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea lets make a ticket for this next sem so we can standardize it for all components