Skip to content

Commit 0f0d1bb

Browse files
svenefftingeroboquat
authored andcommitted
[dashboard] usage in avatar menu
1 parent c9496a0 commit 0f0d1bb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

components/dashboard/src/Menu.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default function Menu() {
4242
const team = getCurrentTeam(location, teams);
4343
const { setCurrency, setIsStudent, setIsChargebeeCustomer } = useContext(PaymentContext);
4444
const [teamBillingMode, setTeamBillingMode] = useState<BillingMode | undefined>(undefined);
45+
const [userBillingMode, setUserBillingMode] = useState<BillingMode | undefined>(undefined);
4546
const { project, setProject } = useContext(ProjectContext);
4647
const [isFeedbackFormVisible, setFeedbackFormVisible] = useState<boolean>(false);
4748

@@ -51,6 +52,7 @@ export default function Menu() {
5152
getGitpodService()
5253
.server.getUserProjects()
5354
.then((projects) => setHasIndividualProjects(projects.length > 0));
55+
getGitpodService().server.getBillingModeForUser().then(setUserBillingMode);
5456
}, []);
5557

5658
const match = useRouteMatch<{ segment1?: string; segment2?: string; segment3?: string }>(
@@ -449,6 +451,14 @@ export default function Menu() {
449451
title: "Settings",
450452
link: "/settings",
451453
},
454+
...(BillingMode.showUsageBasedBilling(userBillingMode)
455+
? [
456+
{
457+
title: "Usage",
458+
link: "/usage",
459+
},
460+
]
461+
: []),
452462
{
453463
title: "Docs",
454464
href: "https://www.gitpod.io/docs/",

components/dashboard/src/settings/settings-menu.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
settingsPathTeams,
1717
settingsPathVariables,
1818
settingsPathSSHKeys,
19-
settingsPathUsage,
2019
} from "./settings.routes";
2120

2221
export default function getSettingsMenu(params: { userBillingMode?: BillingMode }) {
@@ -81,14 +80,6 @@ function renderBillingMenuEntries(billingMode?: BillingMode) {
8180
title: "Billing",
8281
link: [settingsPathBilling],
8382
},
84-
...(BillingMode.showUsageBasedBilling(billingMode)
85-
? [
86-
{
87-
title: "Usage",
88-
link: [settingsPathUsage],
89-
},
90-
]
91-
: []),
9283
// We need to allow access to "Team Plans" here, at least for owners.
9384
...(BillingMode.showTeamSubscriptionUI(billingMode)
9485
? [

components/dashboard/src/settings/settings.routes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const settingsPathAccount = "/account";
1111
export const settingsPathIntegrations = "/integrations";
1212
export const settingsPathNotifications = "/notifications";
1313
export const settingsPathBilling = "/billing";
14-
export const settingsPathUsage = "/usage";
1514
export const settingsPathPlans = "/plans";
1615
export const settingsPathPreferences = "/preferences";
1716

0 commit comments

Comments
 (0)