@@ -15,6 +15,8 @@ import PillLabel from "../components/PillLabel";
15
15
import { ProjectContext } from "./project-context" ;
16
16
import SelectWorkspaceClass from "../settings/selectClass" ;
17
17
import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode" ;
18
+ import Alert from "../components/Alert" ;
19
+ import { Link } from "react-router-dom" ;
18
20
19
21
export function getProjectSettingsMenu ( project ?: Project , team ?: Team ) {
20
22
const teamOrUserSlug = ! ! team ? "t/" + team . slug : "projects" ;
@@ -48,12 +50,14 @@ export function ProjectSettingsPage(props: { project?: Project; children?: React
48
50
49
51
export default function ( ) {
50
52
const { project, setProject } = useContext ( ProjectContext ) ;
51
- const [ teamBillingMode , setTeamBillingMode ] = useState < BillingMode | undefined > ( undefined ) ;
53
+ const [ billingMode , setBillingMode ] = useState < BillingMode | undefined > ( undefined ) ;
52
54
const { teams } = useContext ( TeamsContext ) ;
53
55
const team = getCurrentTeam ( useLocation ( ) , teams ) ;
54
56
useEffect ( ( ) => {
55
57
if ( team ) {
56
- getGitpodService ( ) . server . getBillingModeForTeam ( team . id ) . then ( setTeamBillingMode ) ;
58
+ getGitpodService ( ) . server . getBillingModeForTeam ( team . id ) . then ( setBillingMode ) ;
59
+ } else {
60
+ getGitpodService ( ) . server . getBillingModeForUser ( ) . then ( setBillingMode ) ;
57
61
}
58
62
} , [ team ] ) ;
59
63
@@ -156,13 +160,43 @@ export default function () {
156
160
</ div >
157
161
</ div >
158
162
</ div >
159
- { BillingMode . canSetWorkspaceClass ( teamBillingMode ) && (
160
- < SelectWorkspaceClass
161
- workspaceClass = { project . settings ?. workspaceClasses ?. regular }
162
- enabled = { BillingMode . canSetWorkspaceClass ( teamBillingMode ) }
163
- setWorkspaceClass = { setWorkspaceClass }
164
- />
165
- ) }
163
+ < div >
164
+ < h3 className = "mt-12" > Workspaces</ h3 >
165
+ < p className = "text-base text-gray-500 dark:text-gray-400" >
166
+ Choose the workspace machine type for your workspaces.
167
+ </ p >
168
+ { BillingMode . canSetWorkspaceClass ( billingMode ) ? (
169
+ < SelectWorkspaceClass
170
+ workspaceClass = { project . settings ?. workspaceClasses ?. regular }
171
+ setWorkspaceClass = { setWorkspaceClass }
172
+ />
173
+ ) : (
174
+ < Alert type = "message" className = "mt-4" >
175
+ < div className = "flex flex-col" >
176
+ < span >
177
+ To access{ " " }
178
+ < a
179
+ className = "gp-link"
180
+ href = "https://www.gitpod.io/docs/configure/workspaces/workspace-classes"
181
+ >
182
+ large workspaces
183
+ </ a > { " " }
184
+ and{ " " }
185
+ < a
186
+ className = "gp-link"
187
+ href = "https://www.gitpod.io/docs/configure/billing/pay-as-you-go"
188
+ >
189
+ pay-as-you-go
190
+ </ a >
191
+ , first cancel your existing plan.
192
+ </ span >
193
+ < Link className = "mt-2" to = { project . teamId ? "../billing" : "/plans" } >
194
+ < button > Go to { project . teamId ? "Team" : "Personal" } Billing</ button >
195
+ </ Link >
196
+ </ div >
197
+ </ Alert >
198
+ ) }
199
+ </ div >
166
200
</ ProjectSettingsPage >
167
201
) ;
168
202
}
0 commit comments