diff --git a/.gitignore b/.gitignore index e363260..d94d3b8 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,6 @@ wrangler.toml dist backend/server/projects -backend/database/drizzle app.yaml ingressController.yaml \ No newline at end of file diff --git a/backend/database/drizzle/0000_sudden_wallop.sql b/backend/database/drizzle/0000_sudden_wallop.sql new file mode 100644 index 0000000..1b1b3be --- /dev/null +++ b/backend/database/drizzle/0000_sudden_wallop.sql @@ -0,0 +1,46 @@ +CREATE TABLE `sandbox` ( + `id` text PRIMARY KEY NOT NULL, + `name` text NOT NULL, + `type` text NOT NULL, + `visibility` text, + `createdAt` integer DEFAULT CURRENT_TIMESTAMP, + `user_id` text NOT NULL, + `likeCount` integer DEFAULT 0, + `viewCount` integer DEFAULT 0, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `sandbox_likes` ( + `user_id` text NOT NULL, + `sandbox_id` text NOT NULL, + `createdAt` integer DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY(`sandbox_id`, `user_id`), + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, + FOREIGN KEY (`sandbox_id`) REFERENCES `sandbox`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `user` ( + `id` text PRIMARY KEY NOT NULL, + `name` text NOT NULL, + `email` text NOT NULL, + `username` text NOT NULL, + `avatarUrl` text, + `githubToken` text, + `createdAt` integer DEFAULT CURRENT_TIMESTAMP, + `generations` integer DEFAULT 0, + `tier` text DEFAULT 'FREE', + `tierExpiresAt` integer, + `lastResetDate` integer +); +--> statement-breakpoint +CREATE TABLE `users_to_sandboxes` ( + `userId` text NOT NULL, + `sandboxId` text NOT NULL, + `sharedOn` integer, + FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, + FOREIGN KEY (`sandboxId`) REFERENCES `sandbox`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE UNIQUE INDEX `sandbox_id_unique` ON `sandbox` (`id`);--> statement-breakpoint +CREATE UNIQUE INDEX `user_id_unique` ON `user` (`id`);--> statement-breakpoint +CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`); \ No newline at end of file diff --git a/backend/database/drizzle/0001_dusty_komodo.sql b/backend/database/drizzle/0001_dusty_komodo.sql new file mode 100644 index 0000000..964072e --- /dev/null +++ b/backend/database/drizzle/0001_dusty_komodo.sql @@ -0,0 +1,3 @@ +ALTER TABLE user ADD `bio` text;--> statement-breakpoint +ALTER TABLE user ADD `personalWebsite` text;--> statement-breakpoint +ALTER TABLE user ADD `links` text DEFAULT '[]'; \ No newline at end of file diff --git a/backend/database/drizzle/meta/0000_snapshot.json b/backend/database/drizzle/meta/0000_snapshot.json index 775f00c..07ea89c 100644 --- a/backend/database/drizzle/meta/0000_snapshot.json +++ b/backend/database/drizzle/meta/0000_snapshot.json @@ -1,7 +1,7 @@ { "version": "5", "dialect": "sqlite", - "id": "1288b006-6410-4b1c-8c96-d9797878a116", + "id": "4ada398d-7e4e-448f-8cea-a10b4d844600", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "sandbox": { @@ -94,6 +94,72 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "sandbox_likes": { + "name": "sandbox_likes", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sandbox_id": { + "name": "sandbox_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": { + "sandbox_likes_user_id_user_id_fk": { + "name": "sandbox_likes_user_id_user_id_fk", + "tableFrom": "sandbox_likes", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "sandbox_likes_sandbox_id_sandbox_id_fk": { + "name": "sandbox_likes_sandbox_id_sandbox_id_fk", + "tableFrom": "sandbox_likes", + "tableTo": "sandbox", + "columnsFrom": [ + "sandbox_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "sandbox_likes_sandbox_id_user_id_pk": { + "columns": [ + "sandbox_id", + "user_id" + ], + "name": "sandbox_likes_sandbox_id_user_id_pk" + } + }, + "uniqueConstraints": {} + }, "user": { "name": "user", "columns": { @@ -132,6 +198,13 @@ "notNull": false, "autoincrement": false }, + "githubToken": { + "name": "githubToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "createdAt": { "name": "createdAt", "type": "integer", diff --git a/backend/database/drizzle/meta/0001_snapshot.json b/backend/database/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..b765b17 --- /dev/null +++ b/backend/database/drizzle/meta/0001_snapshot.json @@ -0,0 +1,353 @@ +{ + "version": "5", + "dialect": "sqlite", + "id": "80c0b0b2-bb0e-449a-b447-c21863686f58", + "prevId": "4ada398d-7e4e-448f-8cea-a10b4d844600", + "tables": { + "sandbox": { + "name": "sandbox", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "likeCount": { + "name": "likeCount", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "viewCount": { + "name": "viewCount", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "sandbox_id_unique": { + "name": "sandbox_id_unique", + "columns": [ + "id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "sandbox_user_id_user_id_fk": { + "name": "sandbox_user_id_user_id_fk", + "tableFrom": "sandbox", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "sandbox_likes": { + "name": "sandbox_likes", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sandbox_id": { + "name": "sandbox_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": { + "sandbox_likes_user_id_user_id_fk": { + "name": "sandbox_likes_user_id_user_id_fk", + "tableFrom": "sandbox_likes", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "sandbox_likes_sandbox_id_sandbox_id_fk": { + "name": "sandbox_likes_sandbox_id_sandbox_id_fk", + "tableFrom": "sandbox_likes", + "tableTo": "sandbox", + "columnsFrom": [ + "sandbox_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "sandbox_likes_sandbox_id_user_id_pk": { + "columns": [ + "sandbox_id", + "user_id" + ], + "name": "sandbox_likes_sandbox_id_user_id_pk" + } + }, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatarUrl": { + "name": "avatarUrl", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "githubToken": { + "name": "githubToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "generations": { + "name": "generations", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "personalWebsite": { + "name": "personalWebsite", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "tier": { + "name": "tier", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'FREE'" + }, + "tierExpiresAt": { + "name": "tierExpiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastResetDate": { + "name": "lastResetDate", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "user_id_unique": { + "name": "user_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "user_username_unique": { + "name": "user_username_unique", + "columns": [ + "username" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users_to_sandboxes": { + "name": "users_to_sandboxes", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sandboxId": { + "name": "sandboxId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sharedOn": { + "name": "sharedOn", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "users_to_sandboxes_userId_user_id_fk": { + "name": "users_to_sandboxes_userId_user_id_fk", + "tableFrom": "users_to_sandboxes", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "users_to_sandboxes_sandboxId_sandbox_id_fk": { + "name": "users_to_sandboxes_sandboxId_sandbox_id_fk", + "tableFrom": "users_to_sandboxes", + "tableTo": "sandbox", + "columnsFrom": [ + "sandboxId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } + } \ No newline at end of file diff --git a/backend/database/drizzle/meta/_journal.json b/backend/database/drizzle/meta/_journal.json index a26196c..73e352c 100644 --- a/backend/database/drizzle/meta/_journal.json +++ b/backend/database/drizzle/meta/_journal.json @@ -5,8 +5,15 @@ { "idx": 0, "version": "5", - "when": 1732568535771, - "tag": "0000_rapid_korath", + "when": 1736155854410, + "tag": "0000_sudden_wallop", + "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1736169498666, + "tag": "0001_dusty_komodo", "breakpoints": true } ] diff --git a/frontend/app/globals.css b/frontend/app/globals.css index 643614b..e1d1913 100644 --- a/frontend/app/globals.css +++ b/frontend/app/globals.css @@ -102,26 +102,27 @@ .light .gradient-button-bg { background: radial-gradient( circle at top, - #262626 0%, - #f5f5f5 50% - ); /* Dark gray -> Light gray */ + #f5f5f5 0%, /* Very light gray */ + #e0e0e0 50% /* Soft gray */ + ); } .light .gradient-button { background: radial-gradient( circle at bottom, - hsl(0, 10%, 25%) -10%, - #9d9d9d 50% - ); /* Light gray -> Almost white */ + hsl(0, 0%, 85%) -10%, /* Slightly darker gray */ + hsl(0, 0%, 95%) 50% /* Very soft light gray */ + ); } .light .gradient-button-bg > div:hover { background: radial-gradient( circle at bottom, - hsl(0, 10%, 25%) -10%, - #9d9d9d 80% - ); /* Light gray -> Almost white */ + hsl(0, 0%, 80%) -10%, /* Slightly darker gray for hover */ + hsl(0, 0%, 90%) 80% /* Softer gray */ + ); } + .inline-decoration::before { content: "Generate"; color: #525252; diff --git a/frontend/components/dashboard/projectCard/index.tsx b/frontend/components/dashboard/projectCard/index.tsx index 4c1ec42..f8b0ecf 100644 --- a/frontend/components/dashboard/projectCard/index.tsx +++ b/frontend/components/dashboard/projectCard/index.tsx @@ -240,7 +240,7 @@ function ProjectCardComponent({ > diff --git a/frontend/components/editor/index.tsx b/frontend/components/editor/index.tsx index 6d18fc3..2460de4 100644 --- a/frontend/components/editor/index.tsx +++ b/frontend/components/editor/index.tsx @@ -62,7 +62,7 @@ export default function CodeEditor({ //SocketContext functions and effects const { socket, setUserAndSandboxId } = useSocket() // theme - const { theme } = useTheme() + const { resolvedTheme: theme } = useTheme() useEffect(() => { // Ensure userData.id and sandboxData.id are available before attempting to connect if (userData.id && sandboxData.id) { diff --git a/frontend/components/editor/terminals/terminal.tsx b/frontend/components/editor/terminals/terminal.tsx index b1ce691..90e4b88 100644 --- a/frontend/components/editor/terminals/terminal.tsx +++ b/frontend/components/editor/terminals/terminal.tsx @@ -22,7 +22,7 @@ export default function EditorTerminal({ setTerm: (term: Terminal) => void visible: boolean }) { - const { theme } = useTheme() + const { resolvedTheme: theme } = useTheme() const terminalContainerRef = useRef>(null) const fitAddonRef = useRef(null) diff --git a/frontend/components/ui/theme-provider.tsx b/frontend/components/ui/theme-provider.tsx index 19dfaa9..6a1ffe4 100644 --- a/frontend/components/ui/theme-provider.tsx +++ b/frontend/components/ui/theme-provider.tsx @@ -1,8 +1,11 @@ "use client" +import * as React from "react" import { ThemeProvider as NextThemesProvider } from "next-themes" -import { type ThemeProviderProps } from "next-themes/dist/types" -export function ThemeProvider({ children, ...props }: ThemeProviderProps) { +export function ThemeProvider({ + children, + ...props +}: React.ComponentProps) { return {children} } diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f09c4ee..7eaeeb5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -53,7 +53,7 @@ "lucide-react": "^0.365.0", "monaco-themes": "^0.4.4", "next": "14.1.3", - "next-themes": "^0.3.0", + "next-themes": "^0.4.4", "openai": "^4.73.1", "posthog-js": "^1.147.0", "react": "^18.3.1", @@ -7420,12 +7420,13 @@ } }, "node_modules/next-themes": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz", - "integrity": "sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w==", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.4.tgz", + "integrity": "sha512-LDQ2qIOJF0VnuVrrMSMLrWGjRMkq+0mpgl6e0juCLqdJ+oo8Q84JRWT6Wh11VDQKkMMe+dVzDKLWs5n87T+PkQ==", + "license": "MIT", "peerDependencies": { - "react": "^16.8 || ^17 || ^18", - "react-dom": "^16.8 || ^17 || ^18" + "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "node_modules/next/node_modules/postcss": { diff --git a/frontend/package.json b/frontend/package.json index 9f8a238..7dbe359 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -54,7 +54,7 @@ "lucide-react": "^0.365.0", "monaco-themes": "^0.4.4", "next": "14.1.3", - "next-themes": "^0.3.0", + "next-themes": "^0.4.4", "openai": "^4.73.1", "posthog-js": "^1.147.0", "react": "^18.3.1",