File tree Expand file tree Collapse file tree 4 files changed +32
-20
lines changed
client/src/server/api/routers/project Expand file tree Collapse file tree 4 files changed +32
-20
lines changed Original file line number Diff line number Diff line change @@ -116,12 +116,28 @@ export const projectRouter = createTRPCRouter({
116116 const newCanvas = createDefaultCanvas ( newProject . id ) ;
117117 await tx . insert ( canvases ) . values ( newCanvas ) ;
118118
119- const newUserCanvas = createDefaultUserCanvas ( input . userId , newCanvas . id ) ;
119+ const newUserCanvas = createDefaultUserCanvas ( input . userId , newCanvas . id , {
120+ x : '120' ,
121+ y : '120' ,
122+ scale : '0.56' ,
123+ } ) ;
120124 await tx . insert ( userCanvases ) . values ( newUserCanvas ) ;
121125
122126 // 4. Create the default frame
123- const newFrame = createDefaultFrame ( newCanvas . id , input . project . sandboxUrl ) ;
124- await tx . insert ( frames ) . values ( newFrame ) ;
127+ const desktopFrame = createDefaultFrame ( newCanvas . id , input . project . sandboxUrl , {
128+ x : '5' ,
129+ y : '0' ,
130+ width : '1536' ,
131+ height : '960' ,
132+ } ) ;
133+ await tx . insert ( frames ) . values ( desktopFrame ) ;
134+ const mobileFrame = createDefaultFrame ( newCanvas . id , input . project . sandboxUrl , {
135+ x : '1600' ,
136+ y : '0' ,
137+ width : '440' ,
138+ height : '956' ,
139+ } ) ;
140+ await tx . insert ( frames ) . values ( mobileFrame ) ;
125141
126142 // 5. Create the creation request
127143 if ( input . creationData ) {
Original file line number Diff line number Diff line change 22
33export default function Page ( ) {
44 return (
5- < div
6- className = "w-screen h-screen flex items-center justify-center bg-white dark:bg-black transition-colors duration-200 flex-col p-4 gap-[32px]"
7- data-oid = "1"
8- >
9- < h1 className = "text-4xl md:text-5xl font-semibold tracking-tight" data-oid = "3" >
10- Hello world
11- </ h1 >
12- < img
13- src = "./favicon.ico"
14- alt = "Don't worry be happy"
15- className = "object-contain"
16- data-oid = "7"
17- />
5+ < div className = "w-full min-h-screen flex items-center justify-center bg-black transition-colors duration-200 flex-col p-4 gap-8" >
6+ < div className = "text-center text-gray-100 p-4" >
7+ < h1 className = "text-4xl font-semibold mb-4 tracking-tight" > Welcome to your app</ h1 >
8+ < p className = "text-xl md:text-2xl text-gray-300" >
9+ This is a blank template Next.js App
10+ </ p >
11+ </ div >
1812 </ div >
1913 ) ;
2014}
Original file line number Diff line number Diff line change @@ -3,15 +3,16 @@ import type { Frame as DbFrame } from '@onlook/db';
33import { FrameType } from '@onlook/models' ;
44import { v4 as uuidv4 } from 'uuid' ;
55
6- export const createDefaultFrame = ( canvasId : string , url : string ) : DbFrame => {
6+ export const createDefaultFrame = ( canvasId : string , url : string , overrides ?: Partial < DbFrame > ) : DbFrame => {
77 return {
88 id : uuidv4 ( ) ,
9- canvasId : canvasId ,
9+ canvasId,
1010 type : FrameType . WEB ,
11- url : url ,
11+ url,
1212 x : DefaultSettings . FRAME_POSITION . x . toString ( ) ,
1313 y : DefaultSettings . FRAME_POSITION . y . toString ( ) ,
1414 width : DefaultSettings . FRAME_DIMENSION . width . toString ( ) ,
1515 height : DefaultSettings . FRAME_DIMENSION . height . toString ( ) ,
16+ ...overrides ,
1617 } ;
1718} ;
Original file line number Diff line number Diff line change 11import { DefaultSettings } from '@onlook/constants' ;
22import type { UserCanvas as DbUserCanvas } from '@onlook/db' ;
33
4- export const createDefaultUserCanvas = ( userId : string , canvasId : string ) : DbUserCanvas => {
4+ export const createDefaultUserCanvas = ( userId : string , canvasId : string , overrides ?: Partial < DbUserCanvas > ) : DbUserCanvas => {
55 return {
66 userId,
77 canvasId,
88 scale : DefaultSettings . SCALE . toString ( ) ,
99 x : DefaultSettings . PAN_POSITION . x . toString ( ) ,
1010 y : DefaultSettings . PAN_POSITION . y . toString ( ) ,
11+ ...overrides ,
1112 } ;
1213} ;
You can’t perform that action at this time.
0 commit comments