|
1 | 1 | import React from 'react' |
2 | 2 | import { MessageFromWebviewType } from 'dvc/src/webview/contract' |
3 | 3 | import { sendMessage } from '../../shared/vscode' |
4 | | -import { EmptyState } from '../../shared/components/emptyState/EmptyState' |
5 | 4 | import { StartButton } from '../../shared/components/button/StartButton' |
6 | 5 |
|
7 | | -export type GetStartedProps = { |
8 | | - hasPlots?: boolean |
9 | | - hasSelectedPlots?: boolean |
10 | | - hasSelectedRevisions?: boolean |
| 6 | +const NoPlotsText: React.FC = () => <p>No Plots to Display.</p> |
| 7 | + |
| 8 | +export type AddPlotsProps = { |
| 9 | + hasSelectedPlots: boolean |
| 10 | + hasSelectedRevisions: boolean |
11 | 11 | } |
12 | 12 |
|
13 | | -export const GetStarted = ({ |
14 | | - hasPlots, |
| 13 | +export const AddPlots: React.FC<AddPlotsProps> = ({ |
15 | 14 | hasSelectedPlots, |
16 | 15 | hasSelectedRevisions |
17 | | -}: GetStartedProps) => { |
18 | | - return ( |
19 | | - <EmptyState> |
20 | | - <div> |
21 | | - <p>No Plots to Display.</p> |
22 | | - {hasPlots && ( |
23 | | - <div> |
24 | | - {!hasSelectedPlots && ( |
25 | | - <StartButton |
26 | | - onClick={() => |
27 | | - sendMessage({ |
28 | | - type: MessageFromWebviewType.SELECT_PLOTS |
29 | | - }) |
30 | | - } |
31 | | - text={'Add Plots'} |
32 | | - /> |
33 | | - )} |
34 | | - {!hasSelectedRevisions && ( |
35 | | - <StartButton |
36 | | - appearance={!hasSelectedPlots ? 'secondary' : 'primary'} |
37 | | - isNested={!hasSelectedPlots} |
38 | | - onClick={() => |
39 | | - sendMessage({ |
40 | | - type: MessageFromWebviewType.SELECT_EXPERIMENTS |
41 | | - }) |
42 | | - } |
43 | | - text={'Add Experiments'} |
44 | | - /> |
45 | | - )} |
46 | | - </div> |
47 | | - )} |
48 | | - {!hasPlots && ( |
49 | | - <div> |
50 | | - <p> |
51 | | - {'Learn how to '} |
52 | | - <a href="https://dvc.org/doc/studio/user-guide/views/visualize-experiments"> |
53 | | - visualize experiments |
54 | | - </a> |
55 | | - {' with DVC.'} |
56 | | - </p> |
57 | | - <p> |
58 | | - {'Learn about the '} |
59 | | - <a href="https://dvc.org/doc/command-reference/plots"> |
60 | | - plots commands |
61 | | - </a> |
62 | | - . |
63 | | - </p> |
64 | | - </div> |
65 | | - )} |
66 | | - </div> |
67 | | - </EmptyState> |
68 | | - ) |
69 | | -} |
| 16 | +}: AddPlotsProps) => ( |
| 17 | + <div> |
| 18 | + <NoPlotsText /> |
| 19 | + <div> |
| 20 | + {!hasSelectedPlots && ( |
| 21 | + <StartButton |
| 22 | + onClick={() => |
| 23 | + sendMessage({ |
| 24 | + type: MessageFromWebviewType.SELECT_PLOTS |
| 25 | + }) |
| 26 | + } |
| 27 | + text="Add Plots" |
| 28 | + /> |
| 29 | + )} |
| 30 | + {!hasSelectedRevisions && ( |
| 31 | + <StartButton |
| 32 | + appearance={!hasSelectedPlots ? 'secondary' : 'primary'} |
| 33 | + isNested={!hasSelectedPlots} |
| 34 | + onClick={() => |
| 35 | + sendMessage({ |
| 36 | + type: MessageFromWebviewType.SELECT_EXPERIMENTS |
| 37 | + }) |
| 38 | + } |
| 39 | + text="Add Experiments" |
| 40 | + /> |
| 41 | + )} |
| 42 | + </div> |
| 43 | + </div> |
| 44 | +) |
| 45 | + |
| 46 | +export const Welcome: React.FC = () => ( |
| 47 | + <div> |
| 48 | + <NoPlotsText /> |
| 49 | + <p> |
| 50 | + Learn how to{' '} |
| 51 | + <a href="https://dvc.org/doc/studio/user-guide/views/visualize-experiments"> |
| 52 | + visualize experiments |
| 53 | + </a>{' '} |
| 54 | + with DVC. |
| 55 | + </p> |
| 56 | + <p> |
| 57 | + Learn about the{' '} |
| 58 | + <a href="https://dvc.org/doc/command-reference/plots">plots commands</a>. |
| 59 | + </p> |
| 60 | + </div> |
| 61 | +) |
0 commit comments