Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,15 @@
"@box/blueprint-web-assets": "4.61.5",
"@box/box-ai-agent-selector": "^0.48.5",
"@box/box-ai-content-answers": "^0.124.1",
"@box/box-item-type-selector": "^0.61.12",
"@box/cldr-data": "^34.2.0",
"@box/combobox-with-api": "^0.34.9",
"@box/frontend": "^11.0.1",
"@box/item-icon": "^0.17.0",
"@box/languages": "^1.0.0",
"@box/metadata-editor": "^0.122.0",
"@box/metadata-editor": "^0.122.12",
"@box/metadata-filter": "^1.16.12",
"@box/metadata-view": "^0.29.4",
"@box/react-virtualized": "^9.22.3-rc-box.10",
"@box/types": "^0.2.1",
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
Expand All @@ -150,6 +153,7 @@
"@storybook/addon-styling-webpack": "^2.0.0",
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
"@storybook/react-webpack5": "^9.0.14",
"@tanstack/react-virtual": "^3.13.12",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
Expand Down Expand Up @@ -244,6 +248,7 @@
"query-string": "5.1.1",
"react": "^18.3.1",
"react-animate-height": "^3.2.3",
"react-aria-components": "^1.10.1",
"react-beautiful-dnd": "^13.1.1",
"react-docgen-typescript": "^1.16.1",
"react-docgen-typescript-loader": "^3.6.0",
Expand Down Expand Up @@ -292,13 +297,17 @@
"@box/blueprint-web-assets": "4.61.5",
"@box/box-ai-agent-selector": "^0.48.5",
"@box/box-ai-content-answers": "^0.124.1",
"@box/box-item-type-selector": "^0.61.12",
"@box/cldr-data": ">=34.2.0",
"@box/combobox-with-api": "^0.34.9",
"@box/item-icon": "^0.17.0",
"@box/metadata-editor": "^0.122.0",
"@box/metadata-editor": "^0.122.12",
"@box/metadata-filter": "^1.16.12",
"@box/metadata-view": "^0.29.4",
"@box/react-virtualized": "^9.22.3-rc-box.10",
"@box/types": "^0.2.1",
"@hapi/address": "^2.1.4",
"@tanstack/react-virtual": "^3.13.12",
"axios": "^0.30.0",
"classnames": "^2.2.5",
"color": "^3.1.2",
Expand All @@ -319,6 +328,7 @@
"query-string": "5.1.1",
"react": "^17.0.1 || ^18.0.0",
"react-animate-height": "^3.2.3",
"react-aria-components": "^1.10.1",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^17.0.1 || ^18.0.0",
"react-draggable": "^4.4.6",
Expand Down
3 changes: 3 additions & 0 deletions scripts/i18n.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module.exports = {
translationDependencies: [
'@box/box-ai-agent-selector',
'@box/box-ai-content-answers',
'@box/box-item-type-selector',
'@box/item-icon',
'@box/metadata-editor',
'@box/metadata-filter',
'@box/metadata-view',
],
};
2 changes: 1 addition & 1 deletion scripts/jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ module.exports = {
testMatch: ['**/__tests__/**/*.test.+(js|jsx|ts|tsx)'],
testPathIgnorePatterns: ['stories.test.js$', 'stories.test.tsx$', 'stories.test.d.ts'],
transformIgnorePatterns: [
'node_modules/(?!(@box/react-virtualized/dist/es|@box/cldr-data|@box/blueprint-web|@box/blueprint-web-assets|@box/metadata-editor|@box/box-ai-content-answers|@box/box-ai-agent-selector|@box/item-icon|@box/combobox-with-api|@box/tree|@box/types)/)',
'node_modules/(?!(@box/react-virtualized/dist/es|@box/cldr-data|@box/blueprint-web|@box/blueprint-web-assets|@box/metadata-editor|@box/box-ai-content-answers|@box/box-ai-agent-selector|@box/item-icon|@box/combobox-with-api|@box/tree|@box/metadata-filter|@box/metadata-view|@box/types|@box/box-item-type-selector)/)',
],
};
112 changes: 97 additions & 15 deletions src/elements/common/__mocks__/mockMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const mockMetadata = {
entries: [
{
name: 'File1',
etag: '2',
extension: 'pdf',
metadata: {
enterprise_0: {
templateName: {
Expand All @@ -13,17 +12,18 @@ const mockMetadata = {
name: 'something',
industry: 'Technology',
last_contacted_at: '2023-11-16T00:00:00.000Z',
$version: 6,
$version: 9,
},
},
},
id: '1188899160835',
modified_at: '2023-04-12T10:06:04-07:00',
name: 'Child 2 of metadata folder.pdf',
created_at: '2023-04-12T10:06:04-07:00',
etag: '3',
id: '1188890835',
type: 'file',
},
{
name: 'File2',
etag: '1',
extension: 'pdf',
metadata: {
enterprise_0: {
templateName: {
Expand All @@ -32,31 +32,113 @@ const mockMetadata = {
$template: 'templateName',
$parent: 'file_1318276254035',
name: '1',
industry: 'Healthcare',
industry: 'Technology',
last_contacted_at: '2023-11-01T00:00:00.000Z',
$version: 3,
},
},
},
name: 'Child 1 of metadata folder.pdf',
created_at: '2023-09-26T14:04:52-07:00',
etag: '2',
id: '13182754035',
type: 'file',
},
{
extension: 'pdf',
metadata: {
enterprise_0: {
templateName: {
$scope: 'enterprise_0',
role: ['Developer', 'Business Owner'],
$template: 'templateName',
$parent: 'file_1812488409191',
industry: 'Legal',
last_contacted_at: '2025-03-05T00:00:00.000Z',
$version: 1,
},
},
},
id: '1318276254035',
modified_at: '2023-09-26T14:04:52-07:00',
name: 'Child of Folder 1.pdf',
created_at: '2025-03-24T11:19:06-07:00',
etag: '2',
id: '18124889191',
type: 'file',
},
{
extension: 'pdf',
metadata: {
enterprise_0: {
templateName: {
$scope: 'enterprise_0',
role: ['Legal', 'Marketing'],
$template: 'templateName',
$parent: 'file_1812500610112',
industry: 'Legal',
last_contacted_at: '2025-03-11T00:00:00.000Z',
$version: 3,
},
},
},
name: 'Child 1 of metadata folder 2.pdf',
created_at: '2025-03-24T11:38:55-07:00',
etag: '1',
id: '18125010112',
type: 'file',
},
{
extension: 'pdf',
metadata: {
enterprise_0: {
templateName: {
$scope: 'enterprise_0',
$template: 'templateName',
$parent: 'file_1812508470016',
name: 'in folder 3 that doesnt have metadata',
$version: 0,
},
},
},
name: 'Child 1 of folder 3.pdf',
created_at: '2025-03-24T11:50:52-07:00',
etag: '2',
id: '18125470016',
type: 'file',
},
{
name: 'File3',
etag: '0',
name: 'Folder 1 with metadata',
created_at: '2025-03-24T11:18:44-07:00',
etag: '2',
metadata: {
enterprise_0: {
templateName: {
$scope: 'enterprise_0',
$template: 'templateName',
$parent: 'folder_218662304788',
$parent: 'folder_313222720346',
industry: 'Technology',
$version: 1,
},
},
},
id: '3132220346',
type: 'folder',
},
{
name: 'Folder 2 with metadata',
created_at: '2025-03-24T11:37:27-07:00',
etag: '1',
metadata: {
enterprise_0: {
templateName: {
$scope: 'enterprise_0',
$template: 'templateName',
$parent: 'folder_313225735088',
industry: 'Healthcare',
$version: 0,
},
},
},
id: '218662304788',
modified_at: '2024-06-13T15:53:23-07:00',
id: '3135735088',
type: 'folder',
},
],
Expand Down
20 changes: 16 additions & 4 deletions src/elements/content-explorer/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import ItemGrid from '../common/item-grid';
import ItemList from '../common/item-list';
import ProgressBar from '../common/progress-bar';
import MetadataBasedItemList from '../../features/metadata-based-view';
import MetadataView from './MetadataView';
import MetadataViewContainer, { MetadataViewContainerProps } from './MetadataViewContainer';
import { isFeatureEnabled, type FeatureConfig } from '../common/feature-checking';
import { VIEW_ERROR, VIEW_METADATA, VIEW_MODE_LIST, VIEW_MODE_GRID, VIEW_SELECTED } from '../../constants';
import type { ViewMode } from '../common/flowTypes';
import type { ItemAction, ItemEventHandlers, ItemEventPermissions } from '../common/item';
import type { FieldsToShow } from '../../common/types/metadataQueries';
import type { BoxItem, Collection, View } from '../../common/types/core';
import type { MetadataFieldValue } from '../../common/types/metadata';
import type { MetadataFieldValue, MetadataTemplate } from '../../common/types/metadata';
import './Content.scss';

/**
Expand All @@ -36,6 +36,8 @@ export interface ContentProps extends Required<ItemEventHandlers>, Required<Item
isSmall: boolean;
isTouch: boolean;
itemActions?: ItemAction[];
metadataTemplate?: MetadataTemplate;
metadataViewProps?: Omit<MetadataViewContainerProps, 'currentCollection'>;
onMetadataUpdate: (
item: BoxItem,
field: string,
Expand All @@ -53,6 +55,8 @@ const Content = ({
features,
fieldsToShow = [],
gridColumnCount,
metadataTemplate,
metadataViewProps,
onMetadataUpdate,
onSortChange,
view,
Expand All @@ -70,7 +74,7 @@ const Content = ({
<div className="bce-content">
{view === VIEW_ERROR || view === VIEW_SELECTED ? null : <ProgressBar percent={percentLoaded} />}

{isViewEmpty && <EmptyView view={view} isLoading={percentLoaded !== 100} />}
{!isMetadataViewV2Feature && isViewEmpty && <EmptyView view={view} isLoading={percentLoaded !== 100} />}
{!isMetadataViewV2Feature && !isViewEmpty && isMetadataBasedView && (
<MetadataBasedItemList
currentCollection={currentCollection}
Expand All @@ -79,7 +83,15 @@ const Content = ({
{...rest}
/>
)}
{isMetadataViewV2Feature && !isViewEmpty && isMetadataBasedView && <MetadataView />}
{isMetadataViewV2Feature && isMetadataBasedView && (
<MetadataViewContainer
currentCollection={currentCollection}
isLoading={percentLoaded !== 100}
hasError={view === VIEW_ERROR}
metadataTemplate={metadataTemplate}
{...metadataViewProps}
/>
)}
{!isViewEmpty && isListView && (
<ItemList
items={items}
Expand Down
Loading