From eb0af951b8d0913eff1c8f0f9a48998feaa5f060 Mon Sep 17 00:00:00 2001
From: Kacper Wojciechowski <39823706+jog1t@users.noreply.github.com>
Date: Tue, 3 Sep 2024 21:31:39 +0200
Subject: [PATCH] ui minor changes
---
apps/hub/src/app.tsx | 1 +
.../src/components/featured-modules-grid.tsx | 2 +-
apps/hub/src/components/module-card.tsx | 29 ++++++---
.../game/helpers/try-create-backend.ts | 6 +-
.../$gameId_/environments/$namespaceId.tsx | 1 -
.../environments/$namespaceId/index.tsx | 5 +-
.../$namespaceId/modules.lazy.tsx | 63 +++++++++++--------
7 files changed, 68 insertions(+), 39 deletions(-)
diff --git a/apps/hub/src/app.tsx b/apps/hub/src/app.tsx
index 8d41ed3a..dfcd9709 100644
--- a/apps/hub/src/app.tsx
+++ b/apps/hub/src/app.tsx
@@ -34,6 +34,7 @@ export const router = createRouter({
},
// Since we're using React Query, we don't want loader calls to ever be stale
// This will ensure that the loader is always called when the route is preloaded or visited
+ defaultPreload: "intent",
defaultPreloadStaleTime: 0,
defaultOnCatch: (error) => {
Sentry.captureException(error);
diff --git a/apps/hub/src/components/featured-modules-grid.tsx b/apps/hub/src/components/featured-modules-grid.tsx
index 1503eada..7f444c9e 100644
--- a/apps/hub/src/components/featured-modules-grid.tsx
+++ b/apps/hub/src/components/featured-modules-grid.tsx
@@ -34,7 +34,7 @@ export function FeaturesModulesGrid({ footer }: FeaturesModulesGridProps) {
))}
- {footer}
+ {footer ?
{footer}
: null}
);
}
diff --git a/apps/hub/src/components/module-card.tsx b/apps/hub/src/components/module-card.tsx
index 3f25bb71..a6fb5f59 100644
--- a/apps/hub/src/components/module-card.tsx
+++ b/apps/hub/src/components/module-card.tsx
@@ -4,19 +4,21 @@ import {
library,
} from "@fortawesome/fontawesome-svg-core";
import { fab } from "@fortawesome/free-brands-svg-icons";
-import { fas } from "@fortawesome/pro-solid-svg-icons";
+import { faExternalLink, fas } from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Card,
CardDescription,
CardHeader,
CardTitle,
+ Link,
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle,
SheetTrigger,
+ Text,
} from "@rivet-gg/components";
import { motion } from "framer-motion";
@@ -82,13 +84,24 @@ export function ModuleCard({
- {name} in OpenGB Docs
-
-
+ {name}
+
+
+ Open in New Tab
+
+
+
+
+
+
diff --git a/apps/hub/src/domains/game/helpers/try-create-backend.ts b/apps/hub/src/domains/game/helpers/try-create-backend.ts
index 59262900..745fa5e4 100644
--- a/apps/hub/src/domains/game/helpers/try-create-backend.ts
+++ b/apps/hub/src/domains/game/helpers/try-create-backend.ts
@@ -7,7 +7,11 @@ export async function tryCreateBackend({
gameId,
environmentId,
queryClient,
-}: { gameId: string; environmentId: string; queryClient: QueryClient }) {
+}: {
+ gameId: string;
+ environmentId: string;
+ queryClient: QueryClient;
+}) {
try {
await queryClient.fetchQuery(
gameBackendQueryOptions({ gameId, environmentId }),
diff --git a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId.tsx b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId.tsx
index c8f5108f..e585ae20 100644
--- a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId.tsx
+++ b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId.tsx
@@ -66,7 +66,6 @@ function NamespaceIdRoute() {
}
const searchSchema = z.object({
modal: z.enum(["database", "create-server"]).or(z.string()).optional(),
- search: z.string().optional(),
});
export const Route = createFileRoute(
"/_authenticated/_layout/games/$gameId/environments/$namespaceId",
diff --git a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/index.tsx b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/index.tsx
index bb12ad24..4d0ea55b 100644
--- a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/index.tsx
+++ b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/index.tsx
@@ -6,6 +6,8 @@ import {
gameNamespaceQueryOptions,
gameVersionQueryOptions,
} from "@/domains/game/queries";
+import { faArrowRight } from "@fortawesome/pro-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Button,
Grid,
@@ -41,7 +43,8 @@ function NamespaceIdRoute() {
to="/games/$gameId/environments/$namespaceId/modules"
params={params}
>
- View all modules
+ View All Modules
+
}
diff --git a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/modules.lazy.tsx b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/modules.lazy.tsx
index da83f4ae..c1929754 100644
--- a/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/modules.lazy.tsx
+++ b/apps/hub/src/routes/_authenticated/_layout/games/$gameId_/environments/$namespaceId/modules.lazy.tsx
@@ -1,5 +1,9 @@
import { ModuleCard } from "@/components/module-card";
-import { faBellConcierge, faUpload } from "@fortawesome/pro-solid-svg-icons";
+import {
+ faBellConcierge,
+ faHammer,
+ faPlus,
+} from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Button,
@@ -18,20 +22,22 @@ import {
SidebarPage,
cn,
} from "@rivet-gg/components";
-import { Link, createLazyFileRoute, useNavigate } from "@tanstack/react-router";
+import { Link, createLazyFileRoute } from "@tanstack/react-router";
import { LayoutGroup, motion } from "framer-motion";
+import { useState } from "react";
import OpenGBMeta from "../../../../../../../../vendor/opengb-modules-meta.json";
function GameIdModules() {
- const navigate = useNavigate();
- const search = Route.useSearch({ select: (s) => s.search || "" });
+ const [query, setQuery] = useState("");
const categories = OpenGBMeta.categories
.map((category) => {
const modules = category.modules.filter(
(module) =>
- module.name.toLowerCase().includes(search.toLowerCase()) ||
- module.description.toLowerCase().includes(search.toLowerCase()),
+ module.name.toLowerCase().includes((query || "").toLowerCase()) ||
+ module.description
+ .toLowerCase()
+ .includes((query || "").toLowerCase()),
);
return { ...category, modules };
})
@@ -40,9 +46,9 @@ function GameIdModules() {
return (
<>