Skip to content
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

PLT-7591: Improved Auditor Report Upload #19

Merged
merged 10 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Landing = lazy(() => import("../pages/landing"));
const Home = lazy(() => import("../pages/home"));
const Certification = lazy(() => import("../pages/certification/Certification"));
const TestingHistory = lazy(() => import("../pages/testingHistory"));
const ReportUpload = lazy(() => import("../pages/auditing/reportUpload/ReportUpload"))
const ReportUpload = lazy(() => import("../pages/reportUpload"))
const CertificationResult = lazy(() => import("../pages/certification/certification-result/CertificationResult"));

const ComingSoon = () => (
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from "react";

import { Box, Typography, Button, IconButton } from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import DeleteIcon from "@mui/icons-material/Delete";

import Input from "compositions/InputGroup/components/Input";
import Container from "compositions/InputGroup/components/Container";
import { getReportField } from "../utils";

import type { FormState, UseFormRegister, UseFormGetFieldState, FieldArrayWithId, UseFieldArrayAppend, UseFieldArrayRemove } from "react-hook-form";
import type { ReportForm } from "../interface";

import "../index.css";

interface Props {
formState: FormState<ReportForm>;
register: UseFormRegister<ReportForm>;
getFieldState: UseFormGetFieldState<ReportForm>;
reportFields: FieldArrayWithId<ReportForm, "report", "id">[];
appendReport: UseFieldArrayAppend<ReportForm, "report">;
removeReport: UseFieldArrayRemove;
standalone?: boolean;
}

const AuditReportForm = (props: Props) => {
return (
<Container standalone={props.standalone}>
<Box className="flex flex-row pt-4">
<Typography variant="subtitle1" className="text-main flex-1">
Audit Report
</Typography>
<Button
variant="outlined" size="small" className="button-outlined-main"
startIcon={<AddIcon />} onClick={() => props.appendReport({ value: '' })}
>
Add URL
</Button>
</Box>
{props.reportFields.map((field, index) => (
<Box key={field.id} className="flex flex-row mt-4">
<Input
noGutter={true}
field={getReportField(index)}
formState={props.formState}
register={props.register}
getFieldState={props.getFieldState}
/>
<Box className="ml-4 flex-0 pt-2">
<IconButton
color="error" className="border-solid border"
onClick={() => props.removeReport(index)}
disabled={index === 0}
>
<DeleteIcon />
</IconButton>
</Box>
</Box>
))}
</Container>
);
}

export default AuditReportForm;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";

import { Dialog, DialogTitle, DialogContent, DialogActions, Typography, CircularProgress, Button } from "@mui/material";

import "../index.css";

interface Props {
show: boolean;
loading: boolean;
success: boolean;
errorMessage: string|null;
onClose: () => void;
}

const FeedbackModal = (props: Props) => {
return (
<Dialog open={props.show} onClose={props.onClose}>
<DialogTitle>
{props.loading ? 'Submitting Auditor Report...' : null}
{props.success ? 'Successfully submitted Auditor Report' : null}
{props.errorMessage !== null ? 'Error submitting Auditor Report' : null}
</DialogTitle>
<DialogContent className="flex flex-col items-center">
{!props.loading ? (
<Typography>
{props.success ? 'Both off-chain and on-chain certificates will be downloaded at once now.' : null}
{props.errorMessage}
</Typography>
) : (
<CircularProgress color="secondary" size={50} />
)}
</DialogContent>
{!props.loading && (
<DialogActions>
<Button variant="contained" className="button-contained-main" onClick={props.onClose}>
Close
</Button>
</DialogActions>
)}
</Dialog>
);
}

export default FeedbackModal;
Loading