Skip to content

Commit

Permalink
feat: move game tokens page under settings (#359)
Browse files Browse the repository at this point in the history
Closes MIS-265
  • Loading branch information
jog1t committed Sep 26, 2024
1 parent 6ee6a9a commit d3f3c2a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 39 deletions.
7 changes: 1 addition & 6 deletions apps/hub/src/components/header/links/header-game-links.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { faCircleDollar, faFolder, faGear, faKey } from "@rivet-gg/icons";
import { faCircleDollar, faFolder, faGear } from "@rivet-gg/icons";
import { Link } from "@tanstack/react-router";
import { HeaderLink } from "../header-link";

Expand All @@ -18,11 +18,6 @@ export function HeaderGameLinks({ gameId }: HeaderGameLinksProps) {
Environments
</Link>
</HeaderLink>
<HeaderLink icon={faKey}>
<Link to="/games/$gameId/tokens" params={{ gameId }}>
Tokens
</Link>
</HeaderLink>
<HeaderLink icon={faCircleDollar}>
<Link to="/games/$gameId/billing" params={{ gameId }}>
Billing
Expand Down
10 changes: 9 additions & 1 deletion apps/hub/src/domains/game/layouts/game-settings-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ function GroupSettingsPage({ children, gameId }: GroupPageProps) {
<SidebarNavigation>
<Link
to="/games/$gameId/settings"
activeOptions={{ exact: true }}
params={{ gameId }}
className="text-foreground font-semibold"
className="aria-current-page:text-foreground aria-current-page:font-semibold"
>
General
</Link>
<Link
to="/games/$gameId/settings/tokens"
params={{ gameId }}
className="aria-current-page:text-foreground aria-current-page:font-semibold"
>
Tokens
</Link>
</SidebarNavigation>
}
>
Expand Down
20 changes: 20 additions & 0 deletions apps/hub/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { Route as AuthenticatedLayoutGamesGameIdBillingImport } from './routes/_
import { Route as AuthenticatedLayoutTeamsGroupIdSettingsIndexImport } from './routes/_authenticated/_layout/teams/$groupId/settings/index'
import { Route as AuthenticatedLayoutGamesGameIdSettingsIndexImport } from './routes/_authenticated/_layout/games/$gameId/settings/index'
import { Route as AuthenticatedLayoutGamesGameIdEnvironmentsNamespaceIdImport } from './routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId'
import { Route as AuthenticatedLayoutGamesGameIdSettingsTokensImport } from './routes/_authenticated/_layout/games/$gameId/settings/tokens'
import { Route as AuthenticatedLayoutGamesGameIdNamespacesSplatImport } from './routes/_authenticated/_layout/games/$gameId/namespaces/$'
import { Route as AuthenticatedLayoutGamesGameIdEnvironmentsNamespaceIdIndexImport } from './routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/index'
import { Route as AuthenticatedLayoutGamesGameIdEnvironmentsNamespaceIdVersionsImport } from './routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/versions'
Expand Down Expand Up @@ -197,6 +198,12 @@ const AuthenticatedLayoutGamesGameIdEnvironmentsNamespaceIdRoute =
getParentRoute: () => AuthenticatedLayoutRoute,
} as any)

const AuthenticatedLayoutGamesGameIdSettingsTokensRoute =
AuthenticatedLayoutGamesGameIdSettingsTokensImport.update({
path: '/tokens',
getParentRoute: () => AuthenticatedLayoutGamesGameIdSettingsRoute,
} as any)

const AuthenticatedLayoutGamesGameIdNamespacesSplatRoute =
AuthenticatedLayoutGamesGameIdNamespacesSplatImport.update({
path: '/namespaces/$',
Expand Down Expand Up @@ -495,6 +502,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedLayoutGamesGameIdNamespacesSplatImport
parentRoute: typeof AuthenticatedLayoutGamesGameIdImport
}
'/_authenticated/_layout/games/$gameId/settings/tokens': {
id: '/_authenticated/_layout/games/$gameId/settings/tokens'
path: '/tokens'
fullPath: '/games/$gameId/settings/tokens'
preLoaderRoute: typeof AuthenticatedLayoutGamesGameIdSettingsTokensImport
parentRoute: typeof AuthenticatedLayoutGamesGameIdSettingsImport
}
'/_authenticated/_layout/games/$gameId/environments/$namespaceId': {
id: '/_authenticated/_layout/games/$gameId/environments/$namespaceId'
path: '/games/$gameId/environments/$namespaceId'
Expand Down Expand Up @@ -654,6 +668,7 @@ export const routeTree = rootRoute.addChildren({
AuthenticatedLayoutGamesGameIdBillingRoute,
AuthenticatedLayoutGamesGameIdSettingsRoute:
AuthenticatedLayoutGamesGameIdSettingsRoute.addChildren({
AuthenticatedLayoutGamesGameIdSettingsTokensRoute,
AuthenticatedLayoutGamesGameIdSettingsIndexRoute,
}),
AuthenticatedLayoutGamesGameIdTokensRoute,
Expand Down Expand Up @@ -807,6 +822,7 @@ export const routeTree = rootRoute.addChildren({
"filePath": "_authenticated/_layout/games/$gameId/settings.tsx",
"parent": "/_authenticated/_layout/games/$gameId",
"children": [
"/_authenticated/_layout/games/$gameId/settings/tokens",
"/_authenticated/_layout/games/$gameId/settings/"
]
},
Expand Down Expand Up @@ -841,6 +857,10 @@ export const routeTree = rootRoute.addChildren({
"filePath": "_authenticated/_layout/games/$gameId/namespaces/$.tsx",
"parent": "/_authenticated/_layout/games/$gameId"
},
"/_authenticated/_layout/games/$gameId/settings/tokens": {
"filePath": "_authenticated/_layout/games/$gameId/settings/tokens.tsx",
"parent": "/_authenticated/_layout/games/$gameId/settings"
},
"/_authenticated/_layout/games/$gameId/environments/$namespaceId": {
"filePath": "_authenticated/_layout/games/$gameId_/environments/$namespaceId.tsx",
"parent": "/_authenticated/_layout",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Button, DocsCard, Grid, Text } from "@rivet-gg/components";
import { Link, createFileRoute } from "@tanstack/react-router";

function CloudTokenCard() {
return (
<>
<DocsCard
title="Cloud token"
href="https://rivet.gg/docs/general/concepts/token-types#cloud"
footer={
<Button asChild>
<Link search={{ modal: "cloud-token" }}>Generate</Link>
</Button>
}
>
<Text>
Cloud tokens are used to access Rivet Cloud. They are used by the
client to access Rivet Cloud.
</Text>
</DocsCard>
</>
);
}

function GameTokensRoute() {
return (
<Grid columns={{ initial: "1", md: "2" }} gap="4" items="start">
<CloudTokenCard />
</Grid>
);
}

export const Route = createFileRoute(
"/_authenticated/_layout/games/$gameId/settings/tokens",
)({
component: GameTokensRoute,
});
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
import { Button, DocsCard, Grid, Text } from "@rivet-gg/components";
import { Link, createFileRoute } from "@tanstack/react-router";

function CloudTokenCard() {
return (
<>
<DocsCard
title="Cloud token"
href="https://rivet.gg/docs/general/concepts/token-types#cloud"
footer={
<Button asChild>
<Link search={{ modal: "cloud-token" }}>Generate</Link>
</Button>
}
>
<Text>
Cloud tokens are used to access Rivet Cloud. They are used by the
client to access Rivet Cloud.
</Text>
</DocsCard>
</>
);
}

function GameTokensRoute() {
return (
<Grid columns={{ initial: "1", md: "2" }} gap="4" items="start">
<CloudTokenCard />
</Grid>
);
}
import { createFileRoute, redirect } from "@tanstack/react-router";

export const Route = createFileRoute(
"/_authenticated/_layout/games/$gameId/tokens",
)({
component: GameTokensRoute,
loader: ({ params }) => {
throw redirect({
to: "/games/$gameId/settings/tokens",
params,
});
},
});
1 change: 1 addition & 0 deletions apps/hub/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
"./src/lib/**/*.{ts,tsx}",
"./src/**/hooks/**/*.{ts,tsx}",
"./src/**/forms/**/*.{ts,tsx}",
"./src/**/layouts/**/*.{ts,tsx}",
"../../node_modules/@rivet-gg/components/**/*.{ts,tsx}",
],
presets: [require("@rivet-gg/components/tailwind-base")],
Expand Down

0 comments on commit d3f3c2a

Please sign in to comment.