@ossy/resources 3.0.3 → 3.0.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/resources",
3
3
  "description": "Resource domain — aggregate and events for the Ossy resource model",
4
- "version": "3.0.3",
4
+ "version": "3.0.4",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "./src/index.js",
@@ -23,10 +23,10 @@
23
23
  "src": "./src"
24
24
  },
25
25
  "dependencies": {
26
- "@ossy/event-store": "^3.0.3",
27
- "@ossy/fold": "^3.0.3",
28
- "@ossy/platform": "^3.0.3",
29
- "@ossy/schema": "^3.0.3"
26
+ "@ossy/event-store": "^3.0.4",
27
+ "@ossy/fold": "^3.0.4",
28
+ "@ossy/platform": "^3.0.4",
29
+ "@ossy/schema": "^3.0.4"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@ossy/design-system": ">=1.0.0",
@@ -49,5 +49,5 @@
49
49
  "/src",
50
50
  "README.md"
51
51
  ],
52
- "gitHead": "8d098a04b595b2d1f54788c5c7ed7f310e9cd7e1"
52
+ "gitHead": "831c9816bee67c5e53d0a4be4f6401975f23d72a"
53
53
  }
@@ -142,7 +142,9 @@ const ResourceIcon = memo(function ResourceIcon({ type, content, templateMap })
142
142
  )
143
143
  }
144
144
 
145
- if (type?.startsWith('image')) {
145
+ // Binary files use type `@ossy/platform/schema/file`; MIME lives on content.ContentType.
146
+ const mediaType = content?.ContentType || type
147
+ if (typeof mediaType === 'string' && mediaType.startsWith('image')) {
146
148
  return (
147
149
  <Image
148
150
  src={content?.sizes?.thumbnailSmall || content?.src}
@@ -185,15 +185,16 @@ export function SchemaPresenter ({
185
185
  return <Text>directory</Text>
186
186
  }
187
187
 
188
- if (isDocumentSchema) {
189
- return <SchemaViewPresenter resource={resource} projection={projection} resourceId={resourceId} />
190
- }
191
-
188
+ // File envelope is a registered schema, but View must use MIME presenters (image/video/…).
192
189
  const mime = resolveMediaType(resource)
193
- if (isMimeType(mime) || resource.type === '@ossy/platform/schema/file') {
190
+ if (resource.type === '@ossy/platform/schema/file' || isMimeType(mime)) {
194
191
  return <MimeViewPresenter resource={resource} projection={projection} resourceId={resourceId} onClose={onClose} />
195
192
  }
196
193
 
194
+ if (isDocumentSchema) {
195
+ return <SchemaViewPresenter resource={resource} projection={projection} resourceId={resourceId} />
196
+ }
197
+
197
198
  return <ResourceGenericView resourceId={resourceId} onClose={onClose} />
198
199
  }
199
200