Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

refactor: update type for designer path config option

johnnyghost384a44f1f268
diff --git a/apps/designer/app/dashboard/components/card.tsx b/apps/designer/app/dashboard/components/card.tsx
index aaf238c5b8..cd0863cd8b 100644
--- a/apps/designer/app/dashboard/components/card.tsx
+++ b/apps/designer/app/dashboard/components/card.tsx
@@ -1,7 +1,6 @@
import { useState } from "react";
import { Form, useTransition } from "@remix-run/react";
import { useNavigate } from "react-router-dom";
-
import {
Flex,
Card,
@@ -14,7 +13,7 @@ import {
type SelectProjectProjectCardProps = {
projects: Array<{ id: string; title: string }>;
- config: { designerPath: "string" };
+ config: { designerPath: string };
errors: string;
};
diff --git a/apps/designer/app/dashboard/dashboard.tsx b/apps/designer/app/dashboard/dashboard.tsx
index 3066b751cf..0848e102d9 100644
--- a/apps/designer/app/dashboard/dashboard.tsx
+++ b/apps/designer/app/dashboard/dashboard.tsx
@@ -6,7 +6,6 @@ import dashboardStyles from "./dashboard.css";
import { User } from "@webstudio-is/prisma-client";
import { DashboardHeader } from "./components/header";
import { SelectProjectCard } from "./components/card";
-
export const links = () => {
return [
{
@@ -23,7 +22,7 @@ export const links = () => {
type DashboardProps = {
projects?: Array<{ id: string; title: string }>;
user: User;
- config: { designerPath: "string" };
+ config: { designerPath: string };
};
export const Dashboard = ({ projects = [], config, user }: DashboardProps) => {
diff --git a/apps/designer/app/routes/dashboard/index.tsx b/apps/designer/app/routes/dashboard/index.tsx
index 92d903e1bf..be78276a44 100644
--- a/apps/designer/app/routes/dashboard/index.tsx
+++ b/apps/designer/app/routes/dashboard/index.tsx
@@ -7,16 +7,23 @@ import {
} from "@remix-run/node";
import { Dashboard, links } from "~/dashboard";
import * as db from "~/shared/db";
-import config from "~/config";
+import config, { type Config } from "~/config";
import { ensureUserCookie } from "~/shared/session";
import { authenticator } from "~/services/auth.server";
import { zfd } from "zod-form-data";
-export { links };
+import { User, type Project } from "@webstudio-is/prisma-client";
+export { links };
const schema = zfd.formData({
project: zfd.text(),
});
+type Data = {
+ config: Config;
+ projects: Array<Project>;
+ user: User;
+};
+
export const action: ActionFunction = async ({ request }) => {
const { project: title } = schema.parse(await request.formData());
@@ -47,7 +54,8 @@ export const loader: LoaderFunction = async ({ request }) => {
};
const DashboardRoute = () => {
- const { config, projects, user } = useLoaderData();
+ const { config, projects, user } = useLoaderData<Data>();
+
return <Dashboard config={config} user={user} projects={projects} />;
};