From 384a44f1f2686171ec5eb1b1c3937efe8894351d Mon Sep 17 00:00:00 2001 From: johnnyghost Date: Sun, 31 Jul 2022 21:07:33 +0100 Subject: [PATCH] refactor: update type for designer path config option --- apps/designer/app/dashboard/components/card.tsx | 3 +-- apps/designer/app/dashboard/dashboard.tsx | 3 +-- apps/designer/app/routes/dashboard/index.tsx | 14 +++++++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) 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; + 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(); + return ; };