Skip to content

Commit 321d360

Browse files
authored
Merge pull request #371 from chromaui/fix-git-init
Onboarding: Fix Git initialization problem
2 parents 85c3db0 + fdbe074 commit 321d360

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

src/Panel.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,23 @@ export const Panel = ({ active, api }: PanelProps) => {
148148
);
149149
}
150150

151+
if (gitInfoError || !gitInfo) {
152+
return withProviders(<GitNotFound />);
153+
}
154+
151155
// Momentarily wait on addonState (should be very fast)
152156
if (projectInfoLoading) {
153157
return active ? <Spinner /> : null;
154158
}
155159

156-
if (!projectId)
160+
if (!projectId) {
157161
return withProviders(
158162
<LinkProject
159163
createdProjectId={createdProjectId}
160164
setCreatedProjectId={setCreatedProjectId}
161165
onUpdateProject={updateProject}
162166
/>
163167
);
164-
165-
if (gitInfoError || !gitInfo) {
166-
console.error(gitInfoError);
167-
return withProviders(<GitNotFound />);
168168
}
169169

170170
if (projectUpdatingFailed) {

src/components/Box.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export const Box = styled.div<{ warning?: boolean }>(
1818
warning && { background: theme.base === 'dark' ? '#342e1a' : theme.background.warning }
1919
);
2020

21-
export const BoxTitle = styled.b(() => ({
22-
display: 'block',
23-
marginBottom: 2,
24-
}));
21+
export const BoxList = styled.ul({
22+
margin: 0,
23+
padding: 4,
24+
listStylePosition: 'inside',
25+
});

src/preset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async function serverChannel(channel: Channel, options: Options & { configFile?:
201201
configFile: targetConfigFile,
202202
};
203203
} catch (err) {
204-
console.warn(`Failed to update your main configuration:\n\n ${err}`);
204+
console.warn(`Failed to update your main configuration:\n\n${err}`);
205205

206206
projectInfoState.value = {
207207
...projectInfoState.value,

src/screens/Errors/GitNotFound.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { LockIcon } from '@storybook/icons';
21
import React from 'react';
32

4-
import { Box, BoxTitle } from '../../components/Box';
3+
import { Box, BoxList } from '../../components/Box';
54
import { Code } from '../../components/Code';
65
import { Container } from '../../components/Container';
76
import { Link } from '../../components/design-system';
@@ -22,19 +21,25 @@ export const GitNotFound = () => {
2221
<Stack>
2322
<div>
2423
<VisualTestsIcon />
25-
<Heading>Visual tests</Heading>
24+
<Heading>Setup a Git repository</Heading>
2625
<Text center muted>
27-
Catch bugs in UI appearance automatically. Compare image snapshots to detect visual
28-
changes.
26+
Chromatic requires Git to associate test results with commits and branches.
2927
</Text>
3028
</div>
3129
<Box>
32-
<LockIcon style={{ flexShrink: 0 }} />
3330
<Text>
34-
<BoxTitle>Git not detected</BoxTitle>
35-
This addon requires Git to associate test results with commits and branches. Run{' '}
36-
<Code>git init</Code> and make your first commit
37-
<Code>git commit -m</Code> to get started!
31+
Run these steps to get started:
32+
<BoxList>
33+
<li>
34+
<Code>git init</Code>
35+
</li>
36+
<li>
37+
<Code>git add .</Code>
38+
</li>
39+
<li>
40+
<Code>git commit -m "Initial commit"</Code>
41+
</li>
42+
</BoxList>
3843
</Text>
3944
</Box>
4045
<Link

0 commit comments

Comments
 (0)