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.

merge with main

Roman Pominov6e50c822f78c
diff --cc apps/designer/app/designer/designer.tsx
index 1313ef0225,23d495d110..c04ca5110e
--- a/apps/designer/app/designer/designer.tsx
+++ b/apps/designer/app/designer/designer.tsx
@@@ -4,7 -4,7 +4,6 @@@ import
usePublish,
type Publish,
} from "@webstudio-is/react-sdk";
- import { type Project, type Asset } from "@webstudio-is/prisma-client";
-import { type Project } from "@webstudio-is/prisma-client";
import type { Config } from "~/config";
import type {
HoveredInstanceData,
@@@ -220,11 -219,10 +219,10 @@@ const NavigatorPanel = ({ publish, isPr
type DesignerProps = {
config: Config;
- project: Project;
+ project: db.project.Project;
- assets: Array<Asset>;
};
- export const Designer = ({ config, project, assets }: DesignerProps) => {
+ export const Designer = ({ config, project }: DesignerProps) => {
useSubscribeSyncStatus();
useSubscribeRootInstance();
useSubscribeSelectedInstanceData();
diff --cc apps/designer/app/routes/designer/$id.tsx
index d7e81695a1,ad594f42fe..a96652b520
--- a/apps/designer/app/routes/designer/$id.tsx
+++ b/apps/designer/app/routes/designer/$id.tsx
@@@ -19,30 -16,24 +16,28 @@@ import { useEffect } from "react"
export { links };
-export const loader: LoaderFunction = async ({ params }) => {
+type Data = {
+ config: typeof config;
+ project: db.project.Project;
- assets: Asset[];
+ env: Env;
+};
+
+type Error = {
+ errors: string;
+};
+
+export const loader: LoaderFunction = async ({
+ params,
+}): Promise<Data | Error> => {
if (params.id === undefined) throw new Error("Project id undefined");
const project = await db.project.loadById(params.id);
- const assets = await loadAssetByProject(params.id);
+
if (project === null) {
return { errors: `Project "${params.id}" not found` };
}
- return { config, assets, project, env };
+ return { config, project, env };
};
-type Data = {
- config: typeof config;
- project: Project;
-};
-
-type Error = {
- errors: "string";
-};
-
const deleteAssetSchema = zfd.formData({
assetId: zfd.text(),
assetName: zfd.text(),
diff --cc packages/prisma-client/prisma/schema.prisma
index 7822457bec,7f361a7c85..d4d68748e5
--- a/packages/prisma-client/prisma/schema.prisma
+++ b/packages/prisma-client/prisma/schema.prisma
@@@ -47,27 -47,15 +47,28 @@@ model User
}
model Project {
- id String @id @default(uuid())
- title String
- domain String @unique
+ id String @id @default(uuid())
+ title String
+ domain String @unique
- User User? @relation(fields: [userId], references: [id])
++ user User? @relation(fields: [userId], references: [id])
+ userId String?
- Asset Asset[]
++ assets Asset[]
+ build Build @relation(fields: [buildIdDev], references: [id])
+ buildIdDev String
+ buildIdProd String? // exists when published
+ buildIdHistory String @default("[]")
+
+ // Migrating away from
prodTreeId String? // exists when published
devTreeId String
prodTreeIdHistory String @default("[]")
- user User? @relation(fields: [userId], references: [id])
- userId String?
- assets Asset[]
+}
+
+model Build {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ pages String @default("[]") // Each page can be a tree of folders and pages Project
++ Project Project[]
}
model Tree {
diff --cc packages/prisma-client/src/types.ts
index f18bc53ee3,67310d3780..2d38303458
--- a/packages/prisma-client/src/types.ts
+++ b/packages/prisma-client/src/types.ts
@@@ -1,15 -1,10 +1,10 @@@
- import type { Asset as DbAsset } from "@prisma/client";
+ import type { Asset as DbAsset, Project as BaseProject } from "@prisma/client";
export { Location } from "@prisma/client";
- export type {
- InstanceProps,
- Project,
- User,
- Breakpoints,
- Build,
- } from "@prisma/client";
-export type { InstanceProps, User, Breakpoints } from "@prisma/client";
++export type { InstanceProps, User, Breakpoints, Build } from "@prisma/client";
export type Asset = DbAsset & {
- path: string;
+ path?: string;
status?: "uploading" | "uploaded";
};
+ export type Project = BaseProject & { assets?: Asset[] };
export type { DbAsset };