Skip to content

Commit

Permalink
fixed open bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterK0927 committed Aug 12, 2024
1 parent f995a6f commit 686d7e8
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ export const StyledNavBar = styled('nav')`
font-weight: 400;
line-height: normal;
margin-right: 12px;
margin-left: 20px
cursor: pointer;
margin-left: 20px;
`;

export const StyledHelpButton = styled('button')`
Expand All @@ -214,6 +215,7 @@ export const StyledNavBar = styled('nav')`
border: 2px solid #FFF;
border-radius: 20px;
background: transparent;
cursor: pointer;
`;

export const StyledHelpButtonContainer = styled.div`
Expand Down Expand Up @@ -247,22 +249,6 @@ export const StyledNavBar = styled('nav')`

export const StyledNotVerified = styled('span')`
color: red;
&::after {
display: flex;
position: absolute;
content: "i";
text-align: center;
font-size: 6px;
padding: 1px 0px 3px 4px;
width: 12px;
color: #ff7e00d4;
height: 12px;
border-radius: 10px;
border: 1px solid #ff5b00b3;
right: 8px;
top: 12px;
}
`;

export const StyledInstructionText = styled('p')`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ export const SignatureMethodPopup: React.FC<SignatureMethodPopupProps> = ({ onCl
<StyledPopupOverlay>
<StyledPopupContent>
<StyledPopupContentH2>Choose Your Digital Signature Method</StyledPopupContentH2>
<StyledCloseButton onClick={onClose}>X</StyledCloseButton>
<StyledCloseButton onClick={onClose}>x</StyledCloseButton>
<StyledMethodOptions>
<StyledMethodOptionsButton onClick={() => onSelectMethod('digitalID')}>
<StyledButtonTitle>Sign with digital ID (Recommended)</StyledButtonTitle>
<StyledButtonDesc>Sign documents quickly using your pre-uploaded signature data for a seamless and efficient signing process</StyledButtonDesc>
</StyledMethodOptionsButton>
<StyledMethodOptionsButton onClick={() => onSelectMethod('imageUpload')}>
{/* <StyledMethodOptionsButton onClick={() => onSelectMethod('imageUpload')}>
<StyledButtonTitle>Upload Image Signature</StyledButtonTitle>
<StyledButtonDesc>Select and upload an image of your signature from your device to sign documents easily and securely.</StyledButtonDesc>
</StyledMethodOptionsButton>
</StyledMethodOptionsButton> */}
</StyledMethodOptions>
</StyledPopupContent>
</StyledPopupOverlay>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
display: flex;
flex-direction: column;
gap: 10px;
height: ${p => p.selected ? '656px' : '390px'};
min-height: 268px;
max-height: ${p => p.selected ? '656px' : '390px'};
border: 1px solid #CACACA;
background: #323639;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
StyledSelectedSignature,
StyledSelectedSignatureH3,
StyledSelectedSignatureP,
StyledBrowseImage,
StyledSignatureList,
StyledSignatureOption,
StyledSignatureOptionInput,
Expand Down Expand Up @@ -66,7 +65,7 @@ export const SignaturePopup: React.FC<SignaturePopupProps> = ({ onClose, onConfi
<StyledPopupOverlay>
<StyledPopupContent selected={!!selectedSignature}>
<StyledPopupContentH2>Choose a digital ID to sign with:</StyledPopupContentH2>
<StyledCloseButton onClick={onClose}>×</StyledCloseButton>
<StyledCloseButton onClick={onClose}>x</StyledCloseButton>

{signatures.length === 0 ? (
<StyledSignatureList>
Expand All @@ -85,7 +84,6 @@ export const SignaturePopup: React.FC<SignaturePopupProps> = ({ onClose, onConfi
<StyledSelectedSignature>
<StyledSelectedSignatureH3>{selectedSignature.name}</StyledSelectedSignatureH3>
<StyledSelectedSignatureP>Valid until: {selectedSignature.expiry.toLocaleString()}</StyledSelectedSignatureP>
<StyledBrowseImage>View Certificate Details</StyledBrowseImage>
</StyledSelectedSignature>
)}
<StyledSignatureList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
display: flex;
flex-direction: column;
gap: 10px;
height: ${p => p.selected ? '656px' : '390px'};
height: ${p => p.selected ? 'fit-content' : 'fit-content'};
border: 1px solid #CACACA;
background: #323639;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SignatureTypePopup: React.FC<SignatureTypePopupProps> = ({ onClose,
<StyledPopupOverlay>
<StyledPopupTypeContent>
<StyledPopupContentH2>Choose a digital ID to sign with:</StyledPopupContentH2>
<StyledCloseButton onClick={onClose}>×</StyledCloseButton>
<StyledCloseButton onClick={onClose}>x</StyledCloseButton>
<StyledTypedSignature>
<StyledH3>{signatureName}</StyledH3>
</StyledTypedSignature>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
import * as React from 'react';
import * as S from './styles';
import loading from '../../../assets/loader.png'

const Loader = () => (
<S.LoaderContainer>
<img src={loading} alt="Loading..." />
</S.LoaderContainer>
);

export default Loader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
import styled from 'styled-components';

export const LoaderContainer = styled.div`
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
`;

export const LoadingOverlay = styled.div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 9998;
display: flex;
justify-content: center;
align-items: center;
`;

export const LoadingSpinner = styled.div`
border: 4px solid rgba(0, 0, 0, 0.1);
border-left-color: #000;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
@keyframes spin {
to {
transform: rotate(360deg);
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
StyledSuccessPopup,
StyledSuccessTitle,
StyledSuccessMessage,
StyledSuccessName,
StyledSuccessButtons,
StyledConfirmButton
} from './styles';
Expand All @@ -18,7 +17,6 @@ export const SuccessPopup: React.FC<SuccessPopupProps> = ({ message, onSave, onC
Signature complete!
</StyledSuccessTitle>
<StyledSuccessMessage>{message}</StyledSuccessMessage>
<StyledSuccessName>Placeholder</StyledSuccessName>
<StyledSuccessButtons>
<StyledConfirmButton onClick={onSave}>Save as</StyledConfirmButton>
<StyledConfirmButton onClick={onContinue} $continue>Continue</StyledConfirmButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
display: flex;
flex-direction: column;
gap: 10px;
height: 350px;
height: fit-content;
border: 1px solid #CACACA;
transition: height 0.3s ease;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
import * as React from 'react';
import { TooltipContainer, StyledTooltip } from './styles';

interface TooltipProps {
text: string;
isVisible: boolean;
isError?: boolean;
children: React.ReactNode;
}

export const Tooltip: React.FC<TooltipProps> = ({ text, isVisible, isError, children }) => (
<TooltipContainer>
{children}
{isVisible && <StyledTooltip isError={isError}>{text}</StyledTooltip>}
</TooltipContainer>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
import styled from 'styled-components';

export const TooltipContainer = styled.div`
position: relative;
display: inline-block;
`;

export const StyledTooltip = styled.div<{ isError?: boolean }>`
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
background-color: ${({ isError }) => (isError ? '#e74c3c' : '#333')};
color: #fff;
padding: 5px;
border-radius: 3px;
white-space: nowrap;
z-index: 1000;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
margin-top: 8px;
opacity: 0.9;
&::after {
content: '';
position: absolute;
top: -5px;
left: 50%;
transform: translateX(-50%);
border-width: 5px;
border-style: solid;
border-color: transparent transparent ${({ isError }) => (isError ? '#e74c3c' : '#333')} transparent;
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
export enum ErrorType {
PDF_LOADING_ERROR = 'PDF_LOADING_ERROR',
INVALID_FILE_TYPE = 'INVALID_FILE_TYPE',
SIGNING_ERROR = 'SIGNING_ERROR',
VERIFICATION_ERROR = 'VERIFICATION_ERROR',
INVALID_PIN = 'INVALID_PIN',
INVALID_SELECTION = 'INVALID_SELECTION',
NO_PDF_UPLOADED = 'NO_PDF_UPLOADED',
NETWORK_ERROR = 'NETWORK_CONNECTION_IS_BAD'
}

export enum SuccessPopupErrorType {
SAVE_FAILED = 'SAVE_FAILED',
CONTINUE_FAILED = 'CONTINUE_FAILED',
MESSAGE_MISSING = 'MESSAGE_MISSING',
INVALID_CALLBACK = 'INVALID_CALLBACK'
}

export enum DropZoneErrorType {
FILE_TOO_LARGE = "FILE_TOO_LARGE",
INVALID_FILE_TYPE = "INVALID_FILE_TYPE",
FILE_READ_ERROR = "FILE_READ_ERROR",
DROP_ZONE_UNAVAILABLE = "DROP_ZONE_UNAVAILABLE",
UPLOAD_FAILED = "UPLOAD_FAILED",
MULTIPLE_FILES_SELECTED = "MULTIPLE_FILES_SELECTED",
NO_FILE_SELECTED = "NO_FILE_SELECTED",
BROWSER_NOT_SUPPORTED = "BROWSER_NOT_SUPPORTED",
NETWORK_ERROR = "NETWORK_ERROR",
UNKNOWN_ERROR = "UNKNOWN_ERROR"
}

export enum ErrorStates {
None = "None",
VerificationFailed = "VerificationFailed",
SignatureAdditionFailed = "SignatureAdditionFailed",
FileUploadFailed = "FileUploadFailed",
PageNumberError = "PageNumberError",
GeneralError = "GeneralError"
}

export enum PdfSignerErrorStates {
MODULE_NOT_FOUND = 'MODULE_NOT_FOUND',
SLOT_NOT_FOUND = 'SLOT_NOT_FOUND',
LOGIN_FAILED = 'LOGIN_FAILED',
SIGNING_FAILURE = 'SIGNING_FAILURE',
NO_OBJS_FOUND = 'NO_OBJS_FOUND',
GETTING_CERT = 'GETTING_CERT'
}

export enum pdfVerifyErrorStates {
BYTE_RANGE_NOT_FOUND = 'BYTE_RANGE_NOT_FOUND',
INVALID_AUTHENTICATED_ATTRIBUTES = 'INVALID_AUTHENTICATED_ATTRIBUTES',
INVALID_CONTENT_DIGEST = 'INVALID_CONTENT_DIGEST'
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
export type DropZoneProps = {
onFileInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
isDragging: boolean;

handleDrop: (event: React.DragEvent<HTMLDivElement>) => void;
setIsDragging: React.Dispatch<React.SetStateAction<boolean>>;
}

export type HeaderProps = {
Expand Down Expand Up @@ -92,4 +93,11 @@ export type PdfPageProps = {
pdfCanvasRef: React.Ref<HTMLCanvasElement>;
overlayCanvasRef: React.Ref<HTMLCanvasElement>;
pageRef: React.Ref<HTMLDivElement>;
}

export type TooltipProps = {
text: string;
isVisible: boolean;
isVerificationFailed: boolean;
children: React.ReactNode;
}

0 comments on commit 686d7e8

Please sign in to comment.