Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 6399055

Browse files
committed
feat: new onboarding
1 parent acfeb43 commit 6399055

37 files changed

+1281
-167
lines changed

apps/hub/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
},
5050
"devDependencies": {
5151
"@sentry/vite-plugin": "^2.22.2",
52+
"@shikijs/transformers": "^1.24.2",
5253
"@tanstack/router-vite-plugin": "^1.58.12",
5354
"@types/file-saver": "^2",
5455
"@types/mime": "^4.0.0",
@@ -58,6 +59,7 @@
5859
"@vitejs/plugin-react": "^4.2.1",
5960
"autoprefixer": "^10.4.19",
6061
"postcss": "^8.4.38",
62+
"shiki": "^1.24.2",
6163
"tailwindcss": "^3.4.1",
6264
"turnstile-types": "^1.2.1",
6365
"typescript": "^5.5.4",

apps/hub/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ declare module "@tanstack/react-router" {
2222
router: typeof router;
2323
}
2424
interface StaticDataRouteOption {
25-
layout?: "full" | "compact";
25+
layout?: "full" | "compact" | "onboarding";
2626
}
2727
}
2828

apps/hub/src/components/command-panel.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
CommandLoading,
88
cn,
99
} from "@rivet-gg/components";
10+
import { useIsFetching } from "@tanstack/react-query";
1011
import { useMatchRoute } from "@tanstack/react-router";
1112
import {
1213
type KeyboardEventHandler,
@@ -25,6 +26,7 @@ import { EnvironmentCommandPanelPage } from "./command-panel/command-panel-page/
2526
import { GroupCommandPanelPage } from "./command-panel/command-panel-page/group-command-panel-page";
2627
import { IndexCommandPanelPage } from "./command-panel/command-panel-page/index-command-panel-page";
2728
import { ProjectCommandPanelPage } from "./command-panel/command-panel-page/project-command-panel-page";
29+
import { ShimmerLine } from "./shimmer-line";
2830

2931
export function CommandPanel() {
3032
const [isOpen, setOpen] = useState(false);
@@ -125,6 +127,11 @@ export function CommandPanel() {
125127
[pages.length, search],
126128
);
127129

130+
const isLoading =
131+
useIsFetching({
132+
predicate: (query) => !query.queryKey.includes("watch"),
133+
}) > 0;
134+
128135
return (
129136
<>
130137
<Button
@@ -143,6 +150,7 @@ export function CommandPanel() {
143150
<CommandDialog
144151
commandProps={{
145152
onKeyDown: handleKeyDown,
153+
shouldFilter: !isLoading,
146154
}}
147155
open={isOpen}
148156
onOpenChange={setOpen}
@@ -154,11 +162,13 @@ export function CommandPanel() {
154162
placeholder="Type a command or search..."
155163
/>
156164
<CommandPanelNavigationProvider
165+
isLoading={isLoading}
157166
onClose={handleClose}
158167
onChangePage={handlePageChange}
159168
>
160169
<CommandList>
161170
<Suspense fallback={<CommandLoading>Hang on…</CommandLoading>}>
171+
{isLoading ? <ShimmerLine className="-top-[1px]" /> : null}
162172
<CommandEmpty>No results found.</CommandEmpty>
163173
{!page ? <IndexCommandPanelPage /> : null}
164174
{page?.key === "group" ? (

apps/hub/src/components/command-panel/command-panel-navigation-provider.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ export function CommandPanelNavigationProvider({
5656
children,
5757
onClose,
5858
onChangePage,
59+
isLoading,
5960
}: {
6061
children: ReactNode;
6162
onClose: () => void;
6263
onChangePage: (page: CommandPanelPage) => void;
64+
isLoading: boolean;
6365
}) {
6466
const routerNavigate = useNavigate();
6567

@@ -73,9 +75,16 @@ export function CommandPanelNavigationProvider({
7375
[onClose, routerNavigate],
7476
);
7577

78+
const handleChangePage = (page: CommandPanelPage) => {
79+
if (isLoading) {
80+
return;
81+
}
82+
onChangePage(page);
83+
};
84+
7685
return (
7786
<CommandPanelNavigationContext.Provider
78-
value={{ changePage: onChangePage, close: onClose, navigate }}
87+
value={{ changePage: handleChangePage, close: onClose, navigate }}
7988
>
8089
{children}
8190
</CommandPanelNavigationContext.Provider>

apps/hub/src/components/command-panel/command-panel-page/environment-command-panel-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function EnvironmentCommandPanelPage({
5151
},
5252
] = useSuspenseQueries({
5353
queries: [
54-
projectQueryOptions(projectNameId),
54+
projectQueryOptions(projectId),
5555
projectMetadataQueryOptions({ projectId, environmentId }),
5656
],
5757
});

apps/hub/src/components/error-component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const ErrorComponent = ({
6565
<Button
6666
onClick={() => {
6767
router.invalidate();
68+
queryClient.resetQueries();
69+
queryClient.invalidateQueries();
6870
reset?.();
6971
}}
7072
>

0 commit comments

Comments
 (0)