@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.
Files changed (180) hide show
  1. package/dist/DetailsPanel.cjs.js +1 -0
  2. package/dist/DetailsPanel.cjs.js.map +1 -1
  3. package/dist/DetailsPanel.es.js +1 -0
  4. package/dist/DetailsPanel.es.js.map +1 -1
  5. package/dist/_virtual/index.cjs10.js +3 -5
  6. package/dist/_virtual/index.cjs10.js.map +1 -1
  7. package/dist/_virtual/index.cjs4.js +4 -4
  8. package/dist/_virtual/index.cjs5.js +4 -4
  9. package/dist/_virtual/index.cjs6.js +2 -2
  10. package/dist/_virtual/index.cjs7.js +5 -3
  11. package/dist/_virtual/index.cjs7.js.map +1 -1
  12. package/dist/_virtual/index.cjs8.js +4 -4
  13. package/dist/_virtual/index.cjs9.js +4 -4
  14. package/dist/_virtual/index.es10.js +2 -5
  15. package/dist/_virtual/index.es10.js.map +1 -1
  16. package/dist/_virtual/index.es4.js +4 -4
  17. package/dist/_virtual/index.es5.js +4 -4
  18. package/dist/_virtual/index.es6.js +2 -2
  19. package/dist/_virtual/index.es7.js +5 -2
  20. package/dist/_virtual/index.es7.js.map +1 -1
  21. package/dist/_virtual/index.es8.js +4 -4
  22. package/dist/_virtual/index.es9.js +4 -4
  23. package/dist/index.cjs.js +1 -0
  24. package/dist/index.cjs.js.map +1 -1
  25. package/dist/index.es.js +1 -0
  26. package/dist/index.es.js.map +1 -1
  27. package/dist/node_modules/match-sorter/dist/match-sorter.esm.cjs.js +1 -1
  28. package/dist/node_modules/match-sorter/dist/match-sorter.esm.es.js +1 -1
  29. package/dist/node_modules/parse-numeric-range/index.cjs.js +1 -1
  30. package/dist/node_modules/parse-numeric-range/index.es.js +1 -1
  31. package/dist/node_modules/rehype/node_modules/unified/lib/index.cjs.js +2 -2
  32. package/dist/node_modules/rehype/node_modules/unified/lib/index.es.js +2 -2
  33. package/dist/node_modules/rehype-parse/lib/index.cjs.js +1 -1
  34. package/dist/node_modules/rehype-parse/lib/index.es.js +1 -1
  35. package/dist/node_modules/rehype-prism-plus/dist/index.es.cjs.js +1 -1
  36. package/dist/node_modules/rehype-prism-plus/dist/index.es.es.js +1 -1
  37. package/dist/node_modules/remove-accents/index.cjs.js +1 -1
  38. package/dist/node_modules/remove-accents/index.es.js +1 -1
  39. package/dist/node_modules/vfile/lib/index.cjs.js +1 -1
  40. package/dist/node_modules/vfile/lib/index.es.js +1 -1
  41. package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.cjs.js +1 -0
  42. package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.cjs.js.map +1 -1
  43. package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.es.js +1 -0
  44. package/dist/shared/src/components/DetailsPanelAttributes/DetailsPanelAttributes.es.js.map +1 -1
  45. package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.cjs.js +1 -0
  46. package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.cjs.js.map +1 -1
  47. package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.es.js +1 -0
  48. package/dist/shared/src/components/EntityThumbnailUploader/EntityThumbnailUploader.es.js.map +1 -1
  49. package/dist/shared/src/components/ReviewablesList/ReviewablesList.cjs.js +1 -0
  50. package/dist/shared/src/components/ReviewablesList/ReviewablesList.cjs.js.map +1 -1
  51. package/dist/shared/src/components/ReviewablesList/ReviewablesList.es.js +1 -0
  52. package/dist/shared/src/components/ReviewablesList/ReviewablesList.es.js.map +1 -1
  53. package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.cjs.js +1 -0
  54. package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.cjs.js.map +1 -1
  55. package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.es.js +1 -0
  56. package/dist/shared/src/components/ReviewablesList/ReviewablesUpload.es.js.map +1 -1
  57. package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.cjs.js +1 -0
  58. package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.cjs.js.map +1 -1
  59. package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.es.js +1 -0
  60. package/dist/shared/src/components/ReviewablesList/SortableReviewableCard.es.js.map +1 -1
  61. package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.cjs.js +3 -2
  62. package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.cjs.js.map +1 -1
  63. package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.es.js +3 -2
  64. package/dist/shared/src/components/SimpleFormDialog/SimpleFormDialog.es.js.map +1 -1
  65. package/dist/shared/src/containers/Actions/ActionConfigDialog.cjs.js +1 -0
  66. package/dist/shared/src/containers/Actions/ActionConfigDialog.cjs.js.map +1 -1
  67. package/dist/shared/src/containers/Actions/ActionConfigDialog.es.js +1 -0
  68. package/dist/shared/src/containers/Actions/ActionConfigDialog.es.js.map +1 -1
  69. package/dist/shared/src/containers/Actions/Actions.cjs.js +6 -0
  70. package/dist/shared/src/containers/Actions/Actions.cjs.js.map +1 -1
  71. package/dist/shared/src/containers/Actions/Actions.es.js +6 -0
  72. package/dist/shared/src/containers/Actions/Actions.es.js.map +1 -1
  73. package/dist/shared/src/containers/Actions/InteractiveActionDialog.cjs.js +1 -0
  74. package/dist/shared/src/containers/Actions/InteractiveActionDialog.cjs.js.map +1 -1
  75. package/dist/shared/src/containers/Actions/InteractiveActionDialog.es.js +1 -0
  76. package/dist/shared/src/containers/Actions/InteractiveActionDialog.es.js.map +1 -1
  77. package/dist/shared/src/containers/DetailsPanel/DetailsPanel.cjs.js +1 -0
  78. package/dist/shared/src/containers/DetailsPanel/DetailsPanel.cjs.js.map +1 -1
  79. package/dist/shared/src/containers/DetailsPanel/DetailsPanel.es.js +1 -0
  80. package/dist/shared/src/containers/DetailsPanel/DetailsPanel.es.js.map +1 -1
  81. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.cjs.js +1 -0
  82. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.cjs.js.map +1 -1
  83. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.es.js +1 -0
  84. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.es.js.map +1 -1
  85. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.cjs.js +1 -0
  86. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.cjs.js.map +1 -1
  87. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.es.js +1 -0
  88. package/dist/shared/src/containers/DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.es.js.map +1 -1
  89. package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.cjs.js +1 -0
  90. package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.cjs.js.map +1 -1
  91. package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.es.js +1 -0
  92. package/dist/shared/src/containers/DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.es.js.map +1 -1
  93. package/dist/shared/src/containers/Feed/Feed.cjs.js +23 -2
  94. package/dist/shared/src/containers/Feed/Feed.cjs.js.map +1 -1
  95. package/dist/shared/src/containers/Feed/Feed.es.js +24 -3
  96. package/dist/shared/src/containers/Feed/Feed.es.js.map +1 -1
  97. package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.cjs.js +18 -0
  98. package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.cjs.js.map +1 -1
  99. package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.es.js +19 -1
  100. package/dist/shared/src/containers/Feed/components/ActivityComment/ActivityComment.es.js.map +1 -1
  101. package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js +7 -4
  102. package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js.map +1 -1
  103. package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js +7 -4
  104. package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js.map +1 -1
  105. package/dist/shared/src/containers/Feed/components/CommentInput/helpers.cjs.js.map +1 -1
  106. package/dist/shared/src/containers/Feed/components/CommentInput/helpers.es.js.map +1 -1
  107. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js +1 -1
  108. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.cjs.js.map +1 -1
  109. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js +1 -1
  110. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.es.js.map +1 -1
  111. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.cjs.js +27 -15
  112. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.cjs.js.map +1 -1
  113. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js +27 -15
  114. package/dist/shared/src/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.es.js.map +1 -1
  115. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js +40 -12
  116. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js.map +1 -1
  117. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js +41 -13
  118. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js.map +1 -1
  119. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js +33 -19
  120. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js.map +1 -1
  121. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js +33 -19
  122. package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js.map +1 -1
  123. package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.cjs.js +14 -12
  124. package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.cjs.js.map +1 -1
  125. package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.es.js +14 -12
  126. package/dist/shared/src/containers/Feed/components/FilesGrid/FilesGrid.es.js.map +1 -1
  127. package/dist/shared/src/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.cjs.js +8 -8
  128. package/dist/shared/src/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.es.js +8 -8
  129. package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.cjs.js +18 -0
  130. package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.cjs.js.map +1 -0
  131. package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.es.js +19 -0
  132. package/dist/shared/src/containers/Feed/helpers/mergeAnnotationAttachments.es.js.map +1 -0
  133. package/dist/shared/src/containers/Feed/hooks/useCommentMutations.cjs.js +12 -3
  134. package/dist/shared/src/containers/Feed/hooks/useCommentMutations.cjs.js.map +1 -1
  135. package/dist/shared/src/containers/Feed/hooks/useCommentMutations.es.js +12 -3
  136. package/dist/shared/src/containers/Feed/hooks/useCommentMutations.es.js.map +1 -1
  137. package/dist/shared/src/containers/Feed/hooks/useTransformActivities.cjs.js.map +1 -1
  138. package/dist/shared/src/containers/Feed/hooks/useTransformActivities.es.js.map +1 -1
  139. package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.cjs.js +6 -6
  140. package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.cjs.js.map +1 -1
  141. package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.es.js +6 -6
  142. package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTable.es.js.map +1 -1
  143. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js +1 -1
  144. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js.map +1 -1
  145. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js +1 -1
  146. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js.map +1 -1
  147. package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.cjs.js +20 -2
  148. package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.cjs.js.map +1 -1
  149. package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.es.js +20 -2
  150. package/dist/shared/src/containers/ProjectTreeTable/context/ColumnSettingsContext.es.js.map +1 -1
  151. package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.cjs.js +2 -6
  152. package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.cjs.js.map +1 -1
  153. package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.es.js +2 -6
  154. package/dist/shared/src/containers/ProjectTreeTable/widgets/ThumbnailWidget.es.js.map +1 -1
  155. package/dist/shared/src/containers/RepresentationsList/RepresentationsList.cjs.js +1 -0
  156. package/dist/shared/src/containers/RepresentationsList/RepresentationsList.cjs.js.map +1 -1
  157. package/dist/shared/src/containers/RepresentationsList/RepresentationsList.es.js +1 -0
  158. package/dist/shared/src/containers/RepresentationsList/RepresentationsList.es.js.map +1 -1
  159. package/dist/shared/src/context/DetailsPanelContext.cjs.js +4 -0
  160. package/dist/shared/src/context/DetailsPanelContext.cjs.js.map +1 -1
  161. package/dist/shared/src/context/DetailsPanelContext.es.js +4 -0
  162. package/dist/shared/src/context/DetailsPanelContext.es.js.map +1 -1
  163. package/dist/shared/src/hooks/useActionTriggers.cjs.js +75 -0
  164. package/dist/shared/src/hooks/useActionTriggers.cjs.js.map +1 -1
  165. package/dist/shared/src/hooks/useActionTriggers.es.js +75 -0
  166. package/dist/shared/src/hooks/useActionTriggers.es.js.map +1 -1
  167. package/dist/types/containers/Actions/Actions.d.ts +2 -1
  168. package/dist/types/containers/Feed/components/CommentInput/CommentInput.d.ts +1 -1
  169. package/dist/types/containers/Feed/components/CommentInput/helpers.d.ts +6 -1
  170. package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.d.ts +1 -1
  171. package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.d.ts +5 -1
  172. package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.d.ts +5 -2
  173. package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.styled.d.ts +4 -0
  174. package/dist/types/containers/Feed/components/FilesGrid/FilesGrid.d.ts +1 -1
  175. package/dist/types/containers/Feed/helpers/mergeAnnotationAttachments.d.ts +2 -0
  176. package/dist/types/containers/Feed/hooks/useCommentMutations.d.ts +1 -1
  177. package/dist/types/containers/Feed/index.d.ts +6 -0
  178. package/dist/types/context/DetailsPanelContext.d.ts +4 -0
  179. package/dist/types/hooks/useActionTriggers.d.ts +1 -0
  180. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ayonReactComponents = require("@ynput/ayon-react-components");
3
4
  const styled = require("styled-components");
4
5
  const File = styled.div`
5
6
  position: relative;
@@ -47,17 +48,6 @@ const File = styled.div`
47
48
  .download-icon {
48
49
  color: var(--md-sys-color-outline);
49
50
  }
50
-
51
- .expand-icon {
52
- pointer-events: none;
53
- position: absolute;
54
- /* center */
55
- left: 50%;
56
- bottom: calc(50% - 20px);
57
- transform: translate(-50%, -50%);
58
-
59
- display: none;
60
- }
61
51
  `;
62
52
  const Footer = styled.footer`
63
53
  background-color: var(--md-sys-color-surface-container-low);
@@ -171,20 +161,24 @@ const ContentWrapper = styled.div`
171
161
  }
172
162
 
173
163
  /* previewable styles (it can be expanded) */
174
- /* on hover it shows the expand icon */
164
+ /* on hover it shows the expand buttons */
175
165
  &.isPreviewable,
176
- &.isAnnotation {
166
+ &.isUnsavedAnnotation {
177
167
  cursor: pointer;
178
168
 
179
169
  &:hover {
180
- .expand-icon {
181
- display: block;
170
+ .expand-buttons {
171
+ display: flex;
182
172
  }
183
173
  .type-icon {
184
174
  display: none;
185
175
  }
186
176
  }
187
177
  }
178
+
179
+ &:hover .image-wrapper::after {
180
+ opacity: 0.8;
181
+ }
188
182
  `;
189
183
  const ImageWrapper = styled.div`
190
184
  position: absolute;
@@ -213,10 +207,6 @@ const ImageWrapper = styled.div`
213
207
 
214
208
  &.isDownloadable {
215
209
  &:hover {
216
- &::after {
217
- opacity: 0.8;
218
- }
219
-
220
210
  .icon {
221
211
  display: block;
222
212
  z-index: 10;
@@ -224,7 +214,31 @@ const ImageWrapper = styled.div`
224
214
  }
225
215
  }
226
216
  `;
217
+ const Buttons = styled.div`
218
+ display: none;
219
+ position: absolute;
220
+ left: 0;
221
+ top: 0;
222
+ transform: none;
223
+ height: calc(100% - 20px);
224
+ width: 100%;
225
+ gap: 0;
226
+ `;
227
+ const ExpandButton = styled(ayonReactComponents.Button)`
228
+ height: 100%;
229
+ width: 100%;
230
+ border: none;
231
+ opacity: 0.5;
232
+ transition: opacity 250ms;
233
+
234
+ &:hover {
235
+ background: none;
236
+ opacity: 1;
237
+ }
238
+ `;
239
+ exports.Buttons = Buttons;
227
240
  exports.ContentWrapper = ContentWrapper;
241
+ exports.ExpandButton = ExpandButton;
228
242
  exports.File = File;
229
243
  exports.Footer = Footer;
230
244
  exports.ImageWrapper = ImageWrapper;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadCard.styled.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.ts"],"sourcesContent":["import styled from 'styled-components'\n\nexport const File = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: var(--border-radius-m);\n overflow: hidden;\n background-color: var(--md-sys-color-surface-container-low);\n z-index: 0;\n user-select: none;\n\n height: 105px;\n\n &.compact {\n height: 75px;\n }\n\n .icon {\n font-size: 30px;\n }\n\n .remove {\n position: absolute;\n top: 2px;\n right: 2px;\n padding: 2px;\n\n &:hover {\n background-color: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n }\n\n .icon {\n font-size: 20px;\n }\n }\n\n /* move icon up slightly to center it */\n .type-icon {\n margin-top: -20px;\n }\n\n /* set download default color outline */\n .download,\n .download-icon {\n color: var(--md-sys-color-outline);\n }\n\n .expand-icon {\n pointer-events: none;\n position: absolute;\n /* center */\n left: 50%;\n bottom: calc(50% - 20px);\n transform: translate(-50%, -50%);\n\n display: none;\n }\n`\n\nexport const Footer = styled.footer`\n background-color: var(--md-sys-color-surface-container-low);\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 var(--padding-s);\n overflow: hidden;\n color: var(--md-sys-color-on-surface);\n\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n\n transition: padding 0.2s ease;\n\n span {\n font-size: 12px;\n }\n\n .name-wrapper {\n overflow: hidden;\n }\n\n .download {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n display: none;\n color: var(--md-sys-color-on-surface);\n }\n\n .name {\n position: relative;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n z-index: 20;\n display: inherit;\n }\n\n .extension {\n z-index: 20;\n min-width: fit-content;\n overflow: hidden;\n }\n\n .progress {\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-primary-container);\n z-index: 10;\n\n transition: right 0.3s;\n\n display: none;\n }\n\n &.inProgress {\n .progress {\n display: block;\n }\n }\n\n .download-icon {\n font-size: 20px;\n }\n\n &.isDownloadable {\n &:hover {\n cursor: pointer;\n\n padding: var(--padding-m) var(--padding-s);\n\n background-color: var(--md-sys-color-surface-container-low-hover);\n\n .download,\n .download-icon {\n color: var(--md-sys-color-on-surface);\n }\n\n /* reveal size and download */\n .download {\n display: flex;\n }\n .name-wrapper,\n .extension {\n display: none;\n }\n }\n }\n`\n\nexport const ContentWrapper = styled.div`\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n\n flex: 1;\n\n .icon {\n user-select: none;\n }\n\n .download-icon {\n display: none;\n }\n\n /* previewable styles (it can be expanded) */\n /* on hover it shows the expand icon */\n &.isPreviewable,\n &.isAnnotation {\n cursor: pointer;\n\n &:hover {\n .expand-icon {\n display: block;\n }\n .type-icon {\n display: none;\n }\n }\n }\n`\n\nexport const ImageWrapper = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n justify-content: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n img {\n position: absolute;\n max-height: 100%;\n max-width: 100%;\n object-fit: contain;\n height: calc(100% - 20px);\n\n transition: scale 0.2s ease;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-surface-container-lowest);\n opacity: 0;\n transition: opacity 0.1s ease;\n }\n\n &.isDownloadable {\n &:hover {\n &::after {\n opacity: 0.8;\n }\n\n .icon {\n display: block;\n z-index: 10;\n }\n }\n }\n`\n"],"names":[],"mappings":";;;AAEO,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DpB,MAAM,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FtB,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkC9B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;"}
1
+ {"version":3,"file":"FileUploadCard.styled.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.ts"],"sourcesContent":["import { Button } from '@ynput/ayon-react-components'\nimport styled from 'styled-components'\n\nexport const File = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: var(--border-radius-m);\n overflow: hidden;\n background-color: var(--md-sys-color-surface-container-low);\n z-index: 0;\n user-select: none;\n\n height: 105px;\n\n &.compact {\n height: 75px;\n }\n\n .icon {\n font-size: 30px;\n }\n\n .remove {\n position: absolute;\n top: 2px;\n right: 2px;\n padding: 2px;\n\n &:hover {\n background-color: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n }\n\n .icon {\n font-size: 20px;\n }\n }\n\n /* move icon up slightly to center it */\n .type-icon {\n margin-top: -20px;\n }\n\n /* set download default color outline */\n .download,\n .download-icon {\n color: var(--md-sys-color-outline);\n }\n`\n\nexport const Footer = styled.footer`\n background-color: var(--md-sys-color-surface-container-low);\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 var(--padding-s);\n overflow: hidden;\n color: var(--md-sys-color-on-surface);\n\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n\n transition: padding 0.2s ease;\n\n span {\n font-size: 12px;\n }\n\n .name-wrapper {\n overflow: hidden;\n }\n\n .download {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n display: none;\n color: var(--md-sys-color-on-surface);\n }\n\n .name {\n position: relative;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n z-index: 20;\n display: inherit;\n }\n\n .extension {\n z-index: 20;\n min-width: fit-content;\n overflow: hidden;\n }\n\n .progress {\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-primary-container);\n z-index: 10;\n\n transition: right 0.3s;\n\n display: none;\n }\n\n &.inProgress {\n .progress {\n display: block;\n }\n }\n\n .download-icon {\n font-size: 20px;\n }\n\n &.isDownloadable {\n &:hover {\n cursor: pointer;\n\n padding: var(--padding-m) var(--padding-s);\n\n background-color: var(--md-sys-color-surface-container-low-hover);\n\n .download,\n .download-icon {\n color: var(--md-sys-color-on-surface);\n }\n\n /* reveal size and download */\n .download {\n display: flex;\n }\n .name-wrapper,\n .extension {\n display: none;\n }\n }\n }\n`\n\nexport const ContentWrapper = styled.div`\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n\n flex: 1;\n\n .icon {\n user-select: none;\n }\n\n .download-icon {\n display: none;\n }\n\n /* previewable styles (it can be expanded) */\n /* on hover it shows the expand buttons */\n &.isPreviewable,\n &.isUnsavedAnnotation {\n cursor: pointer;\n\n &:hover {\n .expand-buttons {\n display: flex;\n }\n .type-icon {\n display: none;\n }\n }\n }\n\n &:hover .image-wrapper::after {\n opacity: 0.8;\n }\n`\n\nexport const ImageWrapper = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n justify-content: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n img {\n position: absolute;\n max-height: 100%;\n max-width: 100%;\n object-fit: contain;\n height: calc(100% - 20px);\n\n transition: scale 0.2s ease;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-surface-container-lowest);\n opacity: 0;\n transition: opacity 0.1s ease;\n }\n\n &.isDownloadable {\n &:hover {\n .icon {\n display: block;\n z-index: 10;\n }\n }\n }\n`\n\nexport const Buttons = styled.div`\n display: none;\n position: absolute;\n left: 0;\n top: 0;\n transform: none;\n height: calc(100% - 20px);\n width: 100%;\n gap: 0;\n`\n\nexport const ExpandButton = styled(Button)`\n height: 100%;\n width: 100%;\n border: none;\n opacity: 0.5;\n transition: opacity 250ms;\n\n &:hover {\n background: none;\n opacity: 1;\n }\n`\n"],"names":["Button"],"mappings":";;;;AAGO,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDpB,MAAM,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FtB,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsC9B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmC5B,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWjB,MAAA,eAAe,OAAOA,0BAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import { Button } from "@ynput/ayon-react-components";
1
2
  import styled from "styled-components";
2
3
  const File = styled.div`
3
4
  position: relative;
@@ -45,17 +46,6 @@ const File = styled.div`
45
46
  .download-icon {
46
47
  color: var(--md-sys-color-outline);
47
48
  }
48
-
49
- .expand-icon {
50
- pointer-events: none;
51
- position: absolute;
52
- /* center */
53
- left: 50%;
54
- bottom: calc(50% - 20px);
55
- transform: translate(-50%, -50%);
56
-
57
- display: none;
58
- }
59
49
  `;
60
50
  const Footer = styled.footer`
61
51
  background-color: var(--md-sys-color-surface-container-low);
@@ -169,20 +159,24 @@ const ContentWrapper = styled.div`
169
159
  }
170
160
 
171
161
  /* previewable styles (it can be expanded) */
172
- /* on hover it shows the expand icon */
162
+ /* on hover it shows the expand buttons */
173
163
  &.isPreviewable,
174
- &.isAnnotation {
164
+ &.isUnsavedAnnotation {
175
165
  cursor: pointer;
176
166
 
177
167
  &:hover {
178
- .expand-icon {
179
- display: block;
168
+ .expand-buttons {
169
+ display: flex;
180
170
  }
181
171
  .type-icon {
182
172
  display: none;
183
173
  }
184
174
  }
185
175
  }
176
+
177
+ &:hover .image-wrapper::after {
178
+ opacity: 0.8;
179
+ }
186
180
  `;
187
181
  const ImageWrapper = styled.div`
188
182
  position: absolute;
@@ -211,10 +205,6 @@ const ImageWrapper = styled.div`
211
205
 
212
206
  &.isDownloadable {
213
207
  &:hover {
214
- &::after {
215
- opacity: 0.8;
216
- }
217
-
218
208
  .icon {
219
209
  display: block;
220
210
  z-index: 10;
@@ -222,8 +212,32 @@ const ImageWrapper = styled.div`
222
212
  }
223
213
  }
224
214
  `;
215
+ const Buttons = styled.div`
216
+ display: none;
217
+ position: absolute;
218
+ left: 0;
219
+ top: 0;
220
+ transform: none;
221
+ height: calc(100% - 20px);
222
+ width: 100%;
223
+ gap: 0;
224
+ `;
225
+ const ExpandButton = styled(Button)`
226
+ height: 100%;
227
+ width: 100%;
228
+ border: none;
229
+ opacity: 0.5;
230
+ transition: opacity 250ms;
231
+
232
+ &:hover {
233
+ background: none;
234
+ opacity: 1;
235
+ }
236
+ `;
225
237
  export {
238
+ Buttons,
226
239
  ContentWrapper,
240
+ ExpandButton,
227
241
  File,
228
242
  Footer,
229
243
  ImageWrapper
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadCard.styled.es.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.ts"],"sourcesContent":["import styled from 'styled-components'\n\nexport const File = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: var(--border-radius-m);\n overflow: hidden;\n background-color: var(--md-sys-color-surface-container-low);\n z-index: 0;\n user-select: none;\n\n height: 105px;\n\n &.compact {\n height: 75px;\n }\n\n .icon {\n font-size: 30px;\n }\n\n .remove {\n position: absolute;\n top: 2px;\n right: 2px;\n padding: 2px;\n\n &:hover {\n background-color: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n }\n\n .icon {\n font-size: 20px;\n }\n }\n\n /* move icon up slightly to center it */\n .type-icon {\n margin-top: -20px;\n }\n\n /* set download default color outline */\n .download,\n .download-icon {\n color: var(--md-sys-color-outline);\n }\n\n .expand-icon {\n pointer-events: none;\n position: absolute;\n /* center */\n left: 50%;\n bottom: calc(50% - 20px);\n transform: translate(-50%, -50%);\n\n display: none;\n }\n`\n\nexport const Footer = styled.footer`\n background-color: var(--md-sys-color-surface-container-low);\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 var(--padding-s);\n overflow: hidden;\n color: var(--md-sys-color-on-surface);\n\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n\n transition: padding 0.2s ease;\n\n span {\n font-size: 12px;\n }\n\n .name-wrapper {\n overflow: hidden;\n }\n\n .download {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n display: none;\n color: var(--md-sys-color-on-surface);\n }\n\n .name {\n position: relative;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n z-index: 20;\n display: inherit;\n }\n\n .extension {\n z-index: 20;\n min-width: fit-content;\n overflow: hidden;\n }\n\n .progress {\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-primary-container);\n z-index: 10;\n\n transition: right 0.3s;\n\n display: none;\n }\n\n &.inProgress {\n .progress {\n display: block;\n }\n }\n\n .download-icon {\n font-size: 20px;\n }\n\n &.isDownloadable {\n &:hover {\n cursor: pointer;\n\n padding: var(--padding-m) var(--padding-s);\n\n background-color: var(--md-sys-color-surface-container-low-hover);\n\n .download,\n .download-icon {\n color: var(--md-sys-color-on-surface);\n }\n\n /* reveal size and download */\n .download {\n display: flex;\n }\n .name-wrapper,\n .extension {\n display: none;\n }\n }\n }\n`\n\nexport const ContentWrapper = styled.div`\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n\n flex: 1;\n\n .icon {\n user-select: none;\n }\n\n .download-icon {\n display: none;\n }\n\n /* previewable styles (it can be expanded) */\n /* on hover it shows the expand icon */\n &.isPreviewable,\n &.isAnnotation {\n cursor: pointer;\n\n &:hover {\n .expand-icon {\n display: block;\n }\n .type-icon {\n display: none;\n }\n }\n }\n`\n\nexport const ImageWrapper = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n justify-content: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n img {\n position: absolute;\n max-height: 100%;\n max-width: 100%;\n object-fit: contain;\n height: calc(100% - 20px);\n\n transition: scale 0.2s ease;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-surface-container-lowest);\n opacity: 0;\n transition: opacity 0.1s ease;\n }\n\n &.isDownloadable {\n &:hover {\n &::after {\n opacity: 0.8;\n }\n\n .icon {\n display: block;\n z-index: 10;\n }\n }\n }\n`\n"],"names":[],"mappings":";AAEO,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DpB,MAAM,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FtB,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkC9B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"FileUploadCard.styled.es.js","sources":["../../../../../../../src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.ts"],"sourcesContent":["import { Button } from '@ynput/ayon-react-components'\nimport styled from 'styled-components'\n\nexport const File = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: var(--border-radius-m);\n overflow: hidden;\n background-color: var(--md-sys-color-surface-container-low);\n z-index: 0;\n user-select: none;\n\n height: 105px;\n\n &.compact {\n height: 75px;\n }\n\n .icon {\n font-size: 30px;\n }\n\n .remove {\n position: absolute;\n top: 2px;\n right: 2px;\n padding: 2px;\n\n &:hover {\n background-color: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n }\n\n .icon {\n font-size: 20px;\n }\n }\n\n /* move icon up slightly to center it */\n .type-icon {\n margin-top: -20px;\n }\n\n /* set download default color outline */\n .download,\n .download-icon {\n color: var(--md-sys-color-outline);\n }\n`\n\nexport const Footer = styled.footer`\n background-color: var(--md-sys-color-surface-container-low);\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 var(--padding-s);\n overflow: hidden;\n color: var(--md-sys-color-on-surface);\n\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n\n transition: padding 0.2s ease;\n\n span {\n font-size: 12px;\n }\n\n .name-wrapper {\n overflow: hidden;\n }\n\n .download {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n display: none;\n color: var(--md-sys-color-on-surface);\n }\n\n .name {\n position: relative;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n z-index: 20;\n display: inherit;\n }\n\n .extension {\n z-index: 20;\n min-width: fit-content;\n overflow: hidden;\n }\n\n .progress {\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-primary-container);\n z-index: 10;\n\n transition: right 0.3s;\n\n display: none;\n }\n\n &.inProgress {\n .progress {\n display: block;\n }\n }\n\n .download-icon {\n font-size: 20px;\n }\n\n &.isDownloadable {\n &:hover {\n cursor: pointer;\n\n padding: var(--padding-m) var(--padding-s);\n\n background-color: var(--md-sys-color-surface-container-low-hover);\n\n .download,\n .download-icon {\n color: var(--md-sys-color-on-surface);\n }\n\n /* reveal size and download */\n .download {\n display: flex;\n }\n .name-wrapper,\n .extension {\n display: none;\n }\n }\n }\n`\n\nexport const ContentWrapper = styled.div`\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n\n flex: 1;\n\n .icon {\n user-select: none;\n }\n\n .download-icon {\n display: none;\n }\n\n /* previewable styles (it can be expanded) */\n /* on hover it shows the expand buttons */\n &.isPreviewable,\n &.isUnsavedAnnotation {\n cursor: pointer;\n\n &:hover {\n .expand-buttons {\n display: flex;\n }\n .type-icon {\n display: none;\n }\n }\n }\n\n &:hover .image-wrapper::after {\n opacity: 0.8;\n }\n`\n\nexport const ImageWrapper = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n justify-content: center;\n background-color: var(--md-sys-color-surface-container-lowest);\n img {\n position: absolute;\n max-height: 100%;\n max-width: 100%;\n object-fit: contain;\n height: calc(100% - 20px);\n\n transition: scale 0.2s ease;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--md-sys-color-surface-container-lowest);\n opacity: 0;\n transition: opacity 0.1s ease;\n }\n\n &.isDownloadable {\n &:hover {\n .icon {\n display: block;\n z-index: 10;\n }\n }\n }\n`\n\nexport const Buttons = styled.div`\n display: none;\n position: absolute;\n left: 0;\n top: 0;\n transform: none;\n height: calc(100% - 20px);\n width: 100%;\n gap: 0;\n`\n\nexport const ExpandButton = styled(Button)`\n height: 100%;\n width: 100%;\n border: none;\n opacity: 0.5;\n transition: opacity 250ms;\n\n &:hover {\n background: none;\n opacity: 1;\n }\n`\n"],"names":[],"mappings":";;AAGO,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDpB,MAAM,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FtB,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsC9B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmC5B,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWjB,MAAA,eAAe,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -4,6 +4,7 @@ const FilesGrid_styled = require("./FilesGrid.styled.cjs.js");
4
4
  const clsx = require("clsx");
5
5
  const FileUploadCard = require("../FileUploadCard/FileUploadCard.cjs.js");
6
6
  const FileUploadPreview = require("../FileUploadPreview/FileUploadPreview.cjs.js");
7
+ const React = require("react");
7
8
  const FilesGrid = ({
8
9
  files = [],
9
10
  activityId,
@@ -16,15 +17,14 @@ const FilesGrid = ({
16
17
  ...props
17
18
  }) => {
18
19
  if (!files.length) return null;
19
- const handleExpand = (file, index) => {
20
- if (file.isAnnotation) {
21
- onAnnotationClick == null ? void 0 : onAnnotationClick(file);
22
- } else {
23
- const filteredFiles = files.filter((file2) => FileUploadPreview.isFilePreviewable(file2.mime, file2.ext));
24
- const updatedIndex = filteredFiles.findIndex((file2) => file2.id === files[index].id);
20
+ const handleExpand = React.useCallback(
21
+ (index) => {
22
+ const filteredFiles = files.filter((file) => FileUploadPreview.isFilePreviewable(file.mime, file.ext));
23
+ const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id);
25
24
  onExpand == null ? void 0 : onExpand({ files: filteredFiles, index: updatedIndex, activityId: activityId || "" });
26
- }
27
- };
25
+ },
26
+ [onExpand]
27
+ );
28
28
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FilesGrid_styled.Grid, { className: clsx({ compact: isCompact }), ...props, children: files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
29
29
  FileUploadCard,
30
30
  {
@@ -32,13 +32,15 @@ const FilesGrid = ({
32
32
  name: file.name,
33
33
  mime: file.mime || file.type,
34
34
  size: file.size,
35
- src: file.isAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`,
36
- isAnnotation: file.isAnnotation,
35
+ src: file.isUnsavedAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`,
36
+ isUnsavedAnnotation: file.isUnsavedAnnotation,
37
+ savedAnnotation: file.annotation,
37
38
  progress: file.progress,
38
- onRemove: onRemove ? () => onRemove(file.id, file.name, file.isAnnotation) : void 0,
39
+ onRemove: onRemove ? () => onRemove(file.id, file.name, file.isUnsavedAnnotation) : void 0,
39
40
  isCompact,
40
41
  isDownloadable,
41
- onExpand: () => handleExpand(file, index)
42
+ onExpand: () => handleExpand(index),
43
+ onJumpTo: () => onAnnotationClick == null ? void 0 : onAnnotationClick(file)
42
44
  },
43
45
  index
44
46
  )) });
@@ -1 +1 @@
1
- {"version":3,"file":"FilesGrid.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FilesGrid/FilesGrid.tsx"],"sourcesContent":["import * as Styled from './FilesGrid.styled'\nimport clsx from 'clsx'\nimport FileUploadCard from '../FileUploadCard'\nimport { isFilePreviewable } from '../FileUploadPreview'\n\nexport interface FilesGridProps {\n files?: any[]\n activityId?: string\n isCompact?: boolean\n onRemove?: (id: string, name: string, isAnnotation: boolean) => void\n projectName: string\n isDownloadable?: boolean\n onExpand?: (data: { files: any[]; index: number; activityId: string }) => void\n onAnnotationClick?: (file: any) => void\n [key: string]: any\n}\n\nconst FilesGrid: React.FC<FilesGridProps> = ({\n files = [],\n activityId,\n isCompact,\n onRemove,\n projectName,\n isDownloadable,\n onExpand,\n onAnnotationClick,\n ...props\n}) => {\n if (!files.length) return null\n\n const handleExpand = (file: any, index: number) => {\n if (file.isAnnotation) {\n onAnnotationClick?.(file)\n } else {\n const filteredFiles = files.filter((file) => isFilePreviewable(file.mime, file.ext))\n const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id)\n onExpand?.({ files: filteredFiles, index: updatedIndex, activityId: activityId || '' })\n }\n }\n\n return (\n <Styled.Grid className={clsx({ compact: isCompact })} {...props}>\n {files.map((file, index) => (\n <FileUploadCard\n key={index}\n id={file.id || file.name}\n name={file.name}\n mime={file.mime || file.type}\n size={file.size}\n src={file.isAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`}\n isAnnotation={file.isAnnotation}\n progress={file.progress}\n onRemove={onRemove ? () => onRemove(file.id, file.name, file.isAnnotation) : undefined}\n isCompact={isCompact}\n isDownloadable={isDownloadable}\n onExpand={() => handleExpand(file, index)}\n />\n ))}\n </Styled.Grid>\n )\n}\n\nexport default FilesGrid\n"],"names":["file","isFilePreviewable","Styled.Grid","jsx"],"mappings":";;;;;;AAiBA,MAAM,YAAsC,CAAC;AAAA,EAC3C,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACA,MAAA,CAAC,MAAM,OAAe,QAAA;AAEpB,QAAA,eAAe,CAAC,MAAW,UAAkB;AACjD,QAAI,KAAK,cAAc;AACrB,6DAAoB;AAAA,IAAI,OACnB;AACC,YAAA,gBAAgB,MAAM,OAAO,CAACA,UAASC,oCAAkBD,MAAK,MAAMA,MAAK,GAAG,CAAC;AAC7E,YAAA,eAAe,cAAc,UAAU,CAACA,UAASA,MAAK,OAAO,MAAM,KAAK,EAAE,EAAE;AACvE,2CAAA,EAAE,OAAO,eAAe,OAAO,cAAc,YAAY,cAAc;IAAI;AAAA,EAE1F;AAEA,0DACGE,iBAAAA,MAAA,EAAY,WAAW,KAAK,EAAE,SAAS,UAAU,CAAC,GAAI,GAAG,OACvD,gBAAM,IAAI,CAAC,MAAM,UAChBC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,IAAI,KAAK,MAAM,KAAK;AAAA,MACpB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK,QAAQ,KAAK;AAAA,MACxB,MAAM,KAAK;AAAA,MACX,KAAK,KAAK,eAAe,KAAK,YAAY,iBAAiB,WAAW,UAAU,KAAK,EAAE;AAAA,MACvF,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,UAAU,WAAW,MAAM,SAAS,KAAK,IAAI,KAAK,MAAM,KAAK,YAAY,IAAI;AAAA,MAC7E;AAAA,MACA;AAAA,MACA,UAAU,MAAM,aAAa,MAAM,KAAK;AAAA,IAAA;AAAA,IAXnC;AAAA,EAaR,CAAA,GACH;AAEJ;;"}
1
+ {"version":3,"file":"FilesGrid.cjs.js","sources":["../../../../../../../src/containers/Feed/components/FilesGrid/FilesGrid.tsx"],"sourcesContent":["import * as Styled from './FilesGrid.styled'\nimport clsx from 'clsx'\nimport FileUploadCard from '../FileUploadCard'\nimport { isFilePreviewable } from '../FileUploadPreview'\nimport { useCallback } from 'react'\n\nexport interface FilesGridProps {\n files?: any[]\n activityId?: string\n isCompact?: boolean\n onRemove?: (id: string, name: string, isUnsavedAnnotation: boolean) => void\n projectName: string\n isDownloadable?: boolean\n onExpand?: (data: { files: any[]; index: number; activityId: string }) => void\n onAnnotationClick?: (file: any) => void\n [key: string]: any\n}\n\nconst FilesGrid: React.FC<FilesGridProps> = ({\n files = [],\n activityId,\n isCompact,\n onRemove,\n projectName,\n isDownloadable,\n onExpand,\n onAnnotationClick,\n ...props\n}) => {\n if (!files.length) return null\n\n const handleExpand = useCallback(\n (index: number) => {\n const filteredFiles = files.filter((file) => isFilePreviewable(file.mime, file.ext))\n const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id)\n onExpand?.({ files: filteredFiles, index: updatedIndex, activityId: activityId || '' })\n },\n [onExpand],\n )\n\n return (\n <Styled.Grid className={clsx({ compact: isCompact })} {...props}>\n {files.map((file, index) => (\n <FileUploadCard\n key={index}\n id={file.id || file.name}\n name={file.name}\n mime={file.mime || file.type}\n size={file.size}\n src={\n file.isUnsavedAnnotation\n ? file.thumbnail\n : `/api/projects/${projectName}/files/${file.id}`\n }\n isUnsavedAnnotation={file.isUnsavedAnnotation}\n savedAnnotation={file.annotation}\n progress={file.progress}\n onRemove={\n onRemove ? () => onRemove(file.id, file.name, file.isUnsavedAnnotation) : undefined\n }\n isCompact={isCompact}\n isDownloadable={isDownloadable}\n onExpand={() => handleExpand(index)}\n onJumpTo={() => onAnnotationClick?.(file)}\n />\n ))}\n </Styled.Grid>\n )\n}\n\nexport default FilesGrid\n"],"names":["useCallback","isFilePreviewable","Styled.Grid","jsx"],"mappings":";;;;;;;AAkBA,MAAM,YAAsC,CAAC;AAAA,EAC3C,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACA,MAAA,CAAC,MAAM,OAAe,QAAA;AAE1B,QAAM,eAAeA,MAAA;AAAA,IACnB,CAAC,UAAkB;AACX,YAAA,gBAAgB,MAAM,OAAO,CAAC,SAASC,oCAAkB,KAAK,MAAM,KAAK,GAAG,CAAC;AAC7E,YAAA,eAAe,cAAc,UAAU,CAAC,SAAS,KAAK,OAAO,MAAM,KAAK,EAAE,EAAE;AACvE,2CAAA,EAAE,OAAO,eAAe,OAAO,cAAc,YAAY,cAAc;IACpF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,0DACGC,iBAAAA,MAAA,EAAY,WAAW,KAAK,EAAE,SAAS,UAAU,CAAC,GAAI,GAAG,OACvD,gBAAM,IAAI,CAAC,MAAM,UAChBC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,IAAI,KAAK,MAAM,KAAK;AAAA,MACpB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK,QAAQ,KAAK;AAAA,MACxB,MAAM,KAAK;AAAA,MACX,KACE,KAAK,sBACD,KAAK,YACL,iBAAiB,WAAW,UAAU,KAAK,EAAE;AAAA,MAEnD,qBAAqB,KAAK;AAAA,MAC1B,iBAAiB,KAAK;AAAA,MACtB,UAAU,KAAK;AAAA,MACf,UACE,WAAW,MAAM,SAAS,KAAK,IAAI,KAAK,MAAM,KAAK,mBAAmB,IAAI;AAAA,MAE5E;AAAA,MACA;AAAA,MACA,UAAU,MAAM,aAAa,KAAK;AAAA,MAClC,UAAU,MAAM,uDAAoB;AAAA,IAAI;AAAA,IAnBnC;AAAA,EAqBR,CAAA,GACH;AAEJ;;"}
@@ -3,6 +3,7 @@ import { Grid } from "./FilesGrid.styled.es.js";
3
3
  import clsx from "clsx";
4
4
  import FileUploadCard from "../FileUploadCard/FileUploadCard.es.js";
5
5
  import { isFilePreviewable } from "../FileUploadPreview/FileUploadPreview.es.js";
6
+ import { useCallback } from "react";
6
7
  const FilesGrid = ({
7
8
  files = [],
8
9
  activityId,
@@ -15,15 +16,14 @@ const FilesGrid = ({
15
16
  ...props
16
17
  }) => {
17
18
  if (!files.length) return null;
18
- const handleExpand = (file, index) => {
19
- if (file.isAnnotation) {
20
- onAnnotationClick == null ? void 0 : onAnnotationClick(file);
21
- } else {
22
- const filteredFiles = files.filter((file2) => isFilePreviewable(file2.mime, file2.ext));
23
- const updatedIndex = filteredFiles.findIndex((file2) => file2.id === files[index].id);
19
+ const handleExpand = useCallback(
20
+ (index) => {
21
+ const filteredFiles = files.filter((file) => isFilePreviewable(file.mime, file.ext));
22
+ const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id);
24
23
  onExpand == null ? void 0 : onExpand({ files: filteredFiles, index: updatedIndex, activityId: activityId || "" });
25
- }
26
- };
24
+ },
25
+ [onExpand]
26
+ );
27
27
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { className: clsx({ compact: isCompact }), ...props, children: files.map((file, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(
28
28
  FileUploadCard,
29
29
  {
@@ -31,13 +31,15 @@ const FilesGrid = ({
31
31
  name: file.name,
32
32
  mime: file.mime || file.type,
33
33
  size: file.size,
34
- src: file.isAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`,
35
- isAnnotation: file.isAnnotation,
34
+ src: file.isUnsavedAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`,
35
+ isUnsavedAnnotation: file.isUnsavedAnnotation,
36
+ savedAnnotation: file.annotation,
36
37
  progress: file.progress,
37
- onRemove: onRemove ? () => onRemove(file.id, file.name, file.isAnnotation) : void 0,
38
+ onRemove: onRemove ? () => onRemove(file.id, file.name, file.isUnsavedAnnotation) : void 0,
38
39
  isCompact,
39
40
  isDownloadable,
40
- onExpand: () => handleExpand(file, index)
41
+ onExpand: () => handleExpand(index),
42
+ onJumpTo: () => onAnnotationClick == null ? void 0 : onAnnotationClick(file)
41
43
  },
42
44
  index
43
45
  )) });
@@ -1 +1 @@
1
- {"version":3,"file":"FilesGrid.es.js","sources":["../../../../../../../src/containers/Feed/components/FilesGrid/FilesGrid.tsx"],"sourcesContent":["import * as Styled from './FilesGrid.styled'\nimport clsx from 'clsx'\nimport FileUploadCard from '../FileUploadCard'\nimport { isFilePreviewable } from '../FileUploadPreview'\n\nexport interface FilesGridProps {\n files?: any[]\n activityId?: string\n isCompact?: boolean\n onRemove?: (id: string, name: string, isAnnotation: boolean) => void\n projectName: string\n isDownloadable?: boolean\n onExpand?: (data: { files: any[]; index: number; activityId: string }) => void\n onAnnotationClick?: (file: any) => void\n [key: string]: any\n}\n\nconst FilesGrid: React.FC<FilesGridProps> = ({\n files = [],\n activityId,\n isCompact,\n onRemove,\n projectName,\n isDownloadable,\n onExpand,\n onAnnotationClick,\n ...props\n}) => {\n if (!files.length) return null\n\n const handleExpand = (file: any, index: number) => {\n if (file.isAnnotation) {\n onAnnotationClick?.(file)\n } else {\n const filteredFiles = files.filter((file) => isFilePreviewable(file.mime, file.ext))\n const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id)\n onExpand?.({ files: filteredFiles, index: updatedIndex, activityId: activityId || '' })\n }\n }\n\n return (\n <Styled.Grid className={clsx({ compact: isCompact })} {...props}>\n {files.map((file, index) => (\n <FileUploadCard\n key={index}\n id={file.id || file.name}\n name={file.name}\n mime={file.mime || file.type}\n size={file.size}\n src={file.isAnnotation ? file.thumbnail : `/api/projects/${projectName}/files/${file.id}`}\n isAnnotation={file.isAnnotation}\n progress={file.progress}\n onRemove={onRemove ? () => onRemove(file.id, file.name, file.isAnnotation) : undefined}\n isCompact={isCompact}\n isDownloadable={isDownloadable}\n onExpand={() => handleExpand(file, index)}\n />\n ))}\n </Styled.Grid>\n )\n}\n\nexport default FilesGrid\n"],"names":["file","Styled.Grid","jsx"],"mappings":";;;;;AAiBA,MAAM,YAAsC,CAAC;AAAA,EAC3C,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACA,MAAA,CAAC,MAAM,OAAe,QAAA;AAEpB,QAAA,eAAe,CAAC,MAAW,UAAkB;AACjD,QAAI,KAAK,cAAc;AACrB,6DAAoB;AAAA,IAAI,OACnB;AACC,YAAA,gBAAgB,MAAM,OAAO,CAACA,UAAS,kBAAkBA,MAAK,MAAMA,MAAK,GAAG,CAAC;AAC7E,YAAA,eAAe,cAAc,UAAU,CAACA,UAASA,MAAK,OAAO,MAAM,KAAK,EAAE,EAAE;AACvE,2CAAA,EAAE,OAAO,eAAe,OAAO,cAAc,YAAY,cAAc;IAAI;AAAA,EAE1F;AAEA,+CACGC,MAAA,EAAY,WAAW,KAAK,EAAE,SAAS,UAAU,CAAC,GAAI,GAAG,OACvD,gBAAM,IAAI,CAAC,MAAM,UAChBC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,IAAI,KAAK,MAAM,KAAK;AAAA,MACpB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK,QAAQ,KAAK;AAAA,MACxB,MAAM,KAAK;AAAA,MACX,KAAK,KAAK,eAAe,KAAK,YAAY,iBAAiB,WAAW,UAAU,KAAK,EAAE;AAAA,MACvF,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,UAAU,WAAW,MAAM,SAAS,KAAK,IAAI,KAAK,MAAM,KAAK,YAAY,IAAI;AAAA,MAC7E;AAAA,MACA;AAAA,MACA,UAAU,MAAM,aAAa,MAAM,KAAK;AAAA,IAAA;AAAA,IAXnC;AAAA,EAaR,CAAA,GACH;AAEJ;"}
1
+ {"version":3,"file":"FilesGrid.es.js","sources":["../../../../../../../src/containers/Feed/components/FilesGrid/FilesGrid.tsx"],"sourcesContent":["import * as Styled from './FilesGrid.styled'\nimport clsx from 'clsx'\nimport FileUploadCard from '../FileUploadCard'\nimport { isFilePreviewable } from '../FileUploadPreview'\nimport { useCallback } from 'react'\n\nexport interface FilesGridProps {\n files?: any[]\n activityId?: string\n isCompact?: boolean\n onRemove?: (id: string, name: string, isUnsavedAnnotation: boolean) => void\n projectName: string\n isDownloadable?: boolean\n onExpand?: (data: { files: any[]; index: number; activityId: string }) => void\n onAnnotationClick?: (file: any) => void\n [key: string]: any\n}\n\nconst FilesGrid: React.FC<FilesGridProps> = ({\n files = [],\n activityId,\n isCompact,\n onRemove,\n projectName,\n isDownloadable,\n onExpand,\n onAnnotationClick,\n ...props\n}) => {\n if (!files.length) return null\n\n const handleExpand = useCallback(\n (index: number) => {\n const filteredFiles = files.filter((file) => isFilePreviewable(file.mime, file.ext))\n const updatedIndex = filteredFiles.findIndex((file) => file.id === files[index].id)\n onExpand?.({ files: filteredFiles, index: updatedIndex, activityId: activityId || '' })\n },\n [onExpand],\n )\n\n return (\n <Styled.Grid className={clsx({ compact: isCompact })} {...props}>\n {files.map((file, index) => (\n <FileUploadCard\n key={index}\n id={file.id || file.name}\n name={file.name}\n mime={file.mime || file.type}\n size={file.size}\n src={\n file.isUnsavedAnnotation\n ? file.thumbnail\n : `/api/projects/${projectName}/files/${file.id}`\n }\n isUnsavedAnnotation={file.isUnsavedAnnotation}\n savedAnnotation={file.annotation}\n progress={file.progress}\n onRemove={\n onRemove ? () => onRemove(file.id, file.name, file.isUnsavedAnnotation) : undefined\n }\n isCompact={isCompact}\n isDownloadable={isDownloadable}\n onExpand={() => handleExpand(index)}\n onJumpTo={() => onAnnotationClick?.(file)}\n />\n ))}\n </Styled.Grid>\n )\n}\n\nexport default FilesGrid\n"],"names":["Styled.Grid","jsx"],"mappings":";;;;;;AAkBA,MAAM,YAAsC,CAAC;AAAA,EAC3C,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACA,MAAA,CAAC,MAAM,OAAe,QAAA;AAE1B,QAAM,eAAe;AAAA,IACnB,CAAC,UAAkB;AACX,YAAA,gBAAgB,MAAM,OAAO,CAAC,SAAS,kBAAkB,KAAK,MAAM,KAAK,GAAG,CAAC;AAC7E,YAAA,eAAe,cAAc,UAAU,CAAC,SAAS,KAAK,OAAO,MAAM,KAAK,EAAE,EAAE;AACvE,2CAAA,EAAE,OAAO,eAAe,OAAO,cAAc,YAAY,cAAc;IACpF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,+CACGA,MAAA,EAAY,WAAW,KAAK,EAAE,SAAS,UAAU,CAAC,GAAI,GAAG,OACvD,gBAAM,IAAI,CAAC,MAAM,UAChBC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,IAAI,KAAK,MAAM,KAAK;AAAA,MACpB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK,QAAQ,KAAK;AAAA,MACxB,MAAM,KAAK;AAAA,MACX,KACE,KAAK,sBACD,KAAK,YACL,iBAAiB,WAAW,UAAU,KAAK,EAAE;AAAA,MAEnD,qBAAqB,KAAK;AAAA,MAC1B,iBAAiB,KAAK;AAAA,MACtB,UAAU,KAAK;AAAA,MACf,UACE,WAAW,MAAM,SAAS,KAAK,IAAI,KAAK,MAAM,KAAK,mBAAmB,IAAI;AAAA,MAE5E;AAAA,MACA;AAAA,MACA,UAAU,MAAM,aAAa,KAAK;AAAA,MAClC,UAAU,MAAM,uDAAoB;AAAA,IAAI;AAAA,IAnBnC;AAAA,EAqBR,CAAA,GACH;AAEJ;"}
@@ -22,6 +22,14 @@ require("../../CommentInput/CommentInput.cjs.js");
22
22
  require("../../ReactionContainer/Reactions.styled.cjs.js");
23
23
  require("../../FilesGrid/FilesGrid.styled.cjs.js");
24
24
  require("../../FileUploadCard/FileUploadCard.styled.cjs.js");
25
+ require("../../../../../context/RemoteModulesContext.cjs.js");
26
+ require("../../../../../context/DetailsPanelContext.cjs.js");
27
+ require("../../../../../context/ThumbnailUploaderContext.cjs.js");
28
+ require("../../../../../context/SettingsPanelContext.cjs.js");
29
+ require("../../../../../context/pip/PiPProvider.cjs.js");
30
+ require("../../../../../context/pip/PiPWrapper.cjs.js");
31
+ require("../../../../../context/AddonProjectContext.cjs.js");
32
+ require("../../../../../context/AddonContext.cjs.js");
25
33
  require("../../CommentInput/quillToMarkdown.cjs.js");
26
34
  require("../../ActivityComment/ActivityComment.styled.cjs.js");
27
35
  require("../../ActivityCheckbox/ActivityCheckbox.styled.cjs.js");
@@ -34,14 +42,6 @@ require("../../ActivityStatusChange/ActivityStatusChange.styled.cjs.js");
34
42
  require("../../ActivityAssigneeChange/ActivityAssigneeChange.styled.cjs.js");
35
43
  require("../../ActivityVersions/ActivityVersions.styled.cjs.js");
36
44
  require("../../ActivityGroup/ActivityGroup.styled.cjs.js");
37
- require("../../../../../context/RemoteModulesContext.cjs.js");
38
- require("../../../../../context/DetailsPanelContext.cjs.js");
39
- require("../../../../../context/ThumbnailUploaderContext.cjs.js");
40
- require("../../../../../context/SettingsPanelContext.cjs.js");
41
- require("../../../../../context/pip/PiPProvider.cjs.js");
42
- require("../../../../../context/pip/PiPWrapper.cjs.js");
43
- require("../../../../../context/AddonProjectContext.cjs.js");
44
- require("../../../../../context/AddonContext.cjs.js");
45
45
  require("../../../Feed.styled.cjs.js");
46
46
  require("date-fns");
47
47
  require("../../../../../components/EmptyPlaceholder/EmptyPlaceholder.cjs.js");
@@ -21,6 +21,14 @@ import "../../CommentInput/CommentInput.es.js";
21
21
  import "../../ReactionContainer/Reactions.styled.es.js";
22
22
  import "../../FilesGrid/FilesGrid.styled.es.js";
23
23
  import "../../FileUploadCard/FileUploadCard.styled.es.js";
24
+ import "../../../../../context/RemoteModulesContext.es.js";
25
+ import "../../../../../context/DetailsPanelContext.es.js";
26
+ import "../../../../../context/ThumbnailUploaderContext.es.js";
27
+ import "../../../../../context/SettingsPanelContext.es.js";
28
+ import "../../../../../context/pip/PiPProvider.es.js";
29
+ import "../../../../../context/pip/PiPWrapper.es.js";
30
+ import "../../../../../context/AddonProjectContext.es.js";
31
+ import "../../../../../context/AddonContext.es.js";
24
32
  import "../../CommentInput/quillToMarkdown.es.js";
25
33
  import "../../ActivityComment/ActivityComment.styled.es.js";
26
34
  import "../../ActivityCheckbox/ActivityCheckbox.styled.es.js";
@@ -33,14 +41,6 @@ import "../../ActivityStatusChange/ActivityStatusChange.styled.es.js";
33
41
  import "../../ActivityAssigneeChange/ActivityAssigneeChange.styled.es.js";
34
42
  import "../../ActivityVersions/ActivityVersions.styled.es.js";
35
43
  import "../../ActivityGroup/ActivityGroup.styled.es.js";
36
- import "../../../../../context/RemoteModulesContext.es.js";
37
- import "../../../../../context/DetailsPanelContext.es.js";
38
- import "../../../../../context/ThumbnailUploaderContext.es.js";
39
- import "../../../../../context/SettingsPanelContext.es.js";
40
- import "../../../../../context/pip/PiPProvider.es.js";
41
- import "../../../../../context/pip/PiPWrapper.es.js";
42
- import "../../../../../context/AddonProjectContext.es.js";
43
- import "../../../../../context/AddonContext.es.js";
44
44
  import "../../../Feed.styled.es.js";
45
45
  import "date-fns";
46
46
  import "../../../../../components/EmptyPlaceholder/EmptyPlaceholder.es.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ const mergeAnnotationAttachments = (activities) => {
3
+ return activities.map((activity) => {
4
+ var _a;
5
+ if (activity.activityType !== "comment" || !((_a = activity.activityData) == null ? void 0 : _a.annotations)) return activity;
6
+ const files = activity.files.map((file) => {
7
+ const annotation = activity.activityData.annotations.find(
8
+ (annotation2) => annotation2.composite === file.id || annotation2.transparent === file.id
9
+ );
10
+ if (annotation.transparent === file.id) return null;
11
+ return { ...file, annotation };
12
+ }).filter(Boolean);
13
+ const newActivity = { ...activity, files };
14
+ return newActivity;
15
+ });
16
+ };
17
+ module.exports = mergeAnnotationAttachments;
18
+ //# sourceMappingURL=mergeAnnotationAttachments.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeAnnotationAttachments.cjs.js","sources":["../../../../../../src/containers/Feed/helpers/mergeAnnotationAttachments.ts"],"sourcesContent":["import { SavedAnnotationMetadata } from '../../index'\n\nexport default (activities: any[]) => {\n return activities.map((activity) => {\n if (activity.activityType !== 'comment' || !activity.activityData?.annotations) return activity\n\n const files = activity.files\n .map((file: any) => {\n // look for an annotation that is using this file\n const annotation = activity.activityData.annotations.find(\n (annotation: SavedAnnotationMetadata) =>\n annotation.composite === file.id || annotation.transparent === file.id,\n )\n\n // if the file is the transparent version of the annotation, ignore it\n if (annotation.transparent === file.id) return null\n\n return { ...file, annotation }\n })\n .filter(Boolean)\n\n const newActivity = { ...activity, files }\n return newActivity\n })\n}\n"],"names":["annotation"],"mappings":";AAEA,MAAe,6BAAA,CAAC,eAAsB;AAC7B,SAAA,WAAW,IAAI,CAAC,aAAa;;AAClC,QAAI,SAAS,iBAAiB,aAAa,GAAC,cAAS,iBAAT,mBAAuB,aAAoB,QAAA;AAEvF,UAAM,QAAQ,SAAS,MACpB,IAAI,CAAC,SAAc;AAEZ,YAAA,aAAa,SAAS,aAAa,YAAY;AAAA,QACnD,CAACA,gBACCA,YAAW,cAAc,KAAK,MAAMA,YAAW,gBAAgB,KAAK;AAAA,MACxE;AAGA,UAAI,WAAW,gBAAgB,KAAK,GAAW,QAAA;AAExC,aAAA,EAAE,GAAG,MAAM,WAAW;AAAA,IAAA,CAC9B,EACA,OAAO,OAAO;AAEjB,UAAM,cAAc,EAAE,GAAG,UAAU,MAAM;AAClC,WAAA;AAAA,EAAA,CACR;AACH;;"}
@@ -0,0 +1,19 @@
1
+ const mergeAnnotationAttachments = (activities) => {
2
+ return activities.map((activity) => {
3
+ var _a;
4
+ if (activity.activityType !== "comment" || !((_a = activity.activityData) == null ? void 0 : _a.annotations)) return activity;
5
+ const files = activity.files.map((file) => {
6
+ const annotation = activity.activityData.annotations.find(
7
+ (annotation2) => annotation2.composite === file.id || annotation2.transparent === file.id
8
+ );
9
+ if (annotation.transparent === file.id) return null;
10
+ return { ...file, annotation };
11
+ }).filter(Boolean);
12
+ const newActivity = { ...activity, files };
13
+ return newActivity;
14
+ });
15
+ };
16
+ export {
17
+ mergeAnnotationAttachments as default
18
+ };
19
+ //# sourceMappingURL=mergeAnnotationAttachments.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeAnnotationAttachments.es.js","sources":["../../../../../../src/containers/Feed/helpers/mergeAnnotationAttachments.ts"],"sourcesContent":["import { SavedAnnotationMetadata } from '../../index'\n\nexport default (activities: any[]) => {\n return activities.map((activity) => {\n if (activity.activityType !== 'comment' || !activity.activityData?.annotations) return activity\n\n const files = activity.files\n .map((file: any) => {\n // look for an annotation that is using this file\n const annotation = activity.activityData.annotations.find(\n (annotation: SavedAnnotationMetadata) =>\n annotation.composite === file.id || annotation.transparent === file.id,\n )\n\n // if the file is the transparent version of the annotation, ignore it\n if (annotation.transparent === file.id) return null\n\n return { ...file, annotation }\n })\n .filter(Boolean)\n\n const newActivity = { ...activity, files }\n return newActivity\n })\n}\n"],"names":["annotation"],"mappings":"AAEA,MAAe,6BAAA,CAAC,eAAsB;AAC7B,SAAA,WAAW,IAAI,CAAC,aAAa;AADtC;AAEI,QAAI,SAAS,iBAAiB,aAAa,GAAC,cAAS,iBAAT,mBAAuB,aAAoB,QAAA;AAEvF,UAAM,QAAQ,SAAS,MACpB,IAAI,CAAC,SAAc;AAEZ,YAAA,aAAa,SAAS,aAAa,YAAY;AAAA,QACnD,CAACA,gBACCA,YAAW,cAAc,KAAK,MAAMA,YAAW,gBAAgB,KAAK;AAAA,MACxE;AAGA,UAAI,WAAW,gBAAgB,KAAK,GAAW,QAAA;AAExC,aAAA,EAAE,GAAG,MAAM,WAAW;AAAA,IAAA,CAC9B,EACA,OAAO,OAAO;AAEjB,UAAM,cAAc,EAAE,GAAG,UAAU,MAAM;AAClC,WAAA;AAAA,EAAA,CACR;AACH;"}
@@ -50,7 +50,7 @@ const useCommentMutations = ({
50
50
  return patch;
51
51
  };
52
52
  const getActivityId = () => v1().replace(/-/g, "");
53
- const submitComment = async (value, files = []) => {
53
+ const submitComment = async (value, files = [], data = {}) => {
54
54
  const promises = entities.map(({ id: entityId, subTitle }) => {
55
55
  const newId = getActivityId();
56
56
  const fileIds = files.map((file) => file.id);
@@ -58,9 +58,18 @@ const useCommentMutations = ({
58
58
  body: value,
59
59
  activityType: "comment",
60
60
  id: newId,
61
- files: fileIds
61
+ files: fileIds,
62
+ data
62
63
  };
63
- const patch = createPatch({ entityId, newId, subTitle, value, files });
64
+ const optimisticFiles = files.filter(
65
+ ({ id }) => {
66
+ var _a;
67
+ return !((_a = data.annotations) == null ? void 0 : _a.some(
68
+ (annotation) => annotation.transparent === id
69
+ ));
70
+ }
71
+ );
72
+ const patch = createPatch({ entityId, newId, subTitle, value, files: optimisticFiles });
64
73
  const argsForCachingMatching = { entityIds, activityTypes };
65
74
  return createEntityActivity({
66
75
  projectName,
@@ -1 +1 @@
1
- {"version":3,"file":"useCommentMutations.cjs.js","sources":["../../../../../../src/containers/Feed/hooks/useCommentMutations.ts"],"sourcesContent":["import { v1 as uuid1 } from 'uuid'\nimport { formatISO } from 'date-fns'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../context/FeedContext'\n\n// Type definitions\ninterface Entity {\n id: string\n subTitle?: string\n}\n\ninterface File {\n id: string\n [key: string]: any\n}\n\nexport interface Activity {\n activityId: string\n entityId: string\n body: string\n files: File[]\n [key: string]: any\n}\n\ninterface CommentPatch {\n body: string\n activityType: string\n activityId: string\n entityId: string\n referenceType: string\n authorName: string\n authorFullName?: string\n createdAt: string\n files: File[]\n reactions: any[]\n origin: {\n id: string\n type: string\n name?: string\n }\n author: {\n active: boolean\n deleted: boolean\n }\n}\n\ninterface CommentMutationsProps {\n projectName: string\n entityType: string\n entities: Entity[]\n filter: any\n}\n\ninterface CommentPayload {\n entityId: string\n newId: string\n subTitle?: string\n value: string\n files?: File[]\n}\n\n// does the body have a checklist anywhere in it\n// * [ ] or * [x]\nexport const bodyHasChecklist = (body: string): boolean => {\n return body.includes('* [ ]') || body.includes('* [x]')\n}\n\nconst useCommentMutations = ({\n projectName,\n entityType,\n entities = [],\n filter,\n}: CommentMutationsProps) => {\n const {\n createEntityActivity,\n updateActivity,\n deleteActivity,\n isUpdatingActivity,\n userName,\n userFullName,\n activityTypes,\n } = useFeedContext()\n const entityIds = entities.map((entity) => entity.id)\n\n const createPatch = ({\n entityId,\n newId,\n subTitle,\n value,\n files = [],\n }: CommentPayload): CommentPatch => {\n const patch: CommentPatch = {\n body: value,\n activityType: 'comment',\n activityId: newId,\n entityId: entityId,\n referenceType: 'origin',\n authorName: userName,\n authorFullName: userFullName,\n createdAt: formatISO(new Date()),\n files: files,\n reactions: [],\n origin: {\n id: '8090c2dafcc811eeaf820242c0a80002',\n type: entityType,\n name: subTitle,\n },\n author: {\n active: true,\n deleted: false,\n },\n }\n\n return patch\n }\n\n const getActivityId = (): string => uuid1().replace(/-/g, '')\n\n const submitComment = async (value: string, files: File[] = []): Promise<void> => {\n // map over all the entities and create a new comment for each\n let patchId: string | null = null\n const promises = entities.map(({ id: entityId, subTitle }) => {\n const newId = getActivityId()\n if (!patchId) patchId = newId\n const fileIds = files.map((file) => file.id)\n\n const newComment = {\n body: value,\n activityType: 'comment',\n id: newId,\n files: fileIds,\n }\n\n // create a new patch for optimistic update\n const patch = createPatch({ entityId, newId, subTitle, value, files })\n\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityIds, activityTypes }\n\n return createEntityActivity({\n projectName,\n entityType,\n entityId,\n data: newComment,\n patch,\n filter,\n ...argsForCachingMatching,\n })\n })\n\n await Promise.all(promises)\n }\n\n const updateComment = async (\n activity: Activity,\n value: string,\n files: File[] = [],\n ): Promise<void> => {\n const fileIds = files.map((file) => file.id)\n\n const updatedActivity = {\n body: value,\n files: fileIds,\n }\n\n const patch = {\n ...activity,\n ...updatedActivity,\n files,\n }\n\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityType, entityIds, activityTypes }\n\n try {\n await updateActivity({\n projectName,\n data: updatedActivity,\n activityId: activity.activityId,\n entityId: activity.entityId,\n patch,\n filter,\n ...argsForCachingMatching,\n })\n } catch (error: any) {\n console.error(error)\n toast.error(error?.data?.detail)\n // so higher level can detect the error\n throw error\n }\n }\n\n const deleteComment = async (id: string, entityId: string, refs: any[] = []): Promise<void> => {\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityType, entityIds, activityTypes }\n\n if (!id) return\n\n try {\n await deleteActivity({\n projectName,\n activityId: id,\n entityId,\n filter,\n patch: { activityId: id },\n refs,\n ...argsForCachingMatching,\n })\n } catch (error) {\n // error is handled in the mutation\n }\n }\n\n return {\n submitComment,\n updateComment,\n deleteComment,\n isSaving: isUpdatingActivity,\n }\n}\n\nexport default useCommentMutations\n"],"names":["useFeedContext","formatISO","uuid1","toast"],"mappings":"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"}
1
+ {"version":3,"file":"useCommentMutations.cjs.js","sources":["../../../../../../src/containers/Feed/hooks/useCommentMutations.ts"],"sourcesContent":["import { v1 as uuid1 } from 'uuid'\nimport { formatISO } from 'date-fns'\nimport { toast } from 'react-toastify'\nimport { useFeedContext } from '../context/FeedContext'\nimport { SavedAnnotationMetadata } from '..'\n\n// Type definitions\ninterface Entity {\n id: string\n subTitle?: string\n}\n\ninterface File {\n id: string\n [key: string]: any\n}\n\nexport interface Activity {\n activityId: string\n entityId: string\n body: string\n files: File[]\n [key: string]: any\n}\n\ninterface CommentPatch {\n body: string\n activityType: string\n activityId: string\n entityId: string\n referenceType: string\n authorName: string\n authorFullName?: string\n createdAt: string\n files: File[]\n reactions: any[]\n origin: {\n id: string\n type: string\n name?: string\n }\n author: {\n active: boolean\n deleted: boolean\n }\n}\n\ninterface CommentMutationsProps {\n projectName: string\n entityType: string\n entities: Entity[]\n filter: any\n}\n\ninterface CommentPayload {\n entityId: string\n newId: string\n subTitle?: string\n value: string\n files?: File[]\n}\n\n// does the body have a checklist anywhere in it\n// * [ ] or * [x]\nexport const bodyHasChecklist = (body: string): boolean => {\n return body.includes('* [ ]') || body.includes('* [x]')\n}\n\nconst useCommentMutations = ({\n projectName,\n entityType,\n entities = [],\n filter,\n}: CommentMutationsProps) => {\n const {\n createEntityActivity,\n updateActivity,\n deleteActivity,\n isUpdatingActivity,\n userName,\n userFullName,\n activityTypes,\n } = useFeedContext()\n const entityIds = entities.map((entity) => entity.id)\n\n const createPatch = ({\n entityId,\n newId,\n subTitle,\n value,\n files = [],\n }: CommentPayload): CommentPatch => {\n const patch: CommentPatch = {\n body: value,\n activityType: 'comment',\n activityId: newId,\n entityId: entityId,\n referenceType: 'origin',\n authorName: userName,\n authorFullName: userFullName,\n createdAt: formatISO(new Date()),\n files: files,\n reactions: [],\n origin: {\n id: '8090c2dafcc811eeaf820242c0a80002',\n type: entityType,\n name: subTitle,\n },\n author: {\n active: true,\n deleted: false,\n },\n }\n\n return patch\n }\n\n const getActivityId = (): string => uuid1().replace(/-/g, '')\n\n const submitComment = async (\n value: string,\n files: File[] = [],\n data: any = {},\n ): Promise<void> => {\n // map over all the entities and create a new comment for each\n let patchId: string | null = null\n const promises = entities.map(({ id: entityId, subTitle }) => {\n const newId = getActivityId()\n if (!patchId) patchId = newId\n const fileIds = files.map((file) => file.id)\n\n const newComment = {\n body: value,\n activityType: 'comment',\n id: newId,\n files: fileIds,\n data,\n }\n\n // filter out files which are transparent versions of an annotation\n const optimisticFiles = files.filter(\n ({ id }) =>\n !data.annotations?.some(\n (annotation: SavedAnnotationMetadata) => annotation.transparent === id,\n ),\n )\n\n // create a new patch for optimistic update\n const patch = createPatch({ entityId, newId, subTitle, value, files: optimisticFiles })\n\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityIds, activityTypes }\n\n return createEntityActivity({\n projectName,\n entityType,\n entityId,\n data: newComment,\n patch,\n filter,\n ...argsForCachingMatching,\n })\n })\n\n await Promise.all(promises)\n }\n\n const updateComment = async (\n activity: Activity,\n value: string,\n files: File[] = [],\n ): Promise<void> => {\n const fileIds = files.map((file) => file.id)\n\n const updatedActivity = {\n body: value,\n files: fileIds,\n }\n\n const patch = {\n ...activity,\n ...updatedActivity,\n files,\n }\n\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityType, entityIds, activityTypes }\n\n try {\n await updateActivity({\n projectName,\n data: updatedActivity,\n activityId: activity.activityId,\n entityId: activity.entityId,\n patch,\n filter,\n ...argsForCachingMatching,\n })\n } catch (error: any) {\n console.error(error)\n toast.error(error?.data?.detail)\n // so higher level can detect the error\n throw error\n }\n }\n\n const deleteComment = async (id: string, entityId: string, refs: any[] = []): Promise<void> => {\n // we only need these args to update the cache of the original query\n const argsForCachingMatching = { entityType, entityIds, activityTypes }\n\n if (!id) return\n\n try {\n await deleteActivity({\n projectName,\n activityId: id,\n entityId,\n filter,\n patch: { activityId: id },\n refs,\n ...argsForCachingMatching,\n })\n } catch (error) {\n // error is handled in the mutation\n }\n }\n\n return {\n submitComment,\n updateComment,\n deleteComment,\n isSaving: isUpdatingActivity,\n }\n}\n\nexport default useCommentMutations\n"],"names":["useFeedContext","formatISO","uuid1","toast"],"mappings":"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"}
@@ -49,7 +49,7 @@ const useCommentMutations = ({
49
49
  return patch;
50
50
  };
51
51
  const getActivityId = () => v1().replace(/-/g, "");
52
- const submitComment = async (value, files = []) => {
52
+ const submitComment = async (value, files = [], data = {}) => {
53
53
  const promises = entities.map(({ id: entityId, subTitle }) => {
54
54
  const newId = getActivityId();
55
55
  const fileIds = files.map((file) => file.id);
@@ -57,9 +57,18 @@ const useCommentMutations = ({
57
57
  body: value,
58
58
  activityType: "comment",
59
59
  id: newId,
60
- files: fileIds
60
+ files: fileIds,
61
+ data
61
62
  };
62
- const patch = createPatch({ entityId, newId, subTitle, value, files });
63
+ const optimisticFiles = files.filter(
64
+ ({ id }) => {
65
+ var _a;
66
+ return !((_a = data.annotations) == null ? void 0 : _a.some(
67
+ (annotation) => annotation.transparent === id
68
+ ));
69
+ }
70
+ );
71
+ const patch = createPatch({ entityId, newId, subTitle, value, files: optimisticFiles });
63
72
  const argsForCachingMatching = { entityIds, activityTypes };
64
73
  return createEntityActivity({
65
74
  projectName,