Skip to content

Commit

Permalink
Merge branch 'main' into aslobodian/incorrect-certificate-profile-for…
Browse files Browse the repository at this point in the history
…-code-signing
  • Loading branch information
aleksandr-slobodian committed Sep 2, 2024
2 parents 7989626 + 88938ac commit 6a8ac70
Show file tree
Hide file tree
Showing 9 changed files with 1,130 additions and 1,728 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@peculiar/fortify-tools",
"homepage": "https://tools.fortifyapp.com",
"version": "2.0.0",
"version": "2.0.1",
"author": "PeculiarVentures Team",
"license": "MIT",
"private": true,
Expand Down Expand Up @@ -72,4 +72,4 @@
"predeploy": "yarn build",
"deploy": "gh-pages -d dist"
}
}
}
7 changes: 6 additions & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function App() {
certificates,
handleCertificatesDataReload,
handleProviderChange,
handleRetryConection,
} = useApp();

const {
Expand Down Expand Up @@ -110,7 +111,11 @@ export function App() {
loading={!fetching.certificates || fetching.certificates === "pending"}
highlightedText={searchedText}
/>
<FetchingStatusOwerlay fetching={fetching} challenge={challenge} />
<FetchingStatusOwerlay
fetching={fetching}
challenge={challenge}
onReload={handleRetryConection}
/>
{certificateViewerDialog()}
{certificateDeleteDialog()}
{certificateImportDialog()}
Expand Down
19 changes: 10 additions & 9 deletions src/components/connection-not-approved/ConnectionNotApproved.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import FortifyIcon from "../../icons/fortify.svg?react";

import styles from "./styles/index.module.scss";

export const ConnectionNotApproved: React.FunctionComponent = () => {
interface ConnectionNotApprovedProps {
onReload: () => void;
}

export const ConnectionNotApproved: React.FunctionComponent<
ConnectionNotApprovedProps
> = (props) => {
const { onReload } = props;
const { t } = useTranslation();

return (
Expand All @@ -28,14 +35,8 @@ export const ConnectionNotApproved: React.FunctionComponent = () => {
{t("connection.error.connection-not-approved.description")}
</Typography>
<div className={styles.buttons_wrapper}>
<Button
variant="contained"
color="primary"
onClick={() => {
window.location.reload();
}}
>
{t("connection.error.connection-not-approved.button")}
<Button variant="contained" color="primary" onClick={onReload}>
{t("button.try-again")}
</Button>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion src/components/connection-not-detected/ConnectionNotDetected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import LaunchAppIcon from "../../icons/launch-app.svg?react";

import styles from "./styles/index.module.scss";

export const ConnectionNotDetected: React.FunctionComponent = () => {
interface ConnectionNotDetectedProps {
onReload: () => void;
}

export const ConnectionNotDetected: React.FunctionComponent<
ConnectionNotDetectedProps
> = (props) => {
const { onReload } = props;
const { t } = useTranslation();

return (
Expand All @@ -29,6 +36,9 @@ export const ConnectionNotDetected: React.FunctionComponent = () => {
>
{t("connection.error.connection-not-detect.button")}
</Button>
<Button variant="contained" color="primary" onClick={onReload}>
{t("button.try-again")}
</Button>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
padding-bottom: var(--pv-size-base-2);
}
.buttons_wrapper {
display: flex;
gap: var(--pv-size-base-2);
padding-top: var(--pv-size-base-2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import styles from "./styles/index.module.scss";
export interface FetchingStatusOwerlayProps {
fetching: AppFetchingType;
challenge: string | null;
onReload: () => void;
}
export const FetchingStatusOwerlay: React.FunctionComponent<
FetchingStatusOwerlayProps
> = (props) => {
const { fetching, challenge } = props;
const { fetching, challenge, onReload } = props;

const { t } = useTranslation();

function dialogAttrs() {
Expand All @@ -42,14 +44,14 @@ export const FetchingStatusOwerlay: React.FunctionComponent<
if (fetching.connectionDetect === "rejected") {
return {
isShow: true,
element: <ConnectionNotDetected />,
element: <ConnectionNotDetected onReload={onReload} />,
};
}

if (fetching.connectionApprove === "rejected") {
return {
isShow: true,
element: <ConnectionNotApproved />,
element: <ConnectionNotApproved onReload={onReload} />,
};
}

Expand Down
7 changes: 5 additions & 2 deletions src/hooks/app/useApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ export function useApp() {
try {
await fortifyClient.current.connect();
} catch (error) {
// console.error(error);

if (error && error instanceof Error) {
if (
error.message.indexOf("update your client to the latest version") !==
Expand Down Expand Up @@ -204,6 +202,10 @@ export function useApp() {
}
};

const handleRetryConection = () => {
window.location.reload();
};

return {
fortifyClient: fortifyClient.current,
fetching,
Expand All @@ -213,5 +215,6 @@ export function useApp() {
certificates,
handleCertificatesDataReload,
handleProviderChange,
handleRetryConection,
};
}
6 changes: 3 additions & 3 deletions src/i18n/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@
},
"connection-not-approved": {
"message": "You did not approve <0>{{name}}</0> use of Fortify",
"description": "If you want to try again click button below.",
"button": "Try again"
"description": "If you want to try again click button below."
},
"unresolved-status": {
"message": "Oops! Something went wrong.",
Expand All @@ -180,7 +179,8 @@
"button": {
"cancel": "Cancel",
"clear": "Clear",
"import-certificate": "Import certificate"
"import-certificate": "Import certificate",
"try-again": "Try again"
},
"app-error": {
"message": "Oops! Something went wrong.",
Expand Down
Loading

0 comments on commit 6a8ac70

Please sign in to comment.