Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New empty state slot #7963

Merged
merged 71 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7a835bd
initial commit
ranm8 May 3, 2023
e41d7f7
Merge branch 'master' into static-single-install
GiladShoham May 4, 2023
86384d0
Merge branch 'master' into static-single-install
GiladShoham May 8, 2023
ee360fc
load env's deps correctly for components even when node_modules are e…
GiladShoham May 9, 2023
94a52ea
Merge branch 'master' into static-single-install
GiladShoham May 11, 2023
4906e77
add env package to the env root dir
GiladShoham May 11, 2023
190aca3
Merge branch 'master' into static-single-install
GiladShoham May 14, 2023
a44cf99
restore some code
GiladShoham May 14, 2023
9a87763
load envs from root folders
GiladShoham May 15, 2023
7b35cda
Merge branch 'master' into static-single-install
GiladShoham May 16, 2023
76b31c0
fixes for envs loading
GiladShoham May 16, 2023
8ad819d
do not add missing packages that are resolved from component from the…
GiladShoham May 16, 2023
a9ff7ec
fixes for calc dev vs runtime missing deps into the install manifest
GiladShoham May 17, 2023
e357d9e
more fixes for calc where to load envs from
GiladShoham May 17, 2023
7c82d48
fix check if dependencies changes as part of the install process
GiladShoham May 17, 2023
53336bb
fix calculate env id for old components
GiladShoham May 17, 2023
ad47672
add p-locate package
GiladShoham May 18, 2023
9ee7dd6
fix env id calculation - take env.jsonc into account when searching f…
GiladShoham May 18, 2023
6a2cfb5
fix for hasEnvManifest
GiladShoham May 21, 2023
d95a71e
fixes for calc missing deps into the install manifest when they are a…
GiladShoham May 22, 2023
4d4a7a1
fix calc of missing deps into the manifest for install
GiladShoham May 22, 2023
3f1b45f
fix resolve aspects for workspace comps
GiladShoham May 22, 2023
9ebeeab
fix calc of getRuntimeModulePath
GiladShoham May 22, 2023
d86aaea
only load aspects from the graph in case the root aspect is not a plugin
GiladShoham May 22, 2023
cb1c334
more fixes for envs loading
GiladShoham May 22, 2023
343362d
improve calc env id for core envs
GiladShoham May 22, 2023
c9e2cfe
show non loaded envs for bit envs command
GiladShoham May 22, 2023
880b3d6
show real env for bit show (and not loaded indication)
GiladShoham May 22, 2023
356b940
add issue in bit status for failed loading env
GiladShoham May 22, 2023
0cc990a
Merge branch 'master' into static-single-install
GiladShoham May 23, 2023
e0629e2
fix use case when the workspace contain only old envs
GiladShoham May 23, 2023
32fa8d7
improve non loaded envs warnings
GiladShoham May 23, 2023
50ee1b1
remove duplicate envs' API
GiladShoham May 23, 2023
25c24f7
* add warning in bit install in case there are old non loaded envs
GiladShoham May 23, 2023
4c56e41
linting
GiladShoham May 23, 2023
1ffaa80
fix tests
GiladShoham May 23, 2023
4393fbe
improve aspect loading errors
GiladShoham May 24, 2023
318a311
improve calculation of failed to load envs
GiladShoham May 24, 2023
963d45d
add target to e2e-fixture-helper.copyFixtureExtensions API
GiladShoham May 24, 2023
1f60b22
add runInstall, targetFolder, id to e2e-env-helper.setCustomNewEnv API
GiladShoham May 24, 2023
7fbdc15
fix root components tests
GiladShoham May 24, 2023
7e70057
fixes for env id calculation
GiladShoham May 24, 2023
cdad8fd
fix wrong creation of missing packages issue
GiladShoham May 24, 2023
536c102
add support for format solution to component issue
GiladShoham May 24, 2023
d23f82d
add new component issue type for ExternalEnvWithoutVersion
GiladShoham May 24, 2023
387ae32
Merge branch 'master' of github.com:teambit/bit
ranm8 May 30, 2023
609ffb9
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 5, 2023
1229720
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 11, 2023
7ed26db
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 12, 2023
aac5954
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 19, 2023
eaaf49a
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 28, 2023
333043a
Merge branch 'master' of github.com:teambit/bit
ranm8 Jun 29, 2023
da6eeaa
Merge branch 'master' of github.com:teambit/bit
ranm8 Jul 2, 2023
4d70927
Merge branch 'master' of github.com:teambit/bit
ranm8 Jul 19, 2023
91f28de
Merge branch 'master' of github.com:teambit/bit
ranm8 Aug 2, 2023
bda1ae4
Merge branch 'master' of github.com:teambit/bit
ranm8 Aug 7, 2023
c8048c9
Merge branch 'master' of github.com:teambit/bit
ranm8 Aug 13, 2023
71327c0
Merge branch 'master' of github.com:teambit/bit
ranm8 Aug 14, 2023
90fc1ae
testing typos
ranm8 Aug 21, 2023
8a8358e
Merge branch 'master' of github.com:teambit/bit
ranm8 Aug 21, 2023
9a51604
Merge branch 'master' of github.com:teambit/bit
ranm8 Sep 14, 2023
7802037
Merge branch 'master' of github.com:teambit/bit
ranm8 Sep 19, 2023
f4a7709
Merge branch 'master' of github.com:teambit/bit
ranm8 Sep 20, 2023
117d222
bit roots
ranm8 Sep 24, 2023
e4db870
Merge branch 'master' of github.com:teambit/bit into bit-roots-ws-ver…
ranm8 Sep 24, 2023
be245c5
fix arg name typo
GiladShoham Sep 26, 2023
8916e67
Merge branch 'master' into bit-roots-ws-versions
GiladShoham Sep 26, 2023
8f0d960
typo
ranm8 Sep 26, 2023
67cb9e7
Merge branch 'bit-roots-ws-versions' of github.com:teambit/bit into b…
ranm8 Sep 26, 2023
daf5be8
empty state slot
ranm8 Sep 26, 2023
c5e5197
Merge branch 'master' of github.com:teambit/bit into bit-roots-ws-ver…
ranm8 Sep 26, 2023
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 scopes/docs/docs/docs.ui.runtime.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ComponentType } from 'react';
import { flatten } from 'lodash';
import { ComponentAspect, ComponentUI } from '@teambit/component';
import { Slot } from '@teambit/harmony';
Expand Down Expand Up @@ -29,6 +29,16 @@ export class DocsUI {
return flatten(this.titleBadgeSlot.values());
}

private _emptyState?: ComponentType;

registerEmptyState(emptyState: ComponentType) {
return this._emptyState = emptyState;
}

getEmptyState() {
return this._emptyState;
}

getDocsCompare() {
return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;
}
Expand All @@ -49,7 +59,7 @@ export class DocsUI {
[titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]
) {
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot);
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs);
const compareSection = new OverviewCompareSection(docs);

component.registerRoute(section.route);
Expand Down
12 changes: 10 additions & 2 deletions scopes/docs/docs/overview.section.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import { Section } from '@teambit/component';
import { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';
import { DocsUI } from './docs.ui.runtime';

export class OverviewSection implements Section {
constructor(
/**
* title badge slot.
*/
private titleBadgeSlot: TitleBadgeSlot,
private overviewOptionsSlot: OverviewOptionsSlot
private overviewOptionsSlot: OverviewOptionsSlot,
private docs: DocsUI
) {}

navigationLink = {
Expand All @@ -19,7 +21,13 @@ export class OverviewSection implements Section {

route = {
index: true,
element: <Overview titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />,
element: (
<Overview
titleBadges={this.titleBadgeSlot}
overviewOptions={this.overviewOptionsSlot}
getEmptyState={this.docs.getEmptyState.bind(this.docs)}
/>
),
};

order = 10;
Expand Down
28 changes: 16 additions & 12 deletions scopes/docs/docs/overview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PropertiesTable } from '@teambit/react.ui.docs.properties-table';
import { ComponentContext, useComponentDescriptor } from '@teambit/component';
import type { SlotRegistry } from '@teambit/harmony';
import { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';
import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
import { ComponentOverview } from '@teambit/component.ui.component-meta';
import { CompositionGallery } from '@teambit/compositions.panels.composition-gallery';
// import { ReadmeSkeleton } from './readme-skeleton';
Expand Down Expand Up @@ -36,24 +36,27 @@ export type OverviewProps = {
titleBadges: TitleBadgeSlot;
overviewOptions: OverviewOptionsSlot;
previewProps?: Partial<ComponentPreviewProps>;
getEmptyState?: () => ComponentType|undefined;
};

export function Overview({ titleBadges, overviewOptions, previewProps }: OverviewProps) {
export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps) {
const component = useContext(ComponentContext);
const componentDescriptor = useComponentDescriptor();
const overviewProps = flatten(overviewOptions.values())[0];
const showHeader = !component.preview?.legacyHeader;
const [isLoading, setLoading] = useState(true);
const EmptyState = getEmptyState && getEmptyState();

if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
return (
<StatusMessageCard style={{ margin: 'auto' }} status="PROCESSING" title="component preview pending">
this might take some time
</StatusMessageCard>
);
// if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
// return (
// <StatusMessageCard style={{ margin: 'auto' }} status="PROCESSING" title="component preview pending">
// this might take some time
// </StatusMessageCard>
// );

if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')
return <StatusMessageCard style={{ margin: 'auto' }} status="FAILURE" title="failed to get component preview " />;
// if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')
// return <StatusMessageCard style={{ margin: 'auto' }} status="FAILURE" title="failed to get component preview " />;
const buildFailed = component.buildStatus !== 'Succeed' && component?.host === 'teambit.scope/scope';

const isScaling = component.preview?.isScaling;

Expand Down Expand Up @@ -93,7 +96,7 @@ export function Overview({ titleBadges, overviewOptions, previewProps }: Overvie
{/* <LinkedHeading size="xs" className={styles.title}>
<Icon of="text" /> <span>README</span>
</LinkedHeading> */}
<div className={styles.readme}>
{!buildFailed && <div className={styles.readme}>
{/* {isLoading && <ReadmeSkeleton />} */}
<ComponentPreview
onLoad={onPreviewLoad}
Expand All @@ -111,7 +114,8 @@ export function Overview({ titleBadges, overviewOptions, previewProps }: Overvie
{component.preview?.skipIncludes && (
<PropertiesTable className={styles.overviewPropsTable} componentId={component.id.toString()} />
)}
</div>
</div>}
{(buildFailed && EmptyState) && <EmptyState />}
</div>
);
}