Feat | Widgets Constructor - #7
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Pull request overview
Introduces the widget “constructor” feature end-to-end: server-side widget/block schemas + CRUD services/routes (including public rendering via stats aggregation), plus a new client-side gallery/editor/public widget page flow that consumes these APIs.
Changes:
- Added widget/block registry + validation, widget CRUD + block CRUD services/controllers/routes, and a public widget render endpoint.
- Added GitHub + LeetCode stats fetching with caching for block-level rendering and preview.
- Added client gallery UX updates (create modal, open/configure/copy), a full widget editor page, and a public widget page for iframe embedding.
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/widgets/registry.ts | Defines widget/block types, presets, and Zod schemas for validation/normalization. |
| server/src/widgets.test.ts | Adds API-level tests for widget creation, blocks, preview, access control, and limits. |
| server/src/services/widgetService.ts | Implements widget CRUD, slug generation, block CRUD, and layout validation logic. |
| server/src/services/statsService.ts | Implements cached external data fetching and block rendering for previews/public widgets. |
| server/src/routes/widgets.ts | Adds protected widget/block routes and a rate-limited public widgets route. |
| server/src/lib/prisma.ts | Ensures env loading before Prisma client initialization. |
| server/src/lib/env.ts | Centralizes dotenv loading with multiple candidate .env locations. |
| server/src/index.ts | Switches to centralized env loader instead of dotenv/config. |
| server/src/controllers/widgetController.ts | Adds request validation + handlers for widget/block CRUD, preview, and public fetch. |
| server/src/app.ts | Wires widgets/blocks/public widgets routers into the Express app. |
| server/prisma/schema.prisma | Adds Widget.slug as a unique field. |
| server/prisma/migrations/20260801120000_add_widget_slug/migration.sql | Backfills slugs for existing widgets and enforces uniqueness/non-null. |
| server/prisma/migrations/20260801130000_remove_legacy_widget_blocks/migration.sql | Data migration intended to remove legacy blocks and re-pack positions. |
| server/prisma/migrations/20260801140000_restore_two_column_widget_grid/migration.sql | Restores two-column grid config in widget JSON where previously persisted as 1. |
| server/prisma.config.ts | Adds Prisma config for schema/migrations paths and DATABASE_URL loading. |
| prompts/phase-4-render.md | Documents public widget rendering + iframe embedding flow. |
| prompts/phase-3-builder.md | Documents server/client builder architecture and routes. |
| prompts/phase-2-auth.md | Documents authentication implementation details and flows. |
| prompts/phase-1-infra.md | Documents project setup/infrastructure approach and scripts. |
| opencode.json | Adds MCP config for Figma integration in local tooling. |
| client/src/widgets/sidebar/ui/Sidebar.tsx | Updates recent widgets list to open existing widgets by id/title. |
| client/src/widgets/sidebar/ui/Sidebar.module.css | Introduces a CSS variable for expanded sidebar width. |
| client/src/shared/locale/content.ts | Adds localization strings for new gallery/editor/public widget features. |
| client/src/shared/api/widgets.ts | Adds typed client API wrappers for widgets/blocks/public widgets. |
| client/src/shared/api/index.ts | Re-exports widget API helpers from shared API index. |
| client/src/pages/widgets-gallery/ui/WidgetsGalleryPage.tsx | Adds create modal, empty state, open/copy wiring, and updated widget card handling. |
| client/src/pages/widgets-gallery/ui/WidgetsGalleryPage.module.css | Styles the gallery empty state. |
| client/src/pages/widgets-gallery/ui/WidgetsGalleryHeader.tsx | Wires “Create widget” CTA to open the create modal. |
| client/src/pages/widgets-gallery/ui/CreateWidgetModal.tsx | Implements modal for widget creation (source + preset selection). |
| client/src/pages/widgets-gallery/ui/CreateWidgetModal.module.css | Styles the create widget modal UI. |
| client/src/pages/widget-editor/ui/WidgetEditorPage.tsx | Adds a full widget editor with layout drag/resize, config panels, autosave, publish/copy. |
| client/src/pages/widget-editor/ui/WidgetEditorPage.module.css | Styles the widget editor layout and interactions. |
| client/src/pages/widget-editor/index.ts | Exports the widget editor page entrypoint. |
| client/src/pages/public-widget/ui/PublicWidgetPage.tsx | Adds a public widget page that fetches and renders a widget by slug. |
| client/src/pages/public-widget/ui/PublicWidgetPage.module.css | Styles public widget page layout/status. |
| client/src/pages/public-widget/index.ts | Exports the public widget page entrypoint. |
| client/src/entities/widget/ui/WidgetCard.tsx | Updates widget cards to use persisted widget data, published state, copy/configure actions. |
| client/src/entities/widget/ui/WidgetCard.module.css | Updates widget card styling and responsive action visibility. |
| client/src/entities/widget/ui/WidgetCanvas.tsx | Adds reusable widget canvas + block renderer with live/rendered data support. |
| client/src/entities/widget/ui/WidgetCanvas.module.css | Adds styles for the widget canvas and block rendering states. |
| client/src/entities/widget/model/types.ts | Adds shared widget/block/public payload TypeScript types. |
| client/src/entities/widget/model/registry.ts | Adds client-side presets, block definitions, palette tokens, and default configs. |
| client/src/entities/widget/model/index.ts | Exports widget model registry and types. |
| client/src/entities/widget/index.ts | Re-exports widget UI + model for consumption across the app. |
| client/src/app/App.tsx | Adds routing for editor/public pages and integrates real widget CRUD via API. |
| client/src/app/App.module.css | Adds layout styling for editor/public routes and prevents horizontal overflow. |
| api/widgets/index.ts | Vercel function entrypoint wiring to server Express bundle. |
| api/widgets/[id].ts | Vercel function entrypoint for widget by id route wiring. |
| api/widgets/[widgetId]/blocks/index.ts | Vercel function entrypoint wiring for blocks under a widget. |
| api/widgets/[widgetId]/blocks/reorder.ts | Vercel function entrypoint wiring for layout reorder route. |
| api/blocks/[id].ts | Vercel function entrypoint wiring for block by id routes. |
| api/public/widgets/[slug].ts | Vercel function entrypoint wiring for public widget by slug route. |
| .env.example | Updates example env vars (including GitHub token section) for new functionality. |
Suppressed comments (1)
server/src/services/widgetService.ts:306
removeBlockdeletes a block but does not re-pack remainingpositionvalues. With the currentaddBlocklogic (and even withmax+1), this leaves gaps/duplicates over time and makes ordering less predictable. After deletion, decrement positions greater than the removed block’s position to keep ordering stable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.