Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
robfrks committed Aug 8, 2024
1 parent c686fcf commit a7bb2c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/components/NavItems/tools/C2pa/Hooks/useGetC2paData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ const exifData = (assertions) => {
/**
*
* @param {Object} manifest the c2pa manifest to be read
* @param {string=} parent id of manifest parent if there is one
* @param {string=} parent id of manifest's parent if there is one
* @param {Object} result Object containing the data for the manifests that have already been read
* @param {*} url image corresponding with the manifest
* @param {*} depth nunber of ancestors of the manifest already read, used to avoid having a result object that is too large if a manifest has many descendants
* @returns
* @param {string} url image corresponding with the manifest
* @param {number} depth nunber of ancestors of the manifest already read, used to avoid having a result object that is too large if a manifest has many descendants
* @returns {Object} contains the id of the manifest that was just read, as well as the updated results
*/
async function readManifest(manifest, parent, result, url, depth) {
// the object that will contain
Expand Down Expand Up @@ -233,6 +233,10 @@ async function getC2paData(image, dispatch) {
let { id, data } = await readManifest(activeManifest, null, {}, url, 0);
data[id].validationIssues = validationIssues;
dispatch(c2paResultSet({ data: data, image: null }));

// each manifest has an id. The current image id determines which image's data is displayed
// and the main image id is used to return to the first image if a child image is being displayed

dispatch(c2paCurrentImageIdSet(id));
dispatch(c2paMainImageIdSet(id));
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/components/NavItems/tools/C2pa/Results/C2paResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ const C2paResults = (props = { result, handleClose }) => {
<Grid item xs>
<Card p={1}>
<CardContent>
{!data ? (
{!data || !manifestData ? (
<Box m={1}>
<Alert severity="info" m={1}>
{keyword("no_c2pa_info")}
</Alert>
<Box m={1} />
</Box>
) : (
<>
Expand Down

0 comments on commit a7bb2c8

Please sign in to comment.