@teambit/workspace 1.0.122 → 1.0.123

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,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "homepage": "https://bit.cloud/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "1.0.122"
9
+ "version": "1.0.123"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -35,7 +35,6 @@
35
35
  "@teambit/legacy-bit-id": "1.1.0",
36
36
  "@teambit/dependencies.modules.packages-excluder": "1.0.8",
37
37
  "@teambit/design.ui.tree": "0.0.15",
38
- "@teambit/lanes.hooks.use-lane-components": "0.0.253",
39
38
  "@teambit/lanes.hooks.use-lanes": "0.0.254",
40
39
  "@teambit/lanes.ui.models.lanes-model": "0.0.207",
41
40
  "@teambit/ui-foundation.ui.side-bar": "0.0.871",
@@ -61,37 +60,39 @@
61
60
  "@teambit/explorer.ui.component-card": "0.0.30",
62
61
  "@teambit/explorer.ui.gallery.component-grid": "0.0.496",
63
62
  "@teambit/workspace.ui.empty-workspace": "0.0.508",
64
- "@teambit/component": "1.0.122",
65
- "@teambit/dependency-resolver": "1.0.122",
66
- "@teambit/envs": "1.0.122",
67
- "@teambit/logger": "0.0.937",
68
- "@teambit/scope": "1.0.122",
69
- "@teambit/graph": "1.0.122",
70
- "@teambit/cli": "0.0.844",
71
- "@teambit/isolator": "1.0.122",
72
- "@teambit/component-tree": "1.0.122",
63
+ "@teambit/component": "1.0.123",
64
+ "@teambit/dependency-resolver": "1.0.123",
65
+ "@teambit/envs": "1.0.123",
66
+ "@teambit/logger": "0.0.938",
67
+ "@teambit/scope": "1.0.123",
68
+ "@teambit/graph": "1.0.123",
69
+ "@teambit/cli": "0.0.845",
70
+ "@teambit/isolator": "1.0.123",
71
+ "@teambit/component-tree": "1.0.123",
73
72
  "@teambit/harmony.modules.resolved-component": "0.0.497",
74
- "@teambit/watcher": "1.0.122",
75
- "@teambit/aspect-loader": "1.0.122",
76
- "@teambit/config": "0.0.873",
77
- "@teambit/global-config": "0.0.847",
73
+ "@teambit/watcher": "1.0.123",
74
+ "@teambit/aspect-loader": "1.0.123",
75
+ "@teambit/config": "0.0.874",
76
+ "@teambit/global-config": "0.0.848",
78
77
  "@teambit/harmony.modules.requireable-component": "0.0.497",
79
78
  "@teambit/toolbox.modules.module-resolver": "0.0.7",
80
79
  "@teambit/workspace.modules.node-modules-linker": "0.0.161",
81
- "@teambit/graphql": "1.0.122",
82
- "@teambit/bundler": "1.0.122",
83
- "@teambit/pubsub": "1.0.122",
84
- "@teambit/ui": "1.0.122",
85
- "@teambit/variants": "0.0.966",
80
+ "@teambit/graphql": "1.0.123",
81
+ "@teambit/bundler": "1.0.123",
82
+ "@teambit/pubsub": "1.0.123",
83
+ "@teambit/ui": "1.0.123",
84
+ "@teambit/variants": "0.0.967",
86
85
  "@teambit/component-issues": "0.0.140",
87
86
  "@teambit/workspace.modules.match-pattern": "0.0.504",
88
87
  "@teambit/component.ui.component-drawer": "0.0.385",
89
- "@teambit/command-bar": "1.0.122",
90
- "@teambit/sidebar": "1.0.122",
91
- "@teambit/deprecation": "1.0.122",
88
+ "@teambit/lanes.hooks.use-lane-components": "0.0.255",
89
+ "@teambit/command-bar": "1.0.123",
90
+ "@teambit/sidebar": "1.0.123",
91
+ "@teambit/deprecation": "1.0.123",
92
92
  "@teambit/component-descriptor": "0.0.412",
93
93
  "@teambit/cloud.hooks.use-cloud-scopes": "0.0.3",
94
- "@teambit/preview.ui.preview-placeholder": "0.0.507"
94
+ "@teambit/preview.ui.preview-placeholder": "0.0.508",
95
+ "@teambit/workspace.ui.workspace-component-card": "0.0.517"
95
96
  },
96
97
  "devDependencies": {
97
98
  "@types/lodash": "4.14.165",
@@ -35,3 +35,14 @@
35
35
  margin-bottom: 4px;
36
36
  box-shadow: 0px 2px 18px rgb(0 0 0 / 10%);
37
37
  }
38
+
39
+ .cardGrid {
40
+ grid-column-gap: 10px;
41
+ grid-gap: 32px 24px;
42
+ -moz-column-gap: 10px;
43
+ column-gap: 10px;
44
+ display: grid;
45
+ gap: 32px 24px;
46
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
47
+ max-width: 1280px;
48
+ }
@@ -7,7 +7,9 @@ import { ComponentID } from '@teambit/component-id';
7
7
  import { ComponentModel } from '@teambit/component';
8
8
  import { useCloudScopes } from '@teambit/cloud.hooks.use-cloud-scopes';
9
9
  import { ScopeID } from '@teambit/scopes.scope-id';
10
- import { ComponentCard, ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
10
+ import { compact } from 'lodash';
11
+ import { WorkspaceComponentCard } from '@teambit/workspace.ui.workspace-component-card';
12
+ import { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
11
13
  import { WorkspaceContext } from '../workspace-context';
12
14
  import styles from './workspace-overview.module.scss';
13
15
  import { LinkPlugin } from './link-plugin';
@@ -20,27 +22,37 @@ export function WorkspaceOverview() {
20
22
  const uniqueScopesArr = Array.from(uniqueScopes);
21
23
  const { cloudScopes = [] } = useCloudScopes(uniqueScopesArr);
22
24
  const cloudScopesById = new Map(cloudScopes.map((scope) => [scope.id.toString(), scope]));
25
+
23
26
  const plugins = useCardPlugins({ compModelsById });
27
+
24
28
  if (!components || components.length === 0) return <EmptyWorkspace name={workspace.name} />;
29
+
25
30
  const compDescriptorById = new Map(componentDescriptors.map((comp) => [comp.id.toString(), comp]));
31
+ const componentsWithDescriptorAndScope = compact(
32
+ components.map((component) => {
33
+ if (component.deprecation?.isDeprecate) return null;
34
+ const componentDescriptor = compDescriptorById.get(component.id.toString());
35
+ if (!componentDescriptor) return null;
36
+ const cloudScope = cloudScopesById.get(component.id.scope);
37
+ const scope =
38
+ cloudScope ||
39
+ (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||
40
+ undefined;
41
+
42
+ return { component, componentDescriptor, scope };
43
+ })
44
+ );
45
+
26
46
  return (
27
47
  <div className={styles.container}>
28
- <ComponentGrid>
29
- {components.map((component) => {
30
- if (component.deprecation?.isDeprecate) return null;
31
- const compDescriptor = compDescriptorById.get(component.id.toString());
32
- if (!compDescriptor) return null;
33
- const cloudScope = cloudScopesById.get(component.id.scope);
34
- const scope =
35
- cloudScope ||
36
- (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||
37
- undefined;
48
+ <ComponentGrid className={styles.cardGrid}>
49
+ {componentsWithDescriptorAndScope.map(({ component, componentDescriptor, scope }) => {
38
50
  return (
39
- <ComponentCard
51
+ <WorkspaceComponentCard
40
52
  key={component.id.toString()}
41
- component={compDescriptor}
53
+ componentDescriptor={componentDescriptor}
54
+ component={component}
42
55
  plugins={plugins}
43
- displayOwnerDetails="all"
44
56
  scope={scope}
45
57
  />
46
58
  );
@@ -58,10 +70,16 @@ export function useCardPlugins({
58
70
  const plugins = React.useMemo(
59
71
  () => [
60
72
  {
61
- preview: function Preview({ component }) {
73
+ preview: function Preview({ component, shouldShowPreview }) {
62
74
  const compModel = compModelsById.get(component.id.toString());
63
75
  if (!compModel) return null;
64
- return <PreviewPlaceholder componentDescriptor={component} component={compModel} />;
76
+ return (
77
+ <PreviewPlaceholder
78
+ componentDescriptor={component}
79
+ component={compModel}
80
+ shouldShowPreview={shouldShowPreview}
81
+ />
82
+ );
65
83
  },
66
84
  },
67
85
  {