Skip to content

Commit

Permalink
feat(ui): Clearing status UI Implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
soham4abc committed Sep 15, 2022
1 parent 615a373 commit 0e0d50e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
Binary file added src/assets/images/do-not-use.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/identified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/no-license.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/not-cleared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/to-be-discussed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion src/pages/BrowseUploads/LicenseBrowser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ import { getUploadSummary, getUploadLicense } from "services/upload";
// Helper function for error handling
import { handleError } from "shared/helper";

// Clearing status Assests
import DoNotUse from "../../../assets/images/do-not-use.png";
import Identified from "../../../assets/images/identified.png";
import NoLicense from "../../../assets/images/no-license.png";
import NotCleared from "../../../assets/images/not-cleared.png";
import ToBeDiscussed from "../../../assets/images/to-be-discussed.png";

const LicenseBrowser = () => {
// Setting the upload Id
const [uploadId, setuploadId] = useState();
Expand Down Expand Up @@ -86,6 +93,17 @@ const LicenseBrowser = () => {
}
}, [uploadId]);

function getClearingImage(status, scanner) {
if (scanner[0] === "No_license_found") return NoLicense;
if (status === "DO_NOT_USE") return DoNotUse;
if (status === "IRRELEVANT") return Identified;
if (status === "IDENTIFIED") return Identified;
if (status === "NON_FUNCTIONAL") return DoNotUse;
if (status === "not_found") return NotCleared;
if (status === "TO_BE_DISCUSSED") return ToBeDiscussed;
return NoLicense;
}

return (
<>
<Title title="License Browser" />
Expand Down Expand Up @@ -149,7 +167,19 @@ const LicenseBrowser = () => {
})
: null}
</td>
<td>-</td>
<td>
{data.clearing_status !== null &&
filteredScanner !== null ? (
<img
src={getClearingImage(
data.clearing_status,
filteredScanner
)}
alt="clearing-img"
className="rounded mx-auto d-block"
/>
) : null}
</td>
<td>-</td>
<td>-</td>
</tr>
Expand Down

0 comments on commit 0e0d50e

Please sign in to comment.