forked from brave/brave-core
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f995a6f
commit 686d7e8
Showing
14 changed files
with
190 additions
and
30 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
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
14 changes: 14 additions & 0 deletions
14
...nts/brave_rewards/resources/page/ping_doc_signer/components/SignerLoader/SignerLoader.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,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; |
43 changes: 43 additions & 0 deletions
43
components/brave_rewards/resources/page/ping_doc_signer/components/SignerLoader/styles.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 |
---|---|---|
@@ -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); | ||
} | ||
} | ||
`; |
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
19 changes: 19 additions & 0 deletions
19
components/brave_rewards/resources/page/ping_doc_signer/components/ToolTip/ToolTip.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,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> | ||
); |
36 changes: 36 additions & 0 deletions
36
components/brave_rewards/resources/page/ping_doc_signer/components/ToolTip/styles.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 |
---|---|---|
@@ -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; | ||
} | ||
`; |
57 changes: 57 additions & 0 deletions
57
components/brave_rewards/resources/page/ping_doc_signer/utils/errorTypes.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 |
---|---|---|
@@ -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' | ||
} |
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