Skip to content

Commit eb6f302

Browse files
authored
Merge pull request #374 from chromaui/update-splash-screen
Update onboarding flow with animation and better error handling
2 parents 59edbcd + 2add880 commit eb6f302

25 files changed

+427
-375
lines changed

assets/visual-test-illustration.mp4

103 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
"main": "dist/index.js",
3030
"files": [
31+
"assets/**/*",
3132
"dist/**/*",
3233
"README.md",
3334
"*.js",

src/Introduction.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Panel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
TELEMETRY,
1616
} from './constants';
1717
import { Authentication } from './screens/Authentication/Authentication';
18-
import { GitNotFound } from './screens/Errors/GitNotFound';
18+
import { GitError } from './screens/Errors/GitError';
1919
import { LinkedProject } from './screens/LinkProject/LinkedProject';
2020
import { LinkingProjectFailed } from './screens/LinkProject/LinkingProjectFailed';
2121
import { LinkProject } from './screens/LinkProject/LinkProject';
@@ -149,7 +149,7 @@ export const Panel = ({ active, api }: PanelProps) => {
149149
}
150150

151151
if (gitInfoError || !gitInfo) {
152-
return withProviders(<GitNotFound />);
152+
return withProviders(<GitError gitInfoError={gitInfoError} />);
153153
}
154154

155155
// Momentarily wait on addonState (should be very fast)

src/TestProviderRender.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export const TestProviderRender = () => {
103103
});
104104

105105
let warning: string | undefined;
106-
if (!projectId) warning = 'Select a project';
107-
if (!isLoggedIn) warning = 'Login required';
108-
if (gitInfoError) warning = 'Git synchronization problem';
106+
if (isOffline) warning = 'Not available offline';
109107
if (hasConfigProblem) warning = 'Configuration problem';
110-
if (isOffline) warning = 'Not available while offline';
108+
if (gitInfoError) warning = 'Git synchronization problem';
109+
if (!isLoggedIn) warning = 'Login required';
110+
if (!projectId) warning = 'Set up visual tests';
111111

112112
const isRunnable = !warning && testProviderState !== 'test-provider-state:crashed';
113113

src/components/Box.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@ export const Box = styled.div<{ warning?: boolean }>(
1717
({ theme, warning }) =>
1818
warning && { background: theme.base === 'dark' ? '#342e1a' : theme.background.warning }
1919
);
20-
21-
export const BoxList = styled.ul({
22-
margin: 0,
23-
padding: 4,
24-
listStylePosition: 'inside',
25-
});

src/components/Screen.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ interface ScreenProps {
9999
footer?: ReactNode;
100100
ignoreConfig?: boolean;
101101
ignoreSuggestions?: boolean;
102+
interstitial?: boolean;
102103
}
103104

104105
const Container = styled.div({
@@ -107,14 +108,16 @@ const Container = styled.div({
107108
height: '100%',
108109
});
109110

110-
const Content = styled.div<{ hidden?: boolean }>(({ hidden, theme }) => ({
111-
background: theme.background.app,
112-
display: hidden ? 'none' : 'flex',
113-
flexDirection: 'column',
114-
flexGrow: 1,
115-
height: '100%',
116-
overflowY: 'auto',
117-
}));
111+
const Content = styled.div<{ hidden?: boolean; interstitial?: boolean }>(
112+
({ hidden, interstitial, theme }) => ({
113+
background: interstitial ? theme.background.content : theme.background.app,
114+
display: hidden ? 'none' : 'flex',
115+
flexDirection: 'column',
116+
flexGrow: 1,
117+
height: '100%',
118+
overflowY: 'auto',
119+
})
120+
);
118121

119122
export const Footer = styled.div(({ theme }) => ({
120123
background: theme.background.bar,
@@ -140,6 +143,7 @@ export const Screen = ({
140143
),
141144
ignoreConfig = false,
142145
ignoreSuggestions = !footer,
146+
interstitial = false,
143147
}: ScreenProps) => {
144148
const { configVisible } = useControlsState();
145149
const { toggleConfig } = useControlsDispatch();
@@ -164,7 +168,9 @@ export const Screen = ({
164168
ignoreConfig={ignoreConfig}
165169
ignoreSuggestions={ignoreSuggestions}
166170
/>
167-
<Content hidden={configVisible}>{children}</Content>
171+
<Content hidden={configVisible} interstitial={interstitial}>
172+
{children}
173+
</Content>
168174
<Content hidden={!configVisible}>
169175
<Configuration onClose={() => toggleConfig(false)} />
170176
</Content>

src/components/icons/CheckIcon.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
3+
export const CheckIcon = (props: any) => (
4+
<svg
5+
width="14"
6+
height="14"
7+
viewBox="0 0 14 14"
8+
fill="none"
9+
xmlns="http://www.w3.org/2000/svg"
10+
{...props}
11+
>
12+
<path
13+
fill="currentColor"
14+
d="M13.85 3.35a.5.5 0 0 0-.7-.7L5 10.79.85 6.65a.5.5 0 1 0-.7.7l4.5 4.5c.2.2.5.2.7 0l8.5-8.5Z"
15+
></path>
16+
</svg>
17+
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
3+
export const ChevronRightIcon = (props: any) => (
4+
<svg
5+
width="14"
6+
height="14"
7+
viewBox="0 0 14 14"
8+
fill="none"
9+
xmlns="http://www.w3.org/2000/svg"
10+
{...props}
11+
>
12+
<path
13+
fill="currentColor"
14+
d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z"
15+
></path>
16+
</svg>
17+
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
3+
export const ChromaticIcon = (props: any) => (
4+
<svg
5+
width="250"
6+
height="250"
7+
viewBox="0 0 250 250"
8+
fill="none"
9+
xmlns="http://www.w3.org/2000/svg"
10+
{...props}
11+
>
12+
<circle fill="#FC521F" cx="125" cy="125" r="125"></circle>
13+
<g transform="translate(41.666667, 35.714286)" fill="#FFFFFF">
14+
<path d="M112.708657,146.772329 L92.8458667,135.31254 L152.602092,100.844023 C154.891568,99.5203449 157.049482,98.0062747 159.0592,96.3139009 C166.825876,107.373262 167.589539,121.939765 160.66516,133.92842 C154.409175,144.750546 142.73799,151.473199 130.221483,151.473199 C124.09706,151.473199 118.045223,149.847312 112.708657,146.772329 L112.708657,146.772329 Z M107.923895,155.053476 C110.216395,156.378666 112.605676,157.490797 115.07964,158.385337 C109.377122,170.633893 97.1373485,178.571429 83.2734687,178.571429 C63.9218033,178.571429 48.1691815,162.835374 48.1691815,143.496981 L48.1691815,74.5554134 L78.4888574,92.0503277 L78.4888574,135.313145 C78.4888574,137.020629 79.4022283,138.599674 80.8796509,139.453416 L107.923895,155.053476 Z M36.4190595,151.46776 C23.8995283,151.46776 12.2480021,144.751151 5.98899256,133.933558 C1.30721131,125.820741 0.0551068452,116.370646 2.48672976,107.316446 C4.91684048,98.2622464 10.7176524,90.6979399 18.8427205,86.0152018 L38.6994619,74.5584354 L38.7024863,143.484893 C38.7024863,146.129227 38.929317,148.752406 39.390539,151.346876 C38.401558,151.429983 37.4080405,151.46776 36.4190595,151.46776 L36.4190595,151.46776 Z M113.68917,66.2735101 L83.3815914,83.7593583 L45.8819741,62.1302164 C45.1440188,61.7056119 44.3183557,61.4895318 43.486644,61.4895318 C42.6655176,61.4895318 41.8398545,61.7056119 41.0973628,62.1302164 L14.0576557,77.7302765 C11.7666676,79.0463994 9.60270476,80.5574473 7.59298661,82.2573765 C-0.170665179,71.1995268 -0.928278869,56.6345345 5.98853899,44.6413461 C12.2475482,33.820731 23.9066357,27.0920339 36.4307033,27.0920339 C42.5475658,27.0920339 48.6024277,28.7239658 53.9435298,31.8004598 L113.68917,66.2735101 L113.68917,66.2735101 Z M83.2737711,0 C102.63451,0 118.376546,15.7360545 118.376546,35.0820027 L118.376546,57.9985577 L58.6384673,23.5360845 C56.3459673,22.2078732 53.9551738,21.0927199 51.4736482,20.1951574 C57.1761667,7.94206845 69.4189646,0 83.2737711,0 Z M160.664858,44.652528 C170.33691,61.4040065 164.575415,82.8986652 147.809618,92.5663506 L88.0639777,127.036379 L88.0639777,92.0586387 L125.559058,70.4264747 C127.041018,69.5727324 127.954388,67.9936872 127.954388,66.284692 L127.954388,35.0845714 C127.957412,32.4493039 127.718485,29.8231021 127.266336,27.2376991 C128.247756,27.1515693 129.236737,27.1107708 130.228742,27.1107708 C142.749785,27.1107708 154.411897,33.8334238 160.664858,44.652528 L160.664858,44.652528 Z"></path>
15+
</g>
16+
</svg>
17+
);

src/components/icons/LinkIcon.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/components/icons/VisualTestsIcon.tsx

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/preset.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { watch } from 'node:fs';
22
import { readFile } from 'node:fs/promises';
3-
import { normalize, relative } from 'node:path';
3+
import { dirname, join, normalize, relative } from 'node:path';
44

55
import { type Configuration, getConfiguration, getGitInfo, type GitInfo } from 'chromatic/node';
66
import type { Channel } from 'storybook/internal/channels';
@@ -270,6 +270,13 @@ async function serverChannel(channel: Channel, options: Options & { configFile?:
270270
const config = {
271271
managerEntries,
272272
experimental_serverChannel: serverChannel,
273+
staticDirs: async (inputDirs: string[]) => [
274+
...inputDirs,
275+
{
276+
from: join(dirname(require.resolve('@chromatic-com/storybook/package.json')), 'assets'),
277+
to: 'addon-visual-tests-assets',
278+
},
279+
],
273280
env: async (
274281
env: Record<string, string>,
275282
{ configType }: { configType: 'DEVELOPMENT' | 'PRODUCTION' }

0 commit comments

Comments
 (0)