@ynput/ayon-frontend-shared 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DetailsPanel.cjs.js +1 -0
- package/dist/DetailsPanel.cjs.js.map +1 -1
- package/dist/DetailsPanel.es.js +1 -0
- package/dist/DetailsPanel.es.js.map +1 -1
- package/dist/_virtual/index.cjs10.js +3 -5
- package/dist/_virtual/index.cjs10.js.map +1 -1
- package/dist/_virtual/index.cjs4.js +4 -4
- package/dist/_virtual/index.cjs5.js +4 -4
- package/dist/_virtual/index.cjs6.js +2 -2
- package/dist/_virtual/index.cjs7.js +5 -3
- package/dist/_virtual/index.cjs7.js.map +1 -1
- package/dist/_virtual/index.cjs8.js +4 -4
- package/dist/_virtual/index.cjs9.js +4 -4
- package/dist/_virtual/index.es10.js +2 -5
- package/dist/_virtual/index.es10.js.map +1 -1
- package/dist/_virtual/index.es4.js +4 -4
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +2 -2
- package/dist/_virtual/index.es7.js +5 -2
- package/dist/_virtual/index.es7.js.map +1 -1
- package/dist/_virtual/index.es8.js +4 -4
- package/dist/_virtual/index.es9.js +4 -4
- package/dist/index.cjs.js +1 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -0
- package/dist/index.es.js.map +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.cjs.js +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.es.js +1 -1
- package/dist/node_modules/parse-numeric-range/index.cjs.js +1 -1
- package/dist/node_modules/parse-numeric-range/index.es.js +1 -1
- package/dist/node_modules/rehype/node_modules/unified/lib/index.cjs.js +2 -2
- package/dist/node_modules/rehype/node_modules/unified/lib/index.es.js +2 -2
- package/dist/node_modules/rehype-parse/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype-parse/lib/index.es.js +1 -1
- package/dist/node_modules/rehype-prism-plus/dist/index.es.cjs.js +1 -1
- package/dist/node_modules/rehype-prism-plus/dist/index.es.es.js +1 -1
- package/dist/node_modules/remove-accents/index.cjs.js +1 -1
- package/dist/node_modules/remove-accents/index.es.js +1 -1
- package/dist/node_modules/vfile/lib/index.cjs.js +1 -1
- package/dist/node_modules/vfile/lib/index.es.js +1 -1
- package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.cjs.js +1 -0
- package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.cjs.js.map +1 -1
- package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.es.js +1 -0
- package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.es.js.map +1 -1
- package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.cjs.js +1 -0
- package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.cjs.js.map +1 -1
- package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.es.js +1 -0
- package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.es.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/ReviewablesList.cjs.js +1 -0
- package/dist/shared/src/components/ReviewablesList/ReviewablesList.cjs.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/ReviewablesList.es.js +1 -0
- package/dist/shared/src/components/ReviewablesList/ReviewablesList.es.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.cjs.js +1 -0
- package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.cjs.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.es.js +1 -0
- package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.es.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.cjs.js +1 -0
- package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.cjs.js.map +1 -1
- package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.es.js +1 -0
- package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.es.js.map +1 -1
- package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.cjs.js +3 -2
- package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.cjs.js.map +1 -1
- package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.es.js +3 -2
- package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.es.js.map +1 -1
- package/dist/shared/src/containers/Actions/ActionConfigDialog.cjs.js +1 -0
- package/dist/shared/src/containers/Actions/ActionConfigDialog.cjs.js.map +1 -1
- package/dist/shared/src/containers/Actions/ActionConfigDialog.es.js +1 -0
- package/dist/shared/src/containers/Actions/ActionConfigDialog.es.js.map +1 -1
- package/dist/shared/src/containers/Actions/Actions.cjs.js +6 -0
- package/dist/shared/src/containers/Actions/Actions.cjs.js.map +1 -1
- package/dist/shared/src/containers/Actions/Actions.es.js +6 -0
- package/dist/shared/src/containers/Actions/Actions.es.js.map +1 -1
- package/dist/shared/src/containers/Actions/InteractiveActionDialog.cjs.js +1 -0
- package/dist/shared/src/containers/Actions/InteractiveActionDialog.cjs.js.map +1 -1
- package/dist/shared/src/containers/Actions/InteractiveActionDialog.es.js +1 -0
- package/dist/shared/src/containers/Actions/InteractiveActionDialog.es.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanel.cjs.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanel.cjs.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanel.es.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanel.es.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.cjs.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.cjs.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.es.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.es.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.cjs.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.cjs.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.es.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.es.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.cjs.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.cjs.js.map +1 -1
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.es.js +1 -0
- package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/Feed.cjs.js +23 -2
- package/dist/shared/src/containers/Feed/Feed.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/Feed.es.js +24 -3
- package/dist/shared/src/containers/Feed/Feed.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.cjs.js +18 -0
- package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.es.js +19 -1
- package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js +7 -4
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js +7 -4
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/helpers.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/helpers.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.cjs.js +27 -15
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js +27 -15
- package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js +40 -12
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js +41 -13
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js +33 -19
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js +33 -19
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.cjs.js +14 -12
- package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.es.js +14 -12
- package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.cjs.js +8 -8
- package/dist/shared/src/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.es.js +8 -8
- package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.cjs.js +18 -0
- package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.cjs.js.map +1 -0
- package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.es.js +19 -0
- package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.es.js.map +1 -0
- package/dist/shared/src/containers/Feed/hooks/useCommentMutations.cjs.js +12 -3
- package/dist/shared/src/containers/Feed/hooks/useCommentMutations.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/hooks/useCommentMutations.es.js +12 -3
- package/dist/shared/src/containers/Feed/hooks/useCommentMutations.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/hooks/useTransformActivities.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/hooks/useTransformActivities.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.cjs.js +6 -6
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.es.js +6 -6
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.cjs.js +20 -2
- package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.es.js +20 -2
- package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.cjs.js +2 -6
- package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.es.js +2 -6
- package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.es.js.map +1 -1
- package/dist/shared/src/containers/RepresentationsList/RepresentationsList.cjs.js +1 -0
- package/dist/shared/src/containers/RepresentationsList/RepresentationsList.cjs.js.map +1 -1
- package/dist/shared/src/containers/RepresentationsList/RepresentationsList.es.js +1 -0
- package/dist/shared/src/containers/RepresentationsList/RepresentationsList.es.js.map +1 -1
- package/dist/shared/src/context/DetailsPanelContext.cjs.js +4 -0
- package/dist/shared/src/context/DetailsPanelContext.cjs.js.map +1 -1
- package/dist/shared/src/context/DetailsPanelContext.es.js +4 -0
- package/dist/shared/src/context/DetailsPanelContext.es.js.map +1 -1
- package/dist/shared/src/hooks/useActionTriggers.cjs.js +75 -0
- package/dist/shared/src/hooks/useActionTriggers.cjs.js.map +1 -1
- package/dist/shared/src/hooks/useActionTriggers.es.js +75 -0
- package/dist/shared/src/hooks/useActionTriggers.es.js.map +1 -1
- package/dist/types/containers/Actions/Actions.d.ts +2 -1
- package/dist/types/containers/Feed/components/CommentInput/CommentInput.d.ts +1 -1
- package/dist/types/containers/Feed/components/CommentInput/helpers.d.ts +6 -1
- package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.d.ts +1 -1
- package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.d.ts +5 -1
- package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.d.ts +5 -2
- package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.styled.d.ts +4 -0
- package/dist/types/containers/Feed/components/FilesGrid/FilesGrid.d.ts +1 -1
- package/dist/types/containers/Feed/helpers/mergeAnnotationAttachments.d.ts +2 -0
- package/dist/types/containers/Feed/hooks/useCommentMutations.d.ts +1 -1
- package/dist/types/containers/Feed/index.d.ts +6 -0
- package/dist/types/context/DetailsPanelContext.d.ts +4 -0
- package/dist/types/hooks/useActionTriggers.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/helpers.tsx"],"sourcesContent":["// @ts-nocheck\n\n// remove any query parameters from the url\nexport const parseImages = (body) => {\n // find images in the markdown with format \n const regex = /!\\[.*?\\]\\((.*?)\\)/g\n const matches = body.match(regex)\n\n let newBody = body\n\n if (matches) {\n matches.forEach((match) => {\n if (!match.includes('http')) return\n const url = match.match(/\\(([^)]+)\\)/)[1]\n const newUrl = url.split('?')[0]\n newBody = body.replace(url, newUrl)\n })\n }\n\n return newBody\n}\n\nexport async function typeWithDelay(quill, retain, type, delay = 1) {\n for (let i = 0; i < type.length; i++) {\n quill.insertText(retain + i, type[i])\n await new Promise((resolve) => setTimeout(resolve, delay))\n }\n}\n\nimport axios from 'axios'\nconst abortController = new AbortController()\nconst cancelToken = axios.CancelToken\nconst cancelTokenSource = cancelToken.source()\nimport { toast } from 'react-toastify'\n\n// used to upload files (quill ImageUploader module)\nexport const uploadFile = (file, projectName, onUploadProgress) => {\n return new Promise((resolve, reject) => {\n const formData = new FormData()\n formData.append('image', file)\n const opts = {\n signal: abortController.signal,\n cancelToken: cancelTokenSource.token,\n onUploadProgress: (e) => onUploadProgress && onUploadProgress(e, file),\n headers: {\n 'Content-Type': file.type,\n 'x-file-name': file.name,\n },\n }\n\n axios\n .post(`/api/projects/${projectName}/files`, file, opts)\n .then((result) => {\n resolve({ file: file, data: result.data })\n })\n .catch((error) => {\n console.error(error)\n reject({ message: 'Upload failed: ' + error.response.data.detail })\n })\n })\n}\n\nexport const handleFileDrop = (e, projectName, onProgress, onSuccess) => {\n e.preventDefault()\n e.stopPropagation()\n\n let files = e.dataTransfer.files\n if (files?.length) {\n if (files.length === 0) return\n\n for (const file of files) {\n uploadFile(file, projectName, onProgress).then(\n (data) => onSuccess(data),\n (error) => {\n toast.error('Upload failed: ' + error.response.data.detail)\n console.warn(error)\n },\n )\n }\n }\n}\n"],"names":["toast"],"mappings":";;;;AAGa,MAAA,cAAc,CAAC,SAAS;AAEnC,QAAM,QAAQ;AACR,QAAA,UAAU,KAAK,MAAM,KAAK;AAEhC,MAAI,UAAU;AAEd,MAAI,SAAS;AACH,YAAA,QAAQ,CAAC,UAAU;AACzB,UAAI,CAAC,MAAM,SAAS,MAAM,EAAG;AAC7B,YAAM,MAAM,MAAM,MAAM,aAAa,EAAE,CAAC;AACxC,YAAM,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC;AACrB,gBAAA,KAAK,QAAQ,KAAK,MAAM;AAAA,IAAA,CACnC;AAAA,EAAA;AAGI,SAAA;AACT;AAEA,eAAsB,cAAc,OAAO,QAAQ,MAAM,QAAQ,GAAG;AAClE,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,WAAW,SAAS,GAAG,KAAK,CAAC,CAAC;AACpC,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,KAAK,CAAC;AAAA,EAAA;AAE7D;AAGA,MAAM,kBAAkB,IAAI,gBAAgB;AAC5C,MAAM,cAAc,MAAM;AAC1B,MAAM,oBAAoB,YAAY,OAAO;
|
|
1
|
+
{"version":3,"file":"helpers.cjs.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/helpers.tsx"],"sourcesContent":["// @ts-nocheck\n\n// remove any query parameters from the url\nexport const parseImages = (body) => {\n // find images in the markdown with format \n const regex = /!\\[.*?\\]\\((.*?)\\)/g\n const matches = body.match(regex)\n\n let newBody = body\n\n if (matches) {\n matches.forEach((match) => {\n if (!match.includes('http')) return\n const url = match.match(/\\(([^)]+)\\)/)[1]\n const newUrl = url.split('?')[0]\n newBody = body.replace(url, newUrl)\n })\n }\n\n return newBody\n}\n\nexport async function typeWithDelay(quill, retain, type, delay = 1) {\n for (let i = 0; i < type.length; i++) {\n quill.insertText(retain + i, type[i])\n await new Promise((resolve) => setTimeout(resolve, delay))\n }\n}\n\nimport axios from 'axios'\nconst abortController = new AbortController()\nconst cancelToken = axios.CancelToken\nconst cancelTokenSource = cancelToken.source()\nimport { toast } from 'react-toastify'\n\ntype UploadedFile = {\n file: any\n data: any\n}\n\n// used to upload files (quill ImageUploader module)\nexport const uploadFile = (file, projectName, onUploadProgress): Promise<UploadedFile> => {\n return new Promise((resolve, reject) => {\n const formData = new FormData()\n formData.append('image', file)\n const opts = {\n signal: abortController.signal,\n cancelToken: cancelTokenSource.token,\n onUploadProgress: (e) => onUploadProgress && onUploadProgress(e, file),\n headers: {\n 'Content-Type': file.type,\n 'x-file-name': file.name,\n },\n }\n\n axios\n .post(`/api/projects/${projectName}/files`, file, opts)\n .then((result) => {\n resolve({ file: file, data: result.data })\n })\n .catch((error) => {\n console.error(error)\n reject({ message: 'Upload failed: ' + error.response.data.detail })\n })\n })\n}\n\nexport const handleFileDrop = (e, projectName, onProgress, onSuccess) => {\n e.preventDefault()\n e.stopPropagation()\n\n let files = e.dataTransfer.files\n if (files?.length) {\n if (files.length === 0) return\n\n for (const file of files) {\n uploadFile(file, projectName, onProgress).then(\n (data) => onSuccess(data),\n (error) => {\n toast.error('Upload failed: ' + error.response.data.detail)\n console.warn(error)\n },\n )\n }\n }\n}\n"],"names":["toast"],"mappings":";;;;AAGa,MAAA,cAAc,CAAC,SAAS;AAEnC,QAAM,QAAQ;AACR,QAAA,UAAU,KAAK,MAAM,KAAK;AAEhC,MAAI,UAAU;AAEd,MAAI,SAAS;AACH,YAAA,QAAQ,CAAC,UAAU;AACzB,UAAI,CAAC,MAAM,SAAS,MAAM,EAAG;AAC7B,YAAM,MAAM,MAAM,MAAM,aAAa,EAAE,CAAC;AACxC,YAAM,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC;AACrB,gBAAA,KAAK,QAAQ,KAAK,M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AO;AACb,iBAAA,MAAM,aAAa,UAAU,EAAE;AAAA,QACxC,CAAC,SAAS,UAAU,IAAI;AAAA,QACxB,CAAC,UAAU;AACTA,wBAAA,MAAM,MAAM,oBAAoB,MAAM,SAAS,KAAK,MAAM;AAC1D,kBAAQ,KAAK,KAAK;AAAA,QAAA;AAAA,MAEtB;AAAA,IAAA;AAAA,EACF;AAEJ;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.es.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/helpers.tsx"],"sourcesContent":["// @ts-nocheck\n\n// remove any query parameters from the url\nexport const parseImages = (body) => {\n // find images in the markdown with format \n const regex = /!\\[.*?\\]\\((.*?)\\)/g\n const matches = body.match(regex)\n\n let newBody = body\n\n if (matches) {\n matches.forEach((match) => {\n if (!match.includes('http')) return\n const url = match.match(/\\(([^)]+)\\)/)[1]\n const newUrl = url.split('?')[0]\n newBody = body.replace(url, newUrl)\n })\n }\n\n return newBody\n}\n\nexport async function typeWithDelay(quill, retain, type, delay = 1) {\n for (let i = 0; i < type.length; i++) {\n quill.insertText(retain + i, type[i])\n await new Promise((resolve) => setTimeout(resolve, delay))\n }\n}\n\nimport axios from 'axios'\nconst abortController = new AbortController()\nconst cancelToken = axios.CancelToken\nconst cancelTokenSource = cancelToken.source()\nimport { toast } from 'react-toastify'\n\n// used to upload files (quill ImageUploader module)\nexport const uploadFile = (file, projectName, onUploadProgress) => {\n return new Promise((resolve, reject) => {\n const formData = new FormData()\n formData.append('image', file)\n const opts = {\n signal: abortController.signal,\n cancelToken: cancelTokenSource.token,\n onUploadProgress: (e) => onUploadProgress && onUploadProgress(e, file),\n headers: {\n 'Content-Type': file.type,\n 'x-file-name': file.name,\n },\n }\n\n axios\n .post(`/api/projects/${projectName}/files`, file, opts)\n .then((result) => {\n resolve({ file: file, data: result.data })\n })\n .catch((error) => {\n console.error(error)\n reject({ message: 'Upload failed: ' + error.response.data.detail })\n })\n })\n}\n\nexport const handleFileDrop = (e, projectName, onProgress, onSuccess) => {\n e.preventDefault()\n e.stopPropagation()\n\n let files = e.dataTransfer.files\n if (files?.length) {\n if (files.length === 0) return\n\n for (const file of files) {\n uploadFile(file, projectName, onProgress).then(\n (data) => onSuccess(data),\n (error) => {\n toast.error('Upload failed: ' + error.response.data.detail)\n console.warn(error)\n },\n )\n }\n }\n}\n"],"names":[],"mappings":";;AAGa,MAAA,cAAc,CAAC,SAAS;AAEnC,QAAM,QAAQ;AACR,QAAA,UAAU,KAAK,MAAM,KAAK;AAEhC,MAAI,UAAU;AAEd,MAAI,SAAS;AACH,YAAA,QAAQ,CAAC,UAAU;AACzB,UAAI,CAAC,MAAM,SAAS,MAAM,EAAG;AAC7B,YAAM,MAAM,MAAM,MAAM,aAAa,EAAE,CAAC;AACxC,YAAM,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC;AACrB,gBAAA,KAAK,QAAQ,KAAK,MAAM;AAAA,IAAA,CACnC;AAAA,EAAA;AAGI,SAAA;AACT;AAEA,eAAsB,cAAc,OAAO,QAAQ,MAAM,QAAQ,GAAG;AAClE,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,WAAW,SAAS,GAAG,KAAK,CAAC,CAAC;AACpC,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,KAAK,CAAC;AAAA,EAAA;AAE7D;AAGA,MAAM,kBAAkB,IAAI,gBAAgB;AAC5C,MAAM,cAAc,MAAM;AAC1B,MAAM,oBAAoB,YAAY,OAAO;
|
|
1
|
+
{"version":3,"file":"helpers.es.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/helpers.tsx"],"sourcesContent":["// @ts-nocheck\n\n// remove any query parameters from the url\nexport const parseImages = (body) => {\n // find images in the markdown with format \n const regex = /!\\[.*?\\]\\((.*?)\\)/g\n const matches = body.match(regex)\n\n let newBody = body\n\n if (matches) {\n matches.forEach((match) => {\n if (!match.includes('http')) return\n const url = match.match(/\\(([^)]+)\\)/)[1]\n const newUrl = url.split('?')[0]\n newBody = body.replace(url, newUrl)\n })\n }\n\n return newBody\n}\n\nexport async function typeWithDelay(quill, retain, type, delay = 1) {\n for (let i = 0; i < type.length; i++) {\n quill.insertText(retain + i, type[i])\n await new Promise((resolve) => setTimeout(resolve, delay))\n }\n}\n\nimport axios from 'axios'\nconst abortController = new AbortController()\nconst cancelToken = axios.CancelToken\nconst cancelTokenSource = cancelToken.source()\nimport { toast } from 'react-toastify'\n\ntype UploadedFile = {\n file: any\n data: any\n}\n\n// used to upload files (quill ImageUploader module)\nexport const uploadFile = (file, projectName, onUploadProgress): Promise<UploadedFile> => {\n return new Promise((resolve, reject) => {\n const formData = new FormData()\n formData.append('image', file)\n const opts = {\n signal: abortController.signal,\n cancelToken: cancelTokenSource.token,\n onUploadProgress: (e) => onUploadProgress && onUploadProgress(e, file),\n headers: {\n 'Content-Type': file.type,\n 'x-file-name': file.name,\n },\n }\n\n axios\n .post(`/api/projects/${projectName}/files`, file, opts)\n .then((result) => {\n resolve({ file: file, data: result.data })\n })\n .catch((error) => {\n console.error(error)\n reject({ message: 'Upload failed: ' + error.response.data.detail })\n })\n })\n}\n\nexport const handleFileDrop = (e, projectName, onProgress, onSuccess) => {\n e.preventDefault()\n e.stopPropagation()\n\n let files = e.dataTransfer.files\n if (files?.length) {\n if (files.length === 0) return\n\n for (const file of files) {\n uploadFile(file, projectName, onProgress).then(\n (data) => onSuccess(data),\n (error) => {\n toast.error('Upload failed: ' + error.response.data.detail)\n console.warn(error)\n },\n )\n }\n }\n}\n"],"names":[],"mappings":";;AAGa,MAAA,cAAc,CAAC,SAAS;AAEnC,QAAM,QAAQ;AACR,QAAA,UAAU,KAAK,MAAM,KAAK;AAEhC,MAAI,UAAU;AAEd,MAAI,SAAS;AACH,YAAA,QAAQ,CAAC,UAAU;AACzB,UAAI,CAAC,MAAM,SAAS,MAAM,EAAG;AAC7B,YAAM,MAAM,MAAM,MAAM,aAAa,EAAE,CAAC;AACxC,Y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3B,MAAI,+BAAO,QAAQ;AACb,QAAA,MAAM,WAAW,EAAG;AAExB,eAAW,QAAQ,OAAO;AACb,iBAAA,MAAM,aAAa,UAAU,EAAE;AAAA,QACxC,CAAC,SAAS,UAAU,IAAI;AAAA,QACxB,CAAC,UAAU;AACT,gBAAM,MAAM,oBAAoB,MAAM,SAAS,KAAK,MAAM;AAC1D,kBAAQ,KAAK,KAAK;AAAA,QAAA;AAAA,MAEtB;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ require("../../../../../context/AddonContext.cjs.js");
|
|
|
14
14
|
const filterEntityAnnotations = (annotations, entityId, filesUploading) => {
|
|
15
15
|
return Object.values(annotations).filter(
|
|
16
16
|
(annotation) => annotation.versionId === entityId && !filesUploading.some((file) => file.name === annotation.name)
|
|
17
|
-
).map((annotation) => ({ ...annotation,
|
|
17
|
+
).map((annotation) => ({ ...annotation, isUnsavedAnnotation: true }));
|
|
18
18
|
};
|
|
19
19
|
const useAnnotationsSync = ({ entityId, filesUploading }) => {
|
|
20
20
|
const { editingId, setEditingId, annotations, removeAnnotation } = FeedContext.useFeedContext();
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnotationsSync.cjs.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { FEED_NEW_COMMENT, useFeedContext } from '../../../context/FeedContext'\nimport { useDetailsPanelContext } from '@shared/context'\n\ntype Props = {\n entityId: string\n filesUploading: File[]\n}\n\nexport type AnnotationPreview = any & {\n
|
|
1
|
+
{"version":3,"file":"useAnnotationsSync.cjs.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { FEED_NEW_COMMENT, useFeedContext } from '../../../context/FeedContext'\nimport { useDetailsPanelContext } from '@shared/context'\n\ntype Props = {\n entityId: string\n filesUploading: File[]\n}\n\nexport type AnnotationPreview = any & {\n isUnsavedAnnotation: true\n}\n\n// annotations are temporary store\nexport const filterEntityAnnotations = (\n annotations: Record<string, any>,\n entityId: string,\n filesUploading: File[],\n): AnnotationPreview[] => {\n return Object.values(annotations)\n .filter(\n (annotation) =>\n annotation.versionId === entityId &&\n !filesUploading.some((file) => file.name === annotation.name),\n )\n .map((annotation) => ({ ...annotation, isUnsavedAnnotation: true })) as AnnotationPreview[]\n}\n\nconst useAnnotationsSync = ({ entityId, filesUploading }: Props) => {\n const { editingId, setEditingId, annotations, removeAnnotation } = useFeedContext()\n const { onGoToFrame } = useDetailsPanelContext()\n\n // filter out annotations that are for this entity and are NOT uploading\n const filteredAnnotations = filterEntityAnnotations(annotations || [], entityId, filesUploading)\n\n // when annotations change, update the state\n useEffect(() => {\n // open the comment input if there are annotations and something is not being edited already\n if (filteredAnnotations.length > 0 && !editingId) {\n setEditingId(FEED_NEW_COMMENT)\n }\n }, [filteredAnnotations])\n\n const handleGoToAnnotation = (annotation: AnnotationPreview) => {\n const firstFrame = annotation.range[0]\n onGoToFrame?.(firstFrame)\n }\n\n return {\n annotations: filteredAnnotations,\n goToAnnotation: handleGoToAnnotation,\n removeAnnotation,\n }\n}\n\nexport default useAnnotationsSync\n"],"names":["useFeedContext","useDetailsPanelContext","useEffect","FEED_NEW_COMMENT"],"mappings":";;;;;;;;;;;;;AAcO,MAAM,0BAA0B,CACrC,aACA,UACA,mBACwB;AACjB,SAAA,OAAO,OAAO,WAAW,EAC7B;AAAA,IACC,CAAC,eACC,WAAW,cAAc,YACzB,CAAC,eAAe,KAAK,CAAC,SAAS,KAAK,SAAS,WAAW,IAAI;AAAA,EAAA,EAE/D,IAAI,CAAC,gBAAgB,EAAE,GAAG,YAAY,qBAAqB,KAAA,EAAO;AACvE;AAEA,MAAM,qBAAqB,CAAC,EAAE,UAAU,qBAA4B;AAClE,QAAM,EAAE,WAAW,cAAc,aAAa,iBAAA,IAAqBA,YAAAA,eAAe;AAC5E,QAAA,EAAE,YAAY,IAAIC,2CAAuB;AAG/C,QAAM,sBAAsB,wBAAwB,eAAe,CAAA,GAAI,UAAU,cAAc;AAG/FC,QAAAA,UAAU,MAAM;AAEd,QAAI,oBAAoB,SAAS,KAAK,CAAC,WAAW;AAChD,mBAAaC,YAAAA,gBAAgB;AAAA,IAAA;AAAA,EAC/B,GACC,CAAC,mBAAmB,CAAC;AAElB,QAAA,uBAAuB,CAAC,eAAkC;AACxD,UAAA,aAAa,WAAW,MAAM,CAAC;AACrC,+CAAc;AAAA,EAChB;AAEO,SAAA;AAAA,IACL,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB;AAAA,EACF;AACF;;;"}
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js
CHANGED
|
@@ -12,7 +12,7 @@ import "../../../../../context/AddonContext.es.js";
|
|
|
12
12
|
const filterEntityAnnotations = (annotations, entityId, filesUploading) => {
|
|
13
13
|
return Object.values(annotations).filter(
|
|
14
14
|
(annotation) => annotation.versionId === entityId && !filesUploading.some((file) => file.name === annotation.name)
|
|
15
|
-
).map((annotation) => ({ ...annotation,
|
|
15
|
+
).map((annotation) => ({ ...annotation, isUnsavedAnnotation: true }));
|
|
16
16
|
};
|
|
17
17
|
const useAnnotationsSync = ({ entityId, filesUploading }) => {
|
|
18
18
|
const { editingId, setEditingId, annotations, removeAnnotation } = useFeedContext();
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnotationsSync.es.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { FEED_NEW_COMMENT, useFeedContext } from '../../../context/FeedContext'\nimport { useDetailsPanelContext } from '@shared/context'\n\ntype Props = {\n entityId: string\n filesUploading: File[]\n}\n\nexport type AnnotationPreview = any & {\n
|
|
1
|
+
{"version":3,"file":"useAnnotationsSync.es.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { FEED_NEW_COMMENT, useFeedContext } from '../../../context/FeedContext'\nimport { useDetailsPanelContext } from '@shared/context'\n\ntype Props = {\n entityId: string\n filesUploading: File[]\n}\n\nexport type AnnotationPreview = any & {\n isUnsavedAnnotation: true\n}\n\n// annotations are temporary store\nexport const filterEntityAnnotations = (\n annotations: Record<string, any>,\n entityId: string,\n filesUploading: File[],\n): AnnotationPreview[] => {\n return Object.values(annotations)\n .filter(\n (annotation) =>\n annotation.versionId === entityId &&\n !filesUploading.some((file) => file.name === annotation.name),\n )\n .map((annotation) => ({ ...annotation, isUnsavedAnnotation: true })) as AnnotationPreview[]\n}\n\nconst useAnnotationsSync = ({ entityId, filesUploading }: Props) => {\n const { editingId, setEditingId, annotations, removeAnnotation } = useFeedContext()\n const { onGoToFrame } = useDetailsPanelContext()\n\n // filter out annotations that are for this entity and are NOT uploading\n const filteredAnnotations = filterEntityAnnotations(annotations || [], entityId, filesUploading)\n\n // when annotations change, update the state\n useEffect(() => {\n // open the comment input if there are annotations and something is not being edited already\n if (filteredAnnotations.length > 0 && !editingId) {\n setEditingId(FEED_NEW_COMMENT)\n }\n }, [filteredAnnotations])\n\n const handleGoToAnnotation = (annotation: AnnotationPreview) => {\n const firstFrame = annotation.range[0]\n onGoToFrame?.(firstFrame)\n }\n\n return {\n annotations: filteredAnnotations,\n goToAnnotation: handleGoToAnnotation,\n removeAnnotation,\n }\n}\n\nexport default useAnnotationsSync\n"],"names":[],"mappings":";;;;;;;;;;;AAcO,MAAM,0BAA0B,CACrC,aACA,UACA,mBACwB;AACjB,SAAA,OAAO,OAAO,WAAW,EAC7B;AAAA,IACC,CAAC,eACC,WAAW,cAAc,YACzB,CAAC,eAAe,KAAK,CAAC,SAAS,KAAK,SAAS,WAAW,IAAI;AAAA,EAAA,EAE/D,IAAI,CAAC,gBAAgB,EAAE,GAAG,YAAY,qBAAqB,KAAA,EAAO;AACvE;AAEA,MAAM,qBAAqB,CAAC,EAAE,UAAU,qBAA4B;AAClE,QAAM,EAAE,WAAW,cAAc,aAAa,iBAAA,IAAqB,eAAe;AAC5E,QAAA,EAAE,YAAY,IAAI,uBAAuB;AAG/C,QAAM,sBAAsB,wBAAwB,eAAe,CAAA,GAAI,UAAU,cAAc;AAG/F,YAAU,MAAM;AAEd,QAAI,oBAAoB,SAAS,KAAK,CAAC,WAAW;AAChD,mBAAa,gBAAgB;AAAA,IAAA;AAAA,EAC/B,GACC,CAAC,mBAAmB,CAAC;AAElB,QAAA,uBAAuB,CAAC,eAAkC;AACxD,UAAA,aAAa,WAAW,MAAM,CAAC;AACrC,+CAAc;AAAA,EAChB;AAEO,SAAA;AAAA,IACL,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB;AAAA,EACF;AACF;"}
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.cjs.js
CHANGED
|
@@ -7,37 +7,49 @@ const useAnnotationsUpload = ({ projectName, onSuccess }) => {
|
|
|
7
7
|
const uploadAnnotations = async (annotations) => {
|
|
8
8
|
try {
|
|
9
9
|
const uploadPromises = annotations.map(async (annotation) => {
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
10
|
+
const composite = await (exportAnnotationComposite == null ? void 0 : exportAnnotationComposite(annotation.id));
|
|
11
|
+
if (!composite) {
|
|
12
12
|
throw new Error(`Exporting composite image for annotation ${annotation.id} failed`);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const compositeFile = new File([composite], annotation.name, {
|
|
15
15
|
type: "image/png"
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
const transparent = await fetch(annotation.annotationData).then((r) => r.blob());
|
|
18
|
+
const transparentFile = new File([transparent], `annotation-${annotation.name}`, {
|
|
19
|
+
type: "image/png"
|
|
18
20
|
});
|
|
21
|
+
const uploads = await Promise.all([
|
|
22
|
+
helpers.uploadFile(compositeFile, projectName, () => {
|
|
23
|
+
}),
|
|
24
|
+
helpers.uploadFile(transparentFile, projectName, () => {
|
|
25
|
+
})
|
|
26
|
+
]);
|
|
27
|
+
return { annotation, uploads };
|
|
19
28
|
});
|
|
20
29
|
const res = await Promise.allSettled(uploadPromises);
|
|
21
30
|
const successfulFiles = [];
|
|
31
|
+
const metadata = [];
|
|
22
32
|
res.forEach((result) => {
|
|
23
|
-
var _a;
|
|
24
33
|
if (result.status === "fulfilled") {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const { uploads, annotation } = result.value;
|
|
35
|
+
uploads.forEach((upload) => {
|
|
36
|
+
successfulFiles.push(onSuccess(upload));
|
|
37
|
+
});
|
|
38
|
+
metadata.push({
|
|
39
|
+
range: annotation.range,
|
|
40
|
+
id: annotation.id,
|
|
41
|
+
composite: uploads[0].data.id,
|
|
42
|
+
transparent: uploads[1].data.id
|
|
43
|
+
});
|
|
44
|
+
removeAnnotation == null ? void 0 : removeAnnotation(annotation.id);
|
|
33
45
|
} else {
|
|
34
46
|
reactToastify.toast.error("Upload failed: " + result.reason.message);
|
|
35
47
|
}
|
|
36
48
|
});
|
|
37
|
-
return successfulFiles;
|
|
49
|
+
return { files: successfulFiles, metadata };
|
|
38
50
|
} catch (error) {
|
|
39
51
|
reactToastify.toast.error("Upload failed: " + error.message);
|
|
40
|
-
return [];
|
|
52
|
+
return { files: [], metadata: [] };
|
|
41
53
|
}
|
|
42
54
|
};
|
|
43
55
|
return uploadAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnotationsUpload.cjs.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.ts"],"sourcesContent":["import { uploadFile } from '../helpers'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../../../context/FeedContext'\n\ntype Props = {\n projectName: string\n onSuccess: (data: any) => void\n}\n\nconst useAnnotationsUpload = ({ projectName, onSuccess }: Props) => {\n const { removeAnnotation, exportAnnotationComposite } = useFeedContext()\n\n const uploadAnnotations = async (annotations: any[]) => {\n try {\n const uploadPromises = annotations.map(async (annotation) => {\n const
|
|
1
|
+
{"version":3,"file":"useAnnotationsUpload.cjs.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.ts"],"sourcesContent":["import { uploadFile } from '../helpers'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../../../context/FeedContext'\nimport { SavedAnnotationMetadata } from '../../../index'\n\ntype Props = {\n projectName: string\n onSuccess: (data: any) => void\n}\n\nconst useAnnotationsUpload = ({ projectName, onSuccess }: Props) => {\n const { removeAnnotation, exportAnnotationComposite } = useFeedContext()\n\n const uploadAnnotations = async (annotations: any[]) => {\n try {\n const uploadPromises = annotations.map(async (annotation) => {\n const composite = await exportAnnotationComposite?.(annotation.id)\n if (!composite) {\n throw new Error(`Exporting composite image for annotation ${annotation.id} failed`)\n }\n\n const compositeFile = new File([composite], annotation.name, {\n type: 'image/png',\n })\n\n const transparent = await fetch(annotation.annotationData).then(r => r.blob())\n const transparentFile = new File([transparent], `annotation-${annotation.name}`, {\n type: 'image/png',\n })\n\n const uploads = await Promise.all([\n uploadFile(compositeFile, projectName, () => {}),\n uploadFile(transparentFile, projectName, () => {}),\n ])\n\n return { annotation, uploads }\n })\n\n const res = await Promise.allSettled(uploadPromises)\n\n const successfulFiles: any[] = []\n const metadata: SavedAnnotationMetadata[] = []\n\n res.forEach((result) => {\n if (result.status === 'fulfilled') {\n const { uploads, annotation } = result.value\n\n uploads.forEach((upload: any) => {\n successfulFiles.push(onSuccess(upload))\n })\n\n metadata.push({\n range: annotation.range,\n id: annotation.id,\n composite: uploads[0].data.id,\n transparent: uploads[1].data.id,\n })\n\n removeAnnotation?.(annotation.id)\n } else {\n toast.error('Upload failed: ' + result.reason.message)\n }\n })\n\n return { files: successfulFiles, metadata }\n } catch (error: any) {\n toast.error('Upload failed: ' + error.message)\n return { files: [], metadata: [] }\n }\n }\n\n return uploadAnnotations\n}\n\nexport default useAnnotationsUpload\n\nconst base64ToBlob = (base64: string) => {\n const byteString = atob(base64.split(',')[1])\n const mimeString = base64.split(',')[0].split(':')[1].split(';')[0]\n const ab = new ArrayBuffer(byteString.length)\n const ia = new Uint8Array(ab)\n for (let i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i)\n }\n return new Blob([ab], { type: mimeString })\n}\n"],"names":["useFeedContext","uploadFile","toast"],"mappings":";;;;AAUA,MAAM,uBAAuB,CAAC,EAAE,aAAa,gBAAuB;AAClE,QAAM,EAAE,kBAAkB,0BAA0B,IAAIA,2BAAe;AAEjE,QAAA,oBAAoB,OAAO,gBAAuB;AAClD,QAAA;AACF,YAAM,iBAAiB,YAAY,IAAI,OAAO,eAAe;AAC3D,cAAM,YAAY,OAAM,uEAA4B,WAAW;AAC/D,YAAI,CAAC,WAAW;AACd,gBAAM,IAAI,MAAM,4CAA4C,WAAW,EAAE,SAAS;AAAA,QAAA;AAGpF,cAAM,gBAAgB,IAAI,KAAK,CAAC,SAAS,GAAG,WAAW,MAAM;AAAA,UAC3D,MAAM;AAAA,QAAA,CACP;AAEK,cAAA,cAAc,MAAM,MAAM,WAAW,cAAc,EAAE,KAAK,CAAA,MAAK,EAAE,MAAM;AACvE,cAAA,kBAAkB,IAAI,KAAK,CAAC,WAAW,GAAG,cAAc,WAAW,IAAI,IAAI;AAAA,UAC/E,MAAM;AAAA,QAAA,CACP;AAEK,cAAA,UAAU,MAAM,QAAQ,IAAI;AAAA,UAChCC,mBAAW,eAAe,aAAa,MAAM;AAAA,UAAA,CAAE;AAAA,UAC/CA,mBAAW,iBAAiB,aAAa,MAAM;AAAA,UAAE,CAAA;AAAA,QAAA,CAClD;AAEM,eAAA,EAAE,YAAY,QAAQ;AAAA,MAAA,CAC9B;AAED,YAAM,MAAM,MAAM,QAAQ,WAAW,cAAc;AAEnD,YAAM,kBAAyB,CAAC;AAChC,YAAM,WAAsC,CAAC;AAEzC,UAAA,QAAQ,CAAC,WAAW;AAClB,YAAA,OAAO,WAAW,aAAa;AACjC,gBAAM,EAAE,SAAS,WAAW,IAAI,OAAO;AAE/B,kBAAA,QAAQ,CAAC,WAAgB;AACf,4BAAA,KAAK,UAAU,MAAM,CAAC;AAAA,UAAA,CACvC;AAED,mBAAS,KAAK;AAAA,YACZ,OAAO,WAAW;AAAA,YAClB,IAAI,WAAW;AAAA,YACf,WAAW,QAAQ,CAAC,EAAE,KAAK;AAAA,YAC3B,aAAa,QAAQ,CAAC,EAAE,KAAK;AAAA,UAAA,CAC9B;AAED,+DAAmB,WAAW;AAAA,QAAE,OAC3B;AACLC,wBAAAA,MAAM,MAAM,oBAAoB,OAAO,OAAO,OAAO;AAAA,QAAA;AAAA,MACvD,CACD;AAEM,aAAA,EAAE,OAAO,iBAAiB,SAAS;AAAA,aACnC,OAAY;AACbA,oBAAAA,MAAA,MAAM,oBAAoB,MAAM,OAAO;AAC7C,aAAO,EAAE,OAAO,IAAI,UAAU,CAAA,EAAG;AAAA,IAAA;AAAA,EAErC;AAEO,SAAA;AACT;;"}
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js
CHANGED
|
@@ -6,37 +6,49 @@ const useAnnotationsUpload = ({ projectName, onSuccess }) => {
|
|
|
6
6
|
const uploadAnnotations = async (annotations) => {
|
|
7
7
|
try {
|
|
8
8
|
const uploadPromises = annotations.map(async (annotation) => {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
9
|
+
const composite = await (exportAnnotationComposite == null ? void 0 : exportAnnotationComposite(annotation.id));
|
|
10
|
+
if (!composite) {
|
|
11
11
|
throw new Error(`Exporting composite image for annotation ${annotation.id} failed`);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const compositeFile = new File([composite], annotation.name, {
|
|
14
14
|
type: "image/png"
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
const transparent = await fetch(annotation.annotationData).then((r) => r.blob());
|
|
17
|
+
const transparentFile = new File([transparent], `annotation-${annotation.name}`, {
|
|
18
|
+
type: "image/png"
|
|
17
19
|
});
|
|
20
|
+
const uploads = await Promise.all([
|
|
21
|
+
uploadFile(compositeFile, projectName, () => {
|
|
22
|
+
}),
|
|
23
|
+
uploadFile(transparentFile, projectName, () => {
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
return { annotation, uploads };
|
|
18
27
|
});
|
|
19
28
|
const res = await Promise.allSettled(uploadPromises);
|
|
20
29
|
const successfulFiles = [];
|
|
30
|
+
const metadata = [];
|
|
21
31
|
res.forEach((result) => {
|
|
22
|
-
var _a;
|
|
23
32
|
if (result.status === "fulfilled") {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const { uploads, annotation } = result.value;
|
|
34
|
+
uploads.forEach((upload) => {
|
|
35
|
+
successfulFiles.push(onSuccess(upload));
|
|
36
|
+
});
|
|
37
|
+
metadata.push({
|
|
38
|
+
range: annotation.range,
|
|
39
|
+
id: annotation.id,
|
|
40
|
+
composite: uploads[0].data.id,
|
|
41
|
+
transparent: uploads[1].data.id
|
|
42
|
+
});
|
|
43
|
+
removeAnnotation == null ? void 0 : removeAnnotation(annotation.id);
|
|
32
44
|
} else {
|
|
33
45
|
toast.error("Upload failed: " + result.reason.message);
|
|
34
46
|
}
|
|
35
47
|
});
|
|
36
|
-
return successfulFiles;
|
|
48
|
+
return { files: successfulFiles, metadata };
|
|
37
49
|
} catch (error) {
|
|
38
50
|
toast.error("Upload failed: " + error.message);
|
|
39
|
-
return [];
|
|
51
|
+
return { files: [], metadata: [] };
|
|
40
52
|
}
|
|
41
53
|
};
|
|
42
54
|
return uploadAnnotations;
|
package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnotationsUpload.es.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.ts"],"sourcesContent":["import { uploadFile } from '../helpers'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../../../context/FeedContext'\n\ntype Props = {\n projectName: string\n onSuccess: (data: any) => void\n}\n\nconst useAnnotationsUpload = ({ projectName, onSuccess }: Props) => {\n const { removeAnnotation, exportAnnotationComposite } = useFeedContext()\n\n const uploadAnnotations = async (annotations: any[]) => {\n try {\n const uploadPromises = annotations.map(async (annotation) => {\n const
|
|
1
|
+
{"version":3,"file":"useAnnotationsUpload.es.js","sources":["../../../../../../../../src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.ts"],"sourcesContent":["import { uploadFile } from '../helpers'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../../../context/FeedContext'\nimport { SavedAnnotationMetadata } from '../../../index'\n\ntype Props = {\n projectName: string\n onSuccess: (data: any) => void\n}\n\nconst useAnnotationsUpload = ({ projectName, onSuccess }: Props) => {\n const { removeAnnotation, exportAnnotationComposite } = useFeedContext()\n\n const uploadAnnotations = async (annotations: any[]) => {\n try {\n const uploadPromises = annotations.map(async (annotation) => {\n const composite = await exportAnnotationComposite?.(annotation.id)\n if (!composite) {\n throw new Error(`Exporting composite image for annotation ${annotation.id} failed`)\n }\n\n const compositeFile = new File([composite], annotation.name, {\n type: 'image/png',\n })\n\n const transparent = await fetch(annotation.annotationData).then(r => r.blob())\n const transparentFile = new File([transparent], `annotation-${annotation.name}`, {\n type: 'image/png',\n })\n\n const uploads = await Promise.all([\n uploadFile(compositeFile, projectName, () => {}),\n uploadFile(transparentFile, projectName, () => {}),\n ])\n\n return { annotation, uploads }\n })\n\n const res = await Promise.allSettled(uploadPromises)\n\n const successfulFiles: any[] = []\n const metadata: SavedAnnotationMetadata[] = []\n\n res.forEach((result) => {\n if (result.status === 'fulfilled') {\n const { uploads, annotation } = result.value\n\n uploads.forEach((upload: any) => {\n successfulFiles.push(onSuccess(upload))\n })\n\n metadata.push({\n range: annotation.range,\n id: annotation.id,\n composite: uploads[0].data.id,\n transparent: uploads[1].data.id,\n })\n\n removeAnnotation?.(annotation.id)\n } else {\n toast.error('Upload failed: ' + result.reason.message)\n }\n })\n\n return { files: successfulFiles, metadata }\n } catch (error: any) {\n toast.error('Upload failed: ' + error.message)\n return { files: [], metadata: [] }\n }\n }\n\n return uploadAnnotations\n}\n\nexport default useAnnotationsUpload\n\nconst base64ToBlob = (base64: string) => {\n const byteString = atob(base64.split(',')[1])\n const mimeString = base64.split(',')[0].split(':')[1].split(';')[0]\n const ab = new ArrayBuffer(byteString.length)\n const ia = new Uint8Array(ab)\n for (let i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i)\n }\n return new Blob([ab], { type: mimeString })\n}\n"],"names":[],"mappings":";;;AAUA,MAAM,uBAAuB,CAAC,EAAE,aAAa,gBAAuB;AAClE,QAAM,EAAE,kBAAkB,0BAA0B,IAAI,eAAe;AAEjE,QAAA,oBAAoB,OAAO,gBAAuB;AAClD,QAAA;AACF,YAAM,iBAAiB,YAAY,IAAI,OAAO,eAAe;AAC3D,cAAM,YAAY,OAAM,uEAA4B,WAAW;AAC/D,YAAI,CAAC,WAAW;AACd,gBAAM,IAAI,MAAM,4CAA4C,WAAW,EAAE,SAAS;AAAA,QAAA;AAGpF,cAAM,gBAAgB,IAAI,KAAK,CAAC,SAAS,GAAG,WAAW,MAAM;AAAA,UAC3D,MAAM;AAAA,QAAA,CACP;AAEK,cAAA,cAAc,MAAM,MAAM,WAAW,cAAc,EAAE,KAAK,CAAA,MAAK,EAAE,MAAM;AACvE,cAAA,kBAAkB,IAAI,KAAK,CAAC,WAAW,GAAG,cAAc,WAAW,IAAI,IAAI;AAAA,UAC/E,MAAM;AAAA,QAAA,CACP;AAEK,cAAA,UAAU,MAAM,QAAQ,IAAI;AAAA,UAChC,WAAW,eAAe,aAAa,MAAM;AAAA,UAAA,CAAE;AAAA,UAC/C,WAAW,iBAAiB,aAAa,MAAM;AAAA,UAAE,CAAA;AAAA,QAAA,CAClD;AAEM,eAAA,EAAE,YAAY,QAAQ;AAAA,MAAA,CAC9B;AAED,YAAM,MAAM,MAAM,QAAQ,WAAW,cAAc;AAEnD,YAAM,kBAAyB,CAAC;AAChC,YAAM,WAAsC,CAAC;AAEzC,UAAA,QAAQ,CAAC,WAAW;AAClB,YAAA,OAAO,WAAW,aAAa;AACjC,gBAAM,EAAE,SAAS,WAAW,IAAI,OAAO;AAE/B,kBAAA,QAAQ,CAAC,WAAgB;AACf,4BAAA,KAAK,UAAU,MAAM,CAAC;AAAA,UAAA,CACvC;AAED,mBAAS,KAAK;AAAA,YACZ,OAAO,WAAW;AAAA,YAClB,IAAI,WAAW;AAAA,YACf,WAAW,QAAQ,CAAC,EAAE,KAAK;AAAA,YAC3B,aAAa,QAAQ,CAAC,EAAE,KAAK;AAAA,UAAA,CAC9B;AAED,+DAAmB,WAAW;AAAA,QAAE,OAC3B;AACL,gBAAM,MAAM,oBAAoB,OAAO,OAAO,OAAO;AAAA,QAAA;AAAA,MACvD,CACD;AAEM,aAAA,EAAE,OAAO,iBAAiB,SAAS;AAAA,aACnC,OAAY;AACb,YAAA,MAAM,oBAAoB,MAAM,OAAO;AAC7C,aAAO,EAAE,OAAO,IAAI,UAAU,CAAA,EAAG;AAAA,IAAA;AAAA,EAErC;AAEO,SAAA;AACT;"}
|
|
@@ -5,6 +5,15 @@ const FileUploadCard_styled = require("./FileUploadCard.styled.cjs.js");
|
|
|
5
5
|
const clsx = require("clsx");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
const FileUploadPreview = require("../FileUploadPreview/FileUploadPreview.cjs.js");
|
|
8
|
+
require("../../../../context/RemoteModulesContext.cjs.js");
|
|
9
|
+
const DetailsPanelContext = require("../../../../context/DetailsPanelContext.cjs.js");
|
|
10
|
+
require("../../../../context/ThumbnailUploaderContext.cjs.js");
|
|
11
|
+
require("../../../../context/SettingsPanelContext.cjs.js");
|
|
12
|
+
require("../../../../context/pip/PiPProvider.cjs.js");
|
|
13
|
+
require("react-dom");
|
|
14
|
+
require("../../../../context/pip/PiPWrapper.cjs.js");
|
|
15
|
+
require("../../../../context/AddonProjectContext.cjs.js");
|
|
16
|
+
require("../../../../context/AddonContext.cjs.js");
|
|
8
17
|
const fileIcons = {
|
|
9
18
|
// special cases
|
|
10
19
|
description: ["doc"],
|
|
@@ -60,31 +69,30 @@ const FileUploadCard = ({
|
|
|
60
69
|
name,
|
|
61
70
|
mime,
|
|
62
71
|
src,
|
|
63
|
-
|
|
72
|
+
isUnsavedAnnotation,
|
|
73
|
+
savedAnnotation,
|
|
64
74
|
size,
|
|
65
75
|
progress,
|
|
66
76
|
onRemove,
|
|
67
77
|
isCompact,
|
|
68
78
|
isDownloadable = false,
|
|
69
79
|
onExpand,
|
|
80
|
+
onJumpTo,
|
|
70
81
|
className,
|
|
71
82
|
...props
|
|
72
83
|
}) => {
|
|
73
84
|
const inProgress = progress && progress < 100;
|
|
74
85
|
const [imageError, setImageError] = React.useState(false);
|
|
86
|
+
const { feedAnnotationsEnabled } = DetailsPanelContext.useDetailsPanelContext();
|
|
75
87
|
const nameParts = name.split(".");
|
|
76
88
|
const extension = nameParts.pop() || "";
|
|
77
89
|
const fileName = nameParts.join(".");
|
|
78
90
|
const isPreviewable = FileUploadPreview.isFilePreviewable(mime || "." + extension);
|
|
79
|
-
const isImage = (mime == null ? void 0 : mime.includes("image/")) ||
|
|
91
|
+
const isImage = (mime == null ? void 0 : mime.includes("image/")) || isUnsavedAnnotation;
|
|
80
92
|
const downloadComponent = /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
|
|
81
93
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "size", children: ayonReactComponents.getFileSizeString(size) }),
|
|
82
94
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ayonReactComponents.Icon, { icon: "download", className: "download-icon" })
|
|
83
95
|
] });
|
|
84
|
-
const handleImageClick = () => {
|
|
85
|
-
if (!isPreviewable && !isAnnotation || !onExpand || imageError) return;
|
|
86
|
-
onExpand();
|
|
87
|
-
};
|
|
88
96
|
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
89
97
|
FileUploadCard_styled.File,
|
|
90
98
|
{
|
|
@@ -92,21 +100,23 @@ const FileUploadCard = ({
|
|
|
92
100
|
compact: isCompact,
|
|
93
101
|
isDownloadable,
|
|
94
102
|
isPreviewable,
|
|
95
|
-
|
|
103
|
+
isUnsavedAnnotation
|
|
96
104
|
}),
|
|
97
105
|
...props,
|
|
98
106
|
children: [
|
|
99
107
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
100
108
|
FileUploadCard_styled.ContentWrapper,
|
|
101
109
|
{
|
|
102
|
-
className: clsx("content-wrapper", { isPreviewable,
|
|
103
|
-
onClick: handleImageClick,
|
|
110
|
+
className: clsx("content-wrapper", { isPreviewable, isUnsavedAnnotation }),
|
|
104
111
|
children: [
|
|
105
112
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ayonReactComponents.Icon, { icon: getIconForType(mime || "." + extension), className: "type-icon" }),
|
|
106
113
|
isImage && src && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
107
114
|
FileUploadCard_styled.ImageWrapper,
|
|
108
115
|
{
|
|
109
|
-
className: clsx({
|
|
116
|
+
className: clsx({
|
|
117
|
+
"image-wrapper": true,
|
|
118
|
+
isDownloadable: isDownloadable || isPreviewable || isUnsavedAnnotation
|
|
119
|
+
}),
|
|
110
120
|
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
111
121
|
"img",
|
|
112
122
|
{
|
|
@@ -119,8 +129,26 @@ const FileUploadCard = ({
|
|
|
119
129
|
)
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(FileUploadCard_styled.Buttons, { className: "expand-buttons", children: [
|
|
133
|
+
isPreviewable && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
134
|
+
FileUploadCard_styled.ExpandButton,
|
|
135
|
+
{
|
|
136
|
+
"data-tooltip": "Open preview",
|
|
137
|
+
icon: "open_in_full",
|
|
138
|
+
variant: "nav",
|
|
139
|
+
onClick: onExpand
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
(isUnsavedAnnotation || feedAnnotationsEnabled && savedAnnotation) && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
143
|
+
FileUploadCard_styled.ExpandButton,
|
|
144
|
+
{
|
|
145
|
+
"data-tooltip": "Jump to annotation",
|
|
146
|
+
icon: "play_circle",
|
|
147
|
+
variant: "nav",
|
|
148
|
+
onClick: onJumpTo
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] })
|
|
124
152
|
]
|
|
125
153
|
}
|
|
126
154
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadCard.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.tsx"],"sourcesContent":["import { Button, getFileSizeString, Icon } from '@ynput/ayon-react-components'\nimport * as Styled from './FileUploadCard.styled'\nimport clsx from 'clsx'\nimport { useState } from 'react'\nimport { isFilePreviewable } from '../FileUploadPreview'\n\nexport interface FileUploadCardProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string\n mime?: string\n src?: string\n
|
|
1
|
+
{"version":3,"file":"FileUploadCard.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.tsx"],"sourcesContent":["import { Button, getFileSizeString, Icon } from '@ynput/ayon-react-components'\nimport * as Styled from './FileUploadCard.styled'\nimport clsx from 'clsx'\nimport { useState } from 'react'\nimport { isFilePreviewable } from '../FileUploadPreview'\nimport { SavedAnnotationMetadata } from '@shared/containers'\nimport { useDetailsPanelContext } from '@shared/context'\n\nexport interface FileUploadCardProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string\n mime?: string\n src?: string\n isUnsavedAnnotation?: boolean\n savedAnnotation: SavedAnnotationMetadata\n size: number\n progress: number\n onRemove?: () => void\n isCompact?: boolean\n isDownloadable?: boolean\n onExpand?: () => void\n onJumpTo?: () => void\n}\n\nconst fileIcons: { [key: string]: string[] } = {\n // special cases\n description: ['doc'],\n folder_zip: ['zip'],\n code_blocks: [\n 'json',\n 'javascript',\n 'python',\n 'html',\n 'css',\n '.py',\n '.js',\n '.html',\n '.css',\n '.json',\n '.ts',\n ],\n brush: ['.psd', '.ai', '.xd', '.sketch'],\n '3d_rotation': [\n '.mb',\n '.ma',\n '.c4d',\n '.blend',\n '.max',\n '.3ds',\n '.lwo',\n '.lws',\n '.lxo',\n '.hip',\n '.hda',\n ],\n theaters: ['.aep', '.tpl', '.clip', '.nk', '.fusion', '.prproj', '.spsm', '.drp'],\n picture_as_pdf: ['pdf', '.pdf'],\n // default\n image: ['image', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp'],\n videocam: ['video', '.mp4', '.mov', '.avi', '.mkv', '.webm', '.mxf'],\n business_center: ['application'],\n audio_file: ['audio'],\n text_snippet: ['text'],\n filter_none: ['sequence'],\n font_download: ['font'],\n deployed_code: ['model', '.obj', '.abc', '.stl', '.fbx', '.gltf', '.glb', '.usd'],\n}\n\nconst getIconForType = (type: string): string => {\n for (const [icon, keywords] of Object.entries(fileIcons)) {\n if (keywords.some((keyword) => type.includes(keyword))) {\n return icon\n }\n }\n return 'draft'\n}\n\nconst FileUploadCard = ({\n name,\n mime,\n src,\n isUnsavedAnnotation,\n savedAnnotation,\n size,\n progress,\n onRemove,\n isCompact,\n isDownloadable = false,\n onExpand,\n onJumpTo,\n className,\n ...props\n}: FileUploadCardProps) => {\n const inProgress = progress && progress < 100\n\n const [imageError, setImageError] = useState(false)\n const { feedAnnotationsEnabled } = useDetailsPanelContext()\n\n // split name and file extension\n const nameParts = name.split('.')\n const extension = nameParts.pop() || ''\n const fileName = nameParts.join('.')\n\n const isPreviewable = isFilePreviewable(mime || '.' + extension)\n const isImage = mime?.includes('image/') || isUnsavedAnnotation\n\n const downloadComponent = (\n <>\n <span className=\"size\">{getFileSizeString(size)}</span>\n <Icon icon=\"download\" className=\"download-icon\" />\n </>\n )\n\n return (\n <Styled.File\n className={clsx(className, {\n compact: isCompact,\n isDownloadable,\n isPreviewable,\n isUnsavedAnnotation,\n })}\n {...props}\n >\n <Styled.ContentWrapper\n className={clsx('content-wrapper', { isPreviewable, isUnsavedAnnotation })}\n >\n <Icon icon={getIconForType(mime || '.' + extension)} className=\"type-icon\" />\n {isImage && src && (\n <Styled.ImageWrapper\n className={clsx({\n 'image-wrapper': true,\n isDownloadable: isDownloadable || isPreviewable || isUnsavedAnnotation,\n })}\n >\n <img\n src={src}\n onError={() => setImageError(true)}\n style={{\n display: imageError ? 'none' : 'block',\n }}\n />\n </Styled.ImageWrapper>\n )}\n <Styled.Buttons className=\"expand-buttons\">\n {isPreviewable && (\n <Styled.ExpandButton\n data-tooltip=\"Open preview\"\n icon=\"open_in_full\"\n variant=\"nav\"\n onClick={onExpand}\n />\n )}\n {(isUnsavedAnnotation || (feedAnnotationsEnabled && savedAnnotation)) && (\n <Styled.ExpandButton\n data-tooltip=\"Jump to annotation\"\n icon=\"play_circle\"\n variant=\"nav\"\n onClick={onJumpTo}\n />\n )}\n </Styled.Buttons>\n </Styled.ContentWrapper>\n <Styled.Footer className={clsx({ inProgress, isPreviewable, isDownloadable })}>\n <span className=\"progress\" style={{ right: `${100 - progress}%` }} />\n <div className=\"name-wrapper\">\n <span className=\"name\">{fileName}</span>\n </div>\n <span className=\"extension\">.{extension}</span>\n {isDownloadable &&\n (!onRemove ? (\n <a href={src} download className=\"download\">\n {downloadComponent}\n </a>\n ) : (\n <div className=\"download\">{downloadComponent}</div>\n ))}\n </Styled.Footer>\n {onRemove && <Button className=\"remove\" onClick={onRemove} icon=\"close\" />}\n </Styled.File>\n )\n}\n\nexport default FileUploadCard\n"],"names":["useState","useDetailsPanelContext","isFilePreviewable","jsxs","Fragment","jsx","getFileSizeString","Icon","Styled.File","Styled.ContentWrapper","Styled.ImageWrapper","Styled.Buttons","Styled.ExpandButton","Styled.Footer","Button"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAM,YAAyC;AAAA;AAAA,EAE7C,aAAa,CAAC,KAAK;AAAA,EACnB,YAAY,CAAC,KAAK;AAAA,EAClB,aAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,OAAO,CAAC,QAAQ,OAAO,OAAO,SAAS;AAAA,EACvC,eAAe;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU,CAAC,QAAQ,QAAQ,SAAS,OAAO,WAAW,WAAW,SAAS,MAAM;AAAA,EAChF,gBAAgB,CAAC,OAAO,MAAM;AAAA;AAAA,EAE9B,OAAO,CAAC,SAAS,QAAQ,QAAQ,SAAS,QAAQ,QAAQ,OAAO;AAAA,EACjE,UAAU,CAAC,SAAS,QAAQ,QAAQ,QAAQ,QAAQ,SAAS,MAAM;AAAA,EACnE,iBAAiB,CAAC,aAAa;AAAA,EAC/B,YAAY,CAAC,OAAO;AAAA,EACpB,cAAc,CAAC,MAAM;AAAA,EACrB,aAAa,CAAC,UAAU;AAAA,E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DAACU,sBAAAA,QAAA,EAAc,WAAW,KAAK,EAAE,YAAY,eAAe,gBAAgB,GAC1E,UAAA;AAAA,UAACR,2BAAAA,kBAAAA,IAAA,QAAA,EAAK,WAAU,YAAW,OAAO,EAAE,OAAO,GAAG,MAAM,QAAQ,IAAO,EAAA,CAAA;AAAA,UACnEA,2BAAAA,kBAAAA,IAAC,SAAI,WAAU,gBACb,2DAAC,QAAK,EAAA,WAAU,QAAQ,UAAA,SAAA,CAAS,EACnC,CAAA;AAAA,UACAF,2BAAAA,kBAAAA,KAAC,QAAK,EAAA,WAAU,aAAY,UAAA;AAAA,YAAA;AAAA,YAAE;AAAA,UAAA,GAAU;AAAA,UACvC,mBACE,CAAC,WACCE,2BAAAA,kBAAAA,IAAA,KAAA,EAAE,MAAM,KAAK,UAAQ,MAAC,WAAU,YAC9B,UACH,mBAAA,qDAEC,OAAI,EAAA,WAAU,YAAY,UAAkB,mBAAA;AAAA,QAAA,GAEnD;AAAA,QACC,6DAAaS,oBAAO,QAAA,EAAA,WAAU,UAAS,SAAS,UAAU,MAAK,QAAQ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC1E;AAEJ;;"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../../../../_virtual/jsx-runtime.es.js";
|
|
2
2
|
import { getFileSizeString, Icon, Button } from "@ynput/ayon-react-components";
|
|
3
|
-
import { File, ContentWrapper, ImageWrapper, Footer } from "./FileUploadCard.styled.es.js";
|
|
3
|
+
import { File, ContentWrapper, ImageWrapper, Buttons, ExpandButton, Footer } from "./FileUploadCard.styled.es.js";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { isFilePreviewable } from "../FileUploadPreview/FileUploadPreview.es.js";
|
|
7
|
+
import "../../../../context/RemoteModulesContext.es.js";
|
|
8
|
+
import { useDetailsPanelContext } from "../../../../context/DetailsPanelContext.es.js";
|
|
9
|
+
import "../../../../context/ThumbnailUploaderContext.es.js";
|
|
10
|
+
import "../../../../context/SettingsPanelContext.es.js";
|
|
11
|
+
import "../../../../context/pip/PiPProvider.es.js";
|
|
12
|
+
import "react-dom";
|
|
13
|
+
import "../../../../context/pip/PiPWrapper.es.js";
|
|
14
|
+
import "../../../../context/AddonProjectContext.es.js";
|
|
15
|
+
import "../../../../context/AddonContext.es.js";
|
|
7
16
|
const fileIcons = {
|
|
8
17
|
// special cases
|
|
9
18
|
description: ["doc"],
|
|
@@ -59,31 +68,30 @@ const FileUploadCard = ({
|
|
|
59
68
|
name,
|
|
60
69
|
mime,
|
|
61
70
|
src,
|
|
62
|
-
|
|
71
|
+
isUnsavedAnnotation,
|
|
72
|
+
savedAnnotation,
|
|
63
73
|
size,
|
|
64
74
|
progress,
|
|
65
75
|
onRemove,
|
|
66
76
|
isCompact,
|
|
67
77
|
isDownloadable = false,
|
|
68
78
|
onExpand,
|
|
79
|
+
onJumpTo,
|
|
69
80
|
className,
|
|
70
81
|
...props
|
|
71
82
|
}) => {
|
|
72
83
|
const inProgress = progress && progress < 100;
|
|
73
84
|
const [imageError, setImageError] = useState(false);
|
|
85
|
+
const { feedAnnotationsEnabled } = useDetailsPanelContext();
|
|
74
86
|
const nameParts = name.split(".");
|
|
75
87
|
const extension = nameParts.pop() || "";
|
|
76
88
|
const fileName = nameParts.join(".");
|
|
77
89
|
const isPreviewable = isFilePreviewable(mime || "." + extension);
|
|
78
|
-
const isImage = (mime == null ? void 0 : mime.includes("image/")) ||
|
|
90
|
+
const isImage = (mime == null ? void 0 : mime.includes("image/")) || isUnsavedAnnotation;
|
|
79
91
|
const downloadComponent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
80
92
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "size", children: getFileSizeString(size) }),
|
|
81
93
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "download", className: "download-icon" })
|
|
82
94
|
] });
|
|
83
|
-
const handleImageClick = () => {
|
|
84
|
-
if (!isPreviewable && !isAnnotation || !onExpand || imageError) return;
|
|
85
|
-
onExpand();
|
|
86
|
-
};
|
|
87
95
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
88
96
|
File,
|
|
89
97
|
{
|
|
@@ -91,21 +99,23 @@ const FileUploadCard = ({
|
|
|
91
99
|
compact: isCompact,
|
|
92
100
|
isDownloadable,
|
|
93
101
|
isPreviewable,
|
|
94
|
-
|
|
102
|
+
isUnsavedAnnotation
|
|
95
103
|
}),
|
|
96
104
|
...props,
|
|
97
105
|
children: [
|
|
98
106
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
99
107
|
ContentWrapper,
|
|
100
108
|
{
|
|
101
|
-
className: clsx("content-wrapper", { isPreviewable,
|
|
102
|
-
onClick: handleImageClick,
|
|
109
|
+
className: clsx("content-wrapper", { isPreviewable, isUnsavedAnnotation }),
|
|
103
110
|
children: [
|
|
104
111
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: getIconForType(mime || "." + extension), className: "type-icon" }),
|
|
105
112
|
isImage && src && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106
113
|
ImageWrapper,
|
|
107
114
|
{
|
|
108
|
-
className: clsx({
|
|
115
|
+
className: clsx({
|
|
116
|
+
"image-wrapper": true,
|
|
117
|
+
isDownloadable: isDownloadable || isPreviewable || isUnsavedAnnotation
|
|
118
|
+
}),
|
|
109
119
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110
120
|
"img",
|
|
111
121
|
{
|
|
@@ -118,8 +128,26 @@ const FileUploadCard = ({
|
|
|
118
128
|
)
|
|
119
129
|
}
|
|
120
130
|
),
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Buttons, { className: "expand-buttons", children: [
|
|
132
|
+
isPreviewable && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
133
|
+
ExpandButton,
|
|
134
|
+
{
|
|
135
|
+
"data-tooltip": "Open preview",
|
|
136
|
+
icon: "open_in_full",
|
|
137
|
+
variant: "nav",
|
|
138
|
+
onClick: onExpand
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
(isUnsavedAnnotation || feedAnnotationsEnabled && savedAnnotation) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
142
|
+
ExpandButton,
|
|
143
|
+
{
|
|
144
|
+
"data-tooltip": "Jump to annotation",
|
|
145
|
+
icon: "play_circle",
|
|
146
|
+
variant: "nav",
|
|
147
|
+
onClick: onJumpTo
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] })
|
|
123
151
|
]
|
|
124
152
|
}
|
|
125
153
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadCard.es.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.tsx"],"sourcesContent":["import { Button, getFileSizeString, Icon } from '@ynput/ayon-react-components'\nimport * as Styled from './FileUploadCard.styled'\nimport clsx from 'clsx'\nimport { useState } from 'react'\nimport { isFilePreviewable } from '../FileUploadPreview'\n\nexport interface FileUploadCardProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string\n mime?: string\n src?: string\n
|
|
1
|
+
{"version":3,"file":"FileUploadCard.es.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.tsx"],"sourcesContent":["import { Button, getFileSizeString, Icon } from '@ynput/ayon-react-components'\nimport * as Styled from './FileUploadCard.styled'\nimport clsx from 'clsx'\nimport { useState } from 'react'\nimport { isFilePreviewable } from '../FileUploadPreview'\nimport { SavedAnnotationMetadata } from '@shared/containers'\nimport { useDetailsPanelContext } from '@shared/context'\n\nexport interface FileUploadCardProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string\n mime?: string\n src?: string\n isUnsavedAnnotation?: boolean\n savedAnnotation: SavedAnnotationMetadata\n size: number\n progress: number\n onRemove?: () => void\n isCompact?: boolean\n isDownloadable?: boolean\n onExpand?: () => void\n onJumpTo?: () => void\n}\n\nconst fileIcons: { [key: string]: string[] } = {\n // special cases\n description: ['doc'],\n folder_zip: ['zip'],\n code_blocks: [\n 'json',\n 'javascript',\n 'python',\n 'html',\n 'css',\n '.py',\n '.js',\n '.html',\n '.css',\n '.json',\n '.ts',\n ],\n brush: ['.psd', '.ai', '.xd', '.sketch'],\n '3d_rotation': [\n '.mb',\n '.ma',\n '.c4d',\n '.blend',\n '.max',\n '.3ds',\n '.lwo',\n '.lws',\n '.lxo',\n '.hip',\n '.hda',\n ],\n theaters: ['.aep', '.tpl', '.clip', '.nk', '.fusion', '.prproj', '.spsm', '.drp'],\n picture_as_pdf: ['pdf', '.pdf'],\n // default\n image: ['image', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp'],\n videocam: ['video', '.mp4', '.mov', '.avi', '.mkv', '.webm', '.mxf'],\n business_center: ['application'],\n audio_file: ['audio'],\n text_snippet: ['text'],\n filter_none: ['sequence'],\n font_download: ['font'],\n deployed_code: ['model', '.obj', '.abc', '.stl', '.fbx', '.gltf', '.glb', '.usd'],\n}\n\nconst getIconForType = (type: string): string => {\n for (const [icon, keywords] of Object.entries(fileIcons)) {\n if (keywords.some((keyword) => type.includes(keyword))) {\n return icon\n }\n }\n return 'draft'\n}\n\nconst FileUploadCard = ({\n name,\n mime,\n src,\n isUnsavedAnnotation,\n savedAnnotation,\n size,\n progress,\n onRemove,\n isCompact,\n isDownloadable = false,\n onExpand,\n onJumpTo,\n className,\n ...props\n}: FileUploadCardProps) => {\n const inProgress = progress && progress < 100\n\n const [imageError, setImageError] = useState(false)\n const { feedAnnotationsEnabled } = useDetailsPanelContext()\n\n // split name and file extension\n const nameParts = name.split('.')\n const extension = nameParts.pop() || ''\n const fileName = nameParts.join('.')\n\n const isPreviewable = isFilePreviewable(mime || '.' + extension)\n const isImage = mime?.includes('image/') || isUnsavedAnnotation\n\n const downloadComponent = (\n <>\n <span className=\"size\">{getFileSizeString(size)}</span>\n <Icon icon=\"download\" className=\"download-icon\" />\n </>\n )\n\n return (\n <Styled.File\n className={clsx(className, {\n compact: isCompact,\n isDownloadable,\n isPreviewable,\n isUnsavedAnnotation,\n })}\n {...props}\n >\n <Styled.ContentWrapper\n className={clsx('content-wrapper', { isPreviewable, isUnsavedAnnotation })}\n >\n <Icon icon={getIconForType(mime || '.' + extension)} className=\"type-icon\" />\n {isImage && src && (\n <Styled.ImageWrapper\n className={clsx({\n 'image-wrapper': true,\n isDownloadable: isDownloadable || isPreviewable || isUnsavedAnnotation,\n })}\n >\n <img\n src={src}\n onError={() => setImageError(true)}\n style={{\n display: imageError ? 'none' : 'block',\n }}\n />\n </Styled.ImageWrapper>\n )}\n <Styled.Buttons className=\"expand-buttons\">\n {isPreviewable && (\n <Styled.ExpandButton\n data-tooltip=\"Open preview\"\n icon=\"open_in_full\"\n variant=\"nav\"\n onClick={onExpand}\n />\n )}\n {(isUnsavedAnnotation || (feedAnnotationsEnabled && savedAnnotation)) && (\n <Styled.ExpandButton\n data-tooltip=\"Jump to annotation\"\n icon=\"play_circle\"\n variant=\"nav\"\n onClick={onJumpTo}\n />\n )}\n </Styled.Buttons>\n </Styled.ContentWrapper>\n <Styled.Footer className={clsx({ inProgress, isPreviewable, isDownloadable })}>\n <span className=\"progress\" style={{ right: `${100 - progress}%` }} />\n <div className=\"name-wrapper\">\n <span className=\"name\">{fileName}</span>\n </div>\n <span className=\"extension\">.{extension}</span>\n {isDownloadable &&\n (!onRemove ? (\n <a href={src} download className=\"download\">\n {downloadComponent}\n </a>\n ) : (\n <div className=\"download\">{downloadComponent}</div>\n ))}\n </Styled.Footer>\n {onRemove && <Button className=\"remove\" onClick={onRemove} icon=\"close\" />}\n </Styled.File>\n )\n}\n\nexport default FileUploadCard\n"],"names":["jsxs","Fragment","jsx","Styled.File","Styled.ContentWrapper","Styled.ImageWrapper","Styled.Buttons","Styled.ExpandButton","Styled.Footer"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAA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