1
1
import Paper from "@material-ui/core/Paper"
2
2
import { makeStyles } from "@material-ui/core/styles"
3
+ import Typography from "@material-ui/core/Typography"
3
4
import React from "react"
4
5
5
6
import * as API from "../../api"
@@ -8,19 +9,187 @@ export interface WorkspaceProps {
8
9
workspace : API . Workspace
9
10
}
10
11
12
+ const useStatusStyles = makeStyles ( ( theme ) => {
13
+
14
+ const common = {
15
+ width : theme . spacing ( 1 ) ,
16
+ height : theme . spacing ( 1 ) ,
17
+ borderRadius : "100%" ,
18
+ backgroundColor : theme . palette . action . disabled ,
19
+ transition : "background-color 200ms ease" ,
20
+ } ;
21
+
22
+ return {
23
+ inactive : common ,
24
+ active : {
25
+ ...common ,
26
+ backgroundColor : theme . palette . primary . main ,
27
+ }
28
+ }
29
+ } )
30
+
31
+ /**
32
+ * A component that displays the Dev URL indicator. The indicator status represents
33
+ * loading, online, offline, or error.
34
+ */
35
+ export const StatusIndicator : React . FC < { status : ResourceStatus } > = ( { status } ) => {
36
+ const styles = useStatusStyles ( )
37
+
38
+ const className = status === "active" ? styles . active : styles . inactive
39
+ return (
40
+ < div className = { className } />
41
+ )
42
+ }
43
+
44
+
45
+ type ResourceStatus = "active" | "inactive"
46
+
47
+ export interface ResourceRowProps {
48
+ name : string
49
+ icon : string
50
+ //href: string
51
+ status : ResourceStatus
52
+ }
53
+
54
+ const ResourceIconSize = 20
55
+
56
+ export const ResourceRow : React . FC < ResourceRowProps > = ( { icon, /*href,*/ name, status } ) => {
57
+ const styles = useResourceRowStyles ( )
58
+
59
+ return < div className = { styles . root } >
60
+ < div className = { styles . iconContainer } >
61
+ < img src = { icon } height = { ResourceIconSize } width = { ResourceIconSize } />
62
+ </ div >
63
+ < div className = { styles . nameContainer } >
64
+ { name }
65
+ </ div >
66
+ < div className = { styles . statusContainer } >
67
+ < StatusIndicator status = { status } />
68
+ </ div >
69
+ </ div >
70
+ }
71
+
72
+ const useResourceRowStyles = makeStyles ( ( theme ) => ( {
73
+ root : {
74
+ display : "flex" ,
75
+ flexDirection : "row" ,
76
+ justifyContent : "center" ,
77
+ alignItems : "center" ,
78
+ } ,
79
+ iconContainer : {
80
+ width : ResourceIconSize + theme . spacing ( 1 ) ,
81
+ height : ResourceIconSize + theme . spacing ( 1 ) ,
82
+ display : "flex" ,
83
+ justifyContent : "center" ,
84
+ alignItems : "center" ,
85
+ flex : 0 ,
86
+ } ,
87
+ nameContainer : {
88
+ margin : theme . spacing ( 1 ) ,
89
+ paddingLeft : theme . spacing ( 1 ) ,
90
+ flex : 1 ,
91
+ width : "100%" ,
92
+ } ,
93
+ statusContainer : {
94
+ width : 24 ,
95
+ height : 24 ,
96
+ flex : 0 ,
97
+ display : "flex" ,
98
+ justifyContent : "center" ,
99
+ alignItems : "center" ,
100
+ }
101
+ } ) )
102
+
103
+ export const Title : React . FC = ( { children } ) => {
104
+ const styles = useTitleStyles ( ) ;
105
+
106
+ return < div className = { styles . header } >
107
+ < Typography variant = "h6" > { children } </ Typography >
108
+ </ div >
109
+ }
110
+
111
+ const useTitleStyles = makeStyles ( ( theme ) => ( {
112
+ header : {
113
+ alignItems : "center" ,
114
+ borderBottom : `1px solid ${ theme . palette . divider } ` ,
115
+ display : "flex" ,
116
+ height : theme . spacing ( 6 ) ,
117
+ justifyContent : "space-between" ,
118
+ marginBottom : theme . spacing ( 2 ) ,
119
+ marginTop : - theme . spacing ( 1 ) ,
120
+ paddingBottom : theme . spacing ( 1 ) ,
121
+ paddingLeft : Constants . CardPadding + theme . spacing ( 1 ) ,
122
+ paddingRight : Constants . CardPadding / 2 ,
123
+ } ,
124
+ } ) )
125
+
126
+ import Timeline from "@material-ui/lab/Timeline"
127
+ import TimelineItem from '@material-ui/lab/TimelineItem' ;
128
+ import TimelineSeparator from '@material-ui/lab/TimelineSeparator' ;
129
+ import TimelineConnector from '@material-ui/lab/TimelineConnector' ;
130
+ import TimelineContent from '@material-ui/lab/TimelineContent' ;
131
+ import TimelineDot from '@material-ui/lab/TimelineDot' ;
132
+
133
+ export const WorkspaceTimeline : React . FC = ( ) => {
134
+ return < Timeline >
135
+ < TimelineItem >
136
+ < TimelineSeparator >
137
+ < TimelineDot />
138
+ < TimelineConnector />
139
+ </ TimelineSeparator >
140
+ < TimelineContent > Eat</ TimelineContent >
141
+ </ TimelineItem >
142
+ < TimelineItem >
143
+ < TimelineSeparator >
144
+ < TimelineDot />
145
+ < TimelineConnector />
146
+ </ TimelineSeparator >
147
+ < TimelineContent > Code</ TimelineContent >
148
+ </ TimelineItem >
149
+ < TimelineItem >
150
+ < TimelineSeparator >
151
+ < TimelineDot />
152
+ </ TimelineSeparator >
153
+ < TimelineContent > Sleep</ TimelineContent >
154
+ </ TimelineItem >
155
+ </ Timeline >
156
+ }
157
+
11
158
export const Workspace : React . FC < WorkspaceProps > = ( { workspace } ) => {
12
159
const styles = useStyles ( )
13
160
14
161
return < div className = { styles . root } >
15
162
< Paper elevation = { 0 } className = { styles . section } >
16
- < div > Hello</ div >
163
+ < Typography variant = "h4" > { workspace . name } </ Typography >
164
+ < Typography variant = "body2" color = "textSecondary" >
165
+ { "TODO: Project" }
166
+ </ Typography >
17
167
</ Paper >
18
168
< div className = { styles . horizontal } >
19
- < Paper elevation = { 0 } className = { styles . sideBar } >
20
- < div > Apps</ div >
21
- </ Paper >
169
+ < div className = { styles . sideBar } >
170
+ < Paper elevation = { 0 } className = { styles . section } >
171
+ < Title > Applications</ Title >
172
+
173
+ < div className = { styles . vertical } >
174
+ < ResourceRow name = { "Code Web" } icon = { "/static/vscode.svg" } status = { "active" } />
175
+ < ResourceRow name = { "Terminal" } icon = { "/static/terminal.svg" } status = { "active" } />
176
+ < ResourceRow name = { "React App" } icon = { "/static/react-icon.svg" } status = { "active" } />
177
+
178
+ </ div >
179
+ </ Paper >
180
+ < Paper elevation = { 0 } className = { styles . section } >
181
+ < Title > Resources</ Title >
182
+
183
+ < div className = { styles . vertical } >
184
+ < ResourceRow name = { "GCS Bucket" } icon = { "/static/google-storage-logo.svg" } status = { "active" } />
185
+ < ResourceRow name = { "Windows (x64 - VM)" } icon = { "/static/windows-logo.svg" } status = { "active" } />
186
+ < ResourceRow name = { "OSX (M1 - Physical)" } icon = { "/static/apple-logo.svg" } status = { "active" } />
187
+ </ div >
188
+ </ Paper >
189
+ </ div >
22
190
< Paper elevation = { 0 } className = { styles . main } >
23
- < div > Build stuff</ div >
191
+ < Title > Timeline</ Title >
192
+ < WorkspaceTimeline />
24
193
</ Paper >
25
194
</ div >
26
195
</ div >
@@ -49,9 +218,14 @@ export const useStyles = makeStyles((theme) => {
49
218
display : "flex" ,
50
219
flexDirection : "row"
51
220
} ,
221
+ vertical : {
222
+ display : "flex" ,
223
+ flexDirection : "column"
224
+ } ,
52
225
section : common ,
53
226
sideBar : {
54
- ...common ,
227
+ display : "flex" ,
228
+ flexDirection : "column" ,
55
229
width : "400px"
56
230
} ,
57
231
main : {
0 commit comments