(state, entityId, mode, isPreview)
| 398 | } |
| 399 | |
| 400 | export function selectEntityView(state, entityId, mode, isPreview) { |
| 401 | if (mode) { |
| 402 | return mode; |
| 403 | } |
| 404 | const { schema } = selectEntity(state, entityId); |
| 405 | if ( |
| 406 | schema && |
| 407 | schema.isAny(['Email', 'HyperText', 'Image', 'Pages', 'Table']) |
| 408 | ) { |
| 409 | return 'view'; |
| 410 | } |
| 411 | if (schema && schema.isA('Folder')) { |
| 412 | return 'browse'; |
| 413 | } |
| 414 | if (schema && schema.isDocument()) { |
| 415 | return 'view'; |
| 416 | } |
| 417 | if (isPreview) { |
| 418 | return 'info'; |
| 419 | } |
| 420 | const references = selectEntityReferences(state, entityId); |
| 421 | if (references?.results?.length) { |
| 422 | return references.results[0].property.qname; |
| 423 | } |
| 424 | return 'similar'; |
| 425 | } |
| 426 | |
| 427 | export function selectProfileView(state, profileId, mode) { |
| 428 | return mode ? mode : 'items'; |
no test coverage detected