@@ -14,8 +14,10 @@ import getSettingsMenu from "./settings-menu";
14
14
import { trackEvent } from "../Analytics" ;
15
15
import { PaymentContext } from "../payment-context" ;
16
16
import SelectIDE from "./SelectIDE" ;
17
+ import { WorkspaceClasses } from "@gitpod/gitpod-protocol" ;
17
18
18
19
type Theme = "light" | "dark" | "system" ;
20
+ type WorkspaceClass = "standard" | "XL" ;
19
21
20
22
export default function Preferences ( ) {
21
23
const { user } = useContext ( UserContext ) ;
@@ -50,6 +52,26 @@ export default function Preferences() {
50
52
}
51
53
} ;
52
54
55
+ const [ workspaceClass , setWorkspaceClass ] = useState < WorkspaceClass > (
56
+ user ?. additionalData ?. workspaceClasses ?. regular || "standard" ,
57
+ ) ;
58
+ const actuallySetWorkspaceClass = async ( value : string ) => {
59
+ const additionalData = user ?. additionalData || { } ;
60
+ const prevWorkspaceClass = additionalData ?. workspaceClasses ?. regular || "standard" ;
61
+ const workspaceClasses = ( additionalData ?. workspaceClasses || { } ) as WorkspaceClasses ;
62
+ workspaceClasses . regular = value ;
63
+ workspaceClasses . prebuild = value ;
64
+ additionalData . workspaceClasses = workspaceClasses ;
65
+ if ( value !== prevWorkspaceClass ) {
66
+ await getGitpodService ( ) . server . updateLoggedInUser ( { additionalData } ) ;
67
+ trackEvent ( "workspace_class_changed" , {
68
+ previous : prevWorkspaceClass ,
69
+ current : value ,
70
+ } ) ;
71
+ setWorkspaceClass ( value ) ;
72
+ }
73
+ } ;
74
+
53
75
return (
54
76
< div >
55
77
< PageWithSubMenu
@@ -115,9 +137,7 @@ export default function Preferences() {
115
137
</ SelectableCardSolid >
116
138
</ div >
117
139
118
- < h3 className = "mt-12" >
119
- Dotfiles{ " " }
120
- </ h3 >
140
+ < h3 className = "mt-12" > Dotfiles </ h3 >
121
141
< p className = "text-base text-gray-500 dark:text-gray-400" > Customize workspaces using dotfiles.</ p >
122
142
< div className = "mt-4 max-w-xl" >
123
143
< h4 > Repository URL</ h4 >
@@ -141,6 +161,48 @@ export default function Preferences() {
141
161
</ p >
142
162
</ div >
143
163
</ div >
164
+
165
+ < h3 className = "mt-12" > Workspaces</ h3 >
166
+ < p className = "text-base text-gray-500 dark:text-gray-400" >
167
+ Choose the workspace machine type for your workspaces.
168
+ </ p >
169
+ < div className = "mt-4 space-x-3 flex" >
170
+ < SelectableCardSolid
171
+ className = "w-36 h-32"
172
+ title = "Standard"
173
+ selected = { workspaceClass === "standard" }
174
+ onClick = { ( ) => actuallySetWorkspaceClass ( "standard" ) }
175
+ >
176
+ < div className = "flex-grow flex items-end p-1" >
177
+ < svg width = "112" height = "64" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
178
+ < path
179
+ d = "M0 8a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8ZM0 32a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8ZM0 56a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8ZM40 6a6 6 0 0 1 6-6h60a6 6 0 0 1 6 6v28a6 6 0 0 1-6 6H46a6 6 0 0 1-6-6V6Z"
180
+ fill = "#D6D3D1"
181
+ />
182
+ </ svg >
183
+ </ div >
184
+ </ SelectableCardSolid >
185
+ < SelectableCardSolid
186
+ className = "w-36 h-32"
187
+ title = "XL"
188
+ selected = { workspaceClass === "XL" }
189
+ onClick = { ( ) => actuallySetWorkspaceClass ( "XL" ) }
190
+ >
191
+ < div className = "flex-grow flex items-end p-1" >
192
+ < svg width = "112" height = "64" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
193
+ < path
194
+ d = "M0 8a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8ZM40 6a6 6 0 0 1 6-6h60a6 6 0 0 1 6 6v28a6 6 0 0 1-6 6H46a6 6 0 0 1-6-6V6Z"
195
+ fill = "#D9D9D9"
196
+ />
197
+ < path
198
+ d = "M84 0h22a6 6 0 0 1 6 6v28a6 6 0 0 1-6 6H68L84 0ZM0 32a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8Z"
199
+ fill = "#78716C"
200
+ />
201
+ < path d = "M0 56a8 8 0 0 1 8-8h16a8 8 0 1 1 0 16H8a8 8 0 0 1-8-8Z" fill = "#D9D9D9" />
202
+ </ svg >
203
+ </ div >
204
+ </ SelectableCardSolid >
205
+ </ div >
144
206
</ PageWithSubMenu >
145
207
</ div >
146
208
) ;
0 commit comments