diff --git a/components/job-documents/job-documents.component.jsx b/components/job-documents/job-documents.component.jsx index c4a2ac6..9e7dae5 100644 --- a/components/job-documents/job-documents.component.jsx +++ b/components/job-documents/job-documents.component.jsx @@ -23,9 +23,7 @@ export default function JobDocumentsComponent({ job, loading, refetch }) { job.documents.map((doc) => { return { source: { - uri: `${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType( - doc.type - )}/upload/${doc.key}`, + uri: GenerateSrcUrl(doc), }, }; }), @@ -62,11 +60,7 @@ export default function JobDocumentsComponent({ job, loading, refetch }) { source={{ width: 100, height: 100, - uri: `${ - env.REACT_APP_CLOUDINARY_ENDPOINT - }/${DetermineFileType(object.item.type)}/upload/${ - env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS - }/${object.item.key}`, + uri: GenerateThumbUrl(object.item), }} /> @@ -84,3 +78,17 @@ export default function JobDocumentsComponent({ job, loading, refetch }) { ); } + +export const GenerateSrcUrl = (value) => { + let extension = value.extension; + if (extension && extension.includes("heic")) extension = "jpg"; + + return `${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType( + value.type + )}/upload/${value.key}${extension ? `.${extension}` : ""}`; +}; + +export const GenerateThumbUrl = (value) => + `${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType( + value.type + )}/upload/${env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS}/${value.key}`; diff --git a/components/job-lines/job-lines.component.jsx b/components/job-lines/job-lines.component.jsx index 66b6655..05240b4 100644 --- a/components/job-lines/job-lines.component.jsx +++ b/components/job-lines/job-lines.component.jsx @@ -34,9 +34,6 @@ export default function JobLines({ job, loading, refetch }) { {t("jobdetail.labels.lines_qty")} - - {t("jobdetail.labels.lines_price")} - diff --git a/components/upload-progress/upload-progress.component.jsx b/components/upload-progress/upload-progress.component.jsx index 9be2d2f..5123392 100644 --- a/components/upload-progress/upload-progress.component.jsx +++ b/components/upload-progress/upload-progress.component.jsx @@ -204,7 +204,7 @@ export function UploadProgress({ forceRerender(); }; - console.log("speed", progress.speed, progress.speed !== 0); + return ( { + cache.modify({ + fields: { + documents: (existingDocs = []) => { + const newDocRef = cache.writeFragment({ + data: data.insert_documents.returning[0], + fragment: gql` + fragment newDoc on documents { + id + name + key + type + takenat + extension + jobid + } + `, + }); + return [...existingDocs, newDocRef]; + }, + }, + }); + }, variables: { docInput: [ {