Skip to content

Commit efba54d

Browse files
Merge pull request #1066 from miloszsobczak/fix/nav-urls
fix: change some of the urls in the nav
2 parents d40d1f1 + 06f7973 commit efba54d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/theme/Navbar/Content/index.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import {
4444
useOrganizations,
4545
useFeatureFlags,
4646
} from "@site/src/hooks"
47-
import { resolveDocUrl } from "../../utils/resolveDocUrl"
47+
import { resolveDocUrl } from "@site/src/theme/utils/resolveDocUrl"
48+
import { useConfig } from "@site/src/contexts/config"
4849

4950
function useNavbarItems() {
5051
// TODO temporary casting until ThemeConfig type is improved
@@ -55,6 +56,7 @@ const LoggedOutNavbarContent = (): ReactNode => {
5556
const {
5657
navbar: { hideOnScroll },
5758
} = useThemeConfig()
59+
const { baseDomain } = useConfig()
5860
const { navbarRef } = useHideableNavbar(hideOnScroll)
5961

6062
const items = useNavbarItems()
@@ -125,12 +127,14 @@ const LoggedOutNavbarContent = (): ReactNode => {
125127
.filter((item): item is React.ReactElement => item !== null)
126128
}
127129

130+
const ACCOUNTS_URL = `https://accounts.${baseDomain}`
131+
128132
const drawerItems = [
129133
...renderDrawerItems(regularItems),
130134
<NavigationMenuItem key="sign-in">
131135
<MainNavigationButtonLink
132136
variant="secondary"
133-
href="https://accounts.upbound.io/login"
137+
href={`${ACCOUNTS_URL}/login`}
134138
className="w-full"
135139
>
136140
Sign In
@@ -139,7 +143,7 @@ const LoggedOutNavbarContent = (): ReactNode => {
139143
<NavigationMenuItem key="drawer-sign-up-free-link">
140144
<MainNavigationButtonLink
141145
variant="primary"
142-
href="https://accounts.upbound.io/register"
146+
href={`${ACCOUNTS_URL}/register`}
143147
className="w-full"
144148
>
145149
Sign Up Free
@@ -203,15 +207,15 @@ const LoggedOutNavbarContent = (): ReactNode => {
203207
<MainNavigationButtonLink
204208
className="hidden md:block"
205209
key="main-navigation-button-link-sign-in"
206-
href="https://accounts.upbound.io/login"
210+
href={`${ACCOUNTS_URL}/login`}
207211
variant="secondary"
208212
>
209213
Sign In
210214
</MainNavigationButtonLink>
211215
<MainNavigationButtonLink
212216
className="hidden md:block"
213217
key="main-navigation-button-link-sign-up-free"
214-
href="https://accounts.upbound.io/register"
218+
href={`${ACCOUNTS_URL}/register`}
215219
variant="primary"
216220
>
217221
Sign Up Free
@@ -248,14 +252,11 @@ const LoggedInNavbarContent = (): ReactNode => {
248252
const orgName = currentOrg?.name || ""
249253

250254
// Get base domain from Docusaurus config
251-
const baseDomain =
252-
typeof window !== "undefined"
253-
? (window as any).docusaurus?.siteConfig?.customFields?.baseDomain ||
254-
"upbound.io"
255-
: "upbound.io"
255+
const { baseDomain } = useConfig()
256256

257257
const ACCOUNTS_URL = `https://accounts.${baseDomain}`
258258
const CONSOLE_URL = `https://console.${baseDomain}`
259+
const MARKETPLACE_URL = `https://marketplace.${baseDomain}`
259260
const PORTAL_URL = `https://portal.${baseDomain}`
260261

261262
// Format organizations for the MainNavigationUser component
@@ -289,7 +290,7 @@ const LoggedInNavbarContent = (): ReactNode => {
289290
onDefaultMenuItemClick={(menuItem) => {
290291
switch (menuItem) {
291292
case "createOrganization":
292-
window.location.href = `${ACCOUNTS_URL}/create-org`
293+
window.location.href = `${ACCOUNTS_URL}/createOrg`
293294
break
294295
case "myAccount":
295296
window.location.href = `${ACCOUNTS_URL}/settings`
@@ -339,7 +340,7 @@ const LoggedInNavbarContent = (): ReactNode => {
339340
url: {
340341
home: { value: "/" },
341342
spaces: { value: `${CONSOLE_URL}/${orgName}/spaces` },
342-
marketplace: { value: "/providers" },
343+
marketplace: { value: `${MARKETPLACE_URL}/providers` },
343344
repositories: { value: `${CONSOLE_URL}/${orgName}/repositories` },
344345
consumerPortal: { value: `${PORTAL_URL}/${orgName}` },
345346
general: { value: `${ACCOUNTS_URL}/${orgName}/settings` },

0 commit comments

Comments
 (0)