40 Commits

Author SHA1 Message Date
Sahaj Jain d21c8e3d40 fix: keep AI chat image payloads under the serverless body limit
Uploaded images were inlined as full-resolution base64 in the message
metadata, and the entire chat history is posted on every turn. Two 4MB
uploads exceeded the 4.5MB request body cap, so the platform rejected the
request before the route ran (FUNCTION_PAYLOAD_TOO_LARGE).

- Downscale and re-encode raster uploads client-side (1536px longest edge,
  WebP with a JPEG fallback, ~300KB target). UI screenshots land around
  12KB with imperceptible color drift, so token extraction is unaffected.
- Trim images from the oldest messages when the serialized request body
  would still exceed the budget, rather than failing the request outright.
- Raise MAX_IMAGE_FILES from 2 to 5 now that the payload allows it, and
  wrap the multi-image message preview row so the thumbnails stay legible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 20:50:38 +05:30
Sahaj Jain 9fb9c4c77f upgrade streamdown to v2 and fix chat theme preview height
- Upgrade streamdown 1.0.11 → 2.4.0 with native streaming animation support
- Use Streamdown's built-in isAnimating/animated props instead of custom typewriter
- Remove useStreamText hook (replaced by Streamdown's native animation)
- Simplify StreamText component to pass through to Streamdown directly
- Add streamdown/styles.css import and Tailwind @source for class detection
- Fix ChatThemePreview card height by overriding Card's default py-6/gap-6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:24:43 +05:30
Sahaj Jain fc564039e4 feat(community): add time range sort with polished dropdown UI
Add "Popular / All Time", "Popular / This Month", "Popular / This Week"
sort options that filter by publish date. Replace inline sort tabs with a
grouped dropdown menu showing check marks on the active selection.
Default sort is now Popular / All Time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 02:22:16 +05:30
Sahaj Jain 6bc66ba071 perf(community): denormalize like_count, cache reads with unstable_cache
- Add like_count column to community_theme table with backfill migration
- Update toggleLikeTheme to atomically increment/decrement instead of COUNT(*)
- Remove expensive GROUP BY subquery from getCommunityThemes and getCommunityDataForTheme
- Wrap read queries with unstable_cache (60s themes, 300s tag counts)
- Add revalidateTag calls to all write operations for cache invalidation
- Increase React Query staleTime (themes 2m→5m, tags 5m→15m, published 5m→10m)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 00:44:42 +05:30
Sahaj Jain dfadcd84dc fix: use theme name instead of ID for v0 open title
The "Open in v0" button on /themes/[id] was using the themeId as the
title, causing v0 API to reject it. Now passes the actual theme name
and truncates the title to 32 chars to stay within v0's limit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:05:23 +05:30
Sahaj Jain 9d74786e70 feat: add sidebar filters and tag filtering to community page
Add a left sidebar with "All Themes", "My Themes", and "Liked Themes"
filters plus tag-based filtering with counts. On mobile, the sidebar
collapses into a Sheet. Redesign the hero section and use auto-fill
grid for adaptive card layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:04:41 +05:30
Sahaj Jain 3b8ab5adb3 refactor: simplify theme detail page header and fix v0 open flow
- Replace dropdown menu with inline "Open in Editor" button
- Remove "Published" badge from theme name
- Make header section mobile responsive with flex-col/row
- Skip save check when opening in v0 from theme detail page since theme already exists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 04:22:15 +05:30
Sahaj Jain 90570d60a2 feat: add community theme tags with searchable selector
Add a predefined tag system for community themes (50 tags across
style, use-case, season, and aesthetic categories). Users select
1-5 tags when publishing via a searchable command dropdown.
Tags display as overlay pills on community cards and as badges
on theme view pages. Includes SEO metadata enrichment with tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:51:13 +05:30
Sahaj Jain 632dd42a72 feat: replace edit mode with inline save-or-update flow
Remove the separate edit mode (ThemeEditActions bar + EditButton) and
instead track unsaved changes inline. The preset selector now shows
`<name>*` for any preset with unsaved changes. Clicking Save on a
saved preset opens a dialog offering to update the existing theme or
save as a new one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:13:59 +05:30
Sahaj Jain 249b72f98a Community themes (#259)
* add community themes feature

Allow users to publish saved themes to a public community page,
browse/sort community themes, and like them with auth-gated interactions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improve community themes UI and fix like state

- Polish community page with better layout, sort icons, loading skeletons
- Show author, date, like count on theme detail page
- Fix isLikedByMe not being fetched in getCommunityDataForTheme
- Remove Community link from app header
- Replace Save with Publish button in editor action bar for saved themes
- Include isPublished in getThemes() via server-side join to avoid layout shift

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ui

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 01:32:17 +05:30
Sahaj Jain 624efecafe fix: Error types 2026-01-27 04:25:59 +05:30
Sahaj Jain 7bbd22371f open in v0 2025-12-13 22:09:24 +05:30
Sahaj Jain 5fe4958db2 Feature/preview external (#225)
* Enhance Preview Panel and Support External Websites (#184)

* feat: Add Block Viewer for Preview Panel

* feat: support theme injection for external websites

* refactor: Improve Naming and Composition

* Support for Google Fonts in Preview script and Error Feedback (#202)

* feat: Add support for loading Google Fonts in the embed script.

* feat: Add error state and UI feedback

* fix font loading by overriding classes

* add reset button + update some ui

* syntax highlighting plus copy changes

* rename script

* update ui for connection status

* ui

* zustand store for preview state

* use nuqs for active preview tab

* get shadows working

* refactor

* A

* add tracking

---------

Co-authored-by: Luis Llanes <137589205+llanesluis@users.noreply.github.com>
Co-authored-by: Luis Llanes <luisllaboj@gmail.com>
2025-10-12 02:15:57 +05:30
Sahaj Jain 5882f60c32 Enhance ai chat (#218)
* update package locks to avoid conflict

* Refactor AI Generation with AI SDK v5 (#210)

* refactor(wip): Whole Chat implementation

* fix: Deps

* chore: Update types and create tool to handle theme generation

* chore: Add hook and component to handle feedback text

* chore: Check for themeStyles in asssiatant metadata

* feat: Improve messages styles and feedback

* chore: Update react-hook-form deps

* chore: Improve Messages display

* chore: Show a banner when theme is generating

* chore: Optimize the Messages syncing

* feat: Add debug button to MessageActions in dev mode

* chore: messages

* chore: Improve System prompt + tools + utils

* fix: correctly display User messages with only images

* feat: Handle errors in UI and adapt to AI sdk

* feat: Use tool output instead of custom data parts

* chore: System prompt and schema context

* chore: Gemini 2.5 pro as the default model

* refactor: Change name to Chat Context and apply generated theme automatically

* chore: Update ai packages to latest version

* feat: Stop ongoing request before starting a new chat

* feat: Refactor logic for Scroll start/end sentinels

* feat: Improve UI streaming with AI Elements and Stream Text utils

* chore: Generate theme types and logic

* feat: Allow customize the speed of streaming text

* refactor: Theme generation utils

* fix: Avoid duplicated Mention references

* styles: Improve Chat error banner

* feat: Enhance Prompt core implementation

* feat: Implement enhance prompt in components

* chore: Add TODOS comments

* chore: Remove Openai provider

* chore: Update AI adk packages

* fix: Free request constant

---------

Co-authored-by: Sahaj Jain <82111591+jnsahaj@users.noreply.github.com>

* update lockfile

* fix import

* fix types

* chore: Trigger theme generation before transitioning to editor page

* refactor: Move AI sdk specific code into Lib and update imports

* chore: Provide model ID to record usage util

* refactor: Multi model provider convention

* fix types

* refactor: Use Zustand persist middleware versioning

* feat: Improve prompts and context

* feat: Optimize streaming JSONContent into text area

* chore: Improve Theme Generation prompt

* feat: Improve prompt

* feat: Add subscription checks for enhancing prompt and Posthog tracking

---------

Co-authored-by: Luis Llanes <137589205+llanesluis@users.noreply.github.com>
Co-authored-by: Luis Llanes <luisllaboj@gmail.com>
2025-10-01 16:31:10 +05:30
Sameer Singh a3c4c6c8e8 feat: replace all Dialog usage with Revola for responsive behavior (Responsive Dialog) (#208)
* chore: add @base-ui-components/react dependency and update pnpm-lock.yaml

* feat: add custom hook useMediaQuery for responsive design

* refactor: streamline button component code for improved readability

* refactor: enhance ScrollArea component with viewport className prop and improve className organization

* refactor: replace Dialog component with ResponsiveDialog for improved responsiveness and UI consistency

* feat: introduce ResponsiveDialog component for enhanced mobile and desktop dialog handling

* refactor: update Next.js configuration to use TypeScript type for NextConfig

* refactor: replace Dialog with ResponsiveDialog in CardsChat component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in ShareDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in FigmaExportDialog component for improved UI consistency and responsiveness.

- Use `Scrollarea` for cleaner scrollbar and structure it a bit different, so scrollbar's doesn't overflow beyond dialog.

* refactor: replace Dialog with ResponsiveDialog in ThemeSaveDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in PodcastEmptyPlaceholder component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in ChatImagePreview component for improved UI consistency and responsiveness

* feat: add Tabs component based on BaseUI with customizable TabsList, TabsTrigger, TabsContent, and TabsIndicator for improved UI navigation

* refactor: replace Dialog with ResponsiveDialog in CssImportDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in AuthDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in MCPDialog component for improved UI consistency and responsiveness

- Replace `Tabs` component with new Base UI based `Tabs` component

* refactor: update Tabs and Select components in CodePanel for improved UI consistency

- Replace old Tabs component with new Base UI based Tabs component
- Add TabsIndicator for enhanced visual feedback
- Adjust SelectContent z-index for better layering

* refactor: replace Dialog with ResponsiveDialog in CodePanelDialog component for improved UI consistency and responsiveness

- fix: accessibility issue cased by missing title and description for dialog

* refactor: replace Dialog with ResponsiveDialog in ContrastChecker component for improved UI consistency and responsiveness

- Disable `Issues` button, when there's no issue
- Sticky Header for each section for better messaging for each section especially on mobile

* refactor: adjust layout and spacing in FigmaExportDialog for improved visual consistency

- Update margin and padding for better alignment of elements
- Remove unnecessary line breaks to streamline the code

* refactor: adjust layout and spacing in GetProDialog and AIChatDemo components for improved visual consistency

- Update positioning of elements in GetProDialog for better alignment
- Remove unnecessary inset from AIChatDemo for cleaner layout

* refactor: enhance layout in CodePanelDialog for improved responsiveness

- Adjust max-height for better display on smaller screens
- Maintain overall visual consistency with other dialog components

* refactor: enhance CodePanel layout with additional ScrollBar orientations

- Add horizontal and vertical ScrollBars for improved navigation within code panels
- Adjust padding in CodePanelDialog for better spacing and visual consistency

* refactor: clean up TabsIndicator component by removing commented code

- Remove unnecessary commented-out code for better readability
- Streamline TabsIndicator implementation for improved clarity

* refactor: update ResponsiveDialog components to use isDesktop for breakpoint detection

- Replace isMobile with isDesktop in ResponsiveDialog components for improved clarity
- Ensure consistent behavior across dialog and drawer implementations based on desktop view

* refactor: enhance ResponsiveDialogContent with additional props for customization (v1.4) update

- Introduce closeButtonClassName and dragHandleClassName props for better styling control
- Update context initialization to allow null values for improved type safety
- Refactor ResponsiveDialogContent to streamline rendering logic and improve readability

* refactor: reorganize imports and clean up AuthDialog component for improved readability

- Rearranged import statements for better structure
- Removed unnecessary props from ResponsiveDialogContent for cleaner layout
- Enhanced overall code clarity and maintainability

* refactor: reorganize imports in MCPDialog for improved clarity and consistency

- Rearranged import statements for better structure
- Cleaned up component imports to enhance readability
- Maintained overall code organization for future maintainability

* refactor: reorganize imports and enhance layout in various dialog components for improved readability

- Cleaned up and rearranged import statements for better structure
- Updated ResponsiveDialogContent and ResponsiveDialogHeader for consistent padding and spacing
- Enhanced overall layout and visual consistency across multiple dialog components

* refactor: add iOS detection to adjust repositioning of inputs in ResponsiveDialog
2025-08-30 18:28:31 +05:30
Sahaj Jain 8c107dd53e Feature/dynamic fonts (#197)
* chore: allow overriding ControlSection classNames

* feat: Support Google Fonts API and load fonts dynamically

* feat: Enforce System Prompt to use Google Fonts API if needed

* styles: Improve GoogleFontPicker styles

* feat: Pull Fonts from fileSystem instead of hitting the Google Fonts API every time

* feat: Improve System Prompt to reference Google Fonts

* refactor: Use Next.js Cache instead of manually fetching and reading from the filesystem

* feat: Only enable Font picker fetch when it's open

* chore: Remove JSON for Google Fonts catalogue

* feat: Scroll to selected font if it's already fetched and add clean search button

* chore: update imports

* fix: dashboard preview

---------

Co-authored-by: Luis Llanes <luisllaboj@gmail.com>
2025-07-27 23:40:36 +05:30
Luis Llanes 7bb0ff213c Fix SVG issue when processed by the API and minor styles fixes (#171)
* fix: border radius and overflow in ImagePreview component

* fix: Proper support for SVGs and UI feedback when errors occur

* SVG files are treated and displayed as Images in the UI
* SVG files are processed as Markup Text to send to the API
* Remove support for GIFs

* chore: improve system prompt to handle SVGs properly

* styles: Add border radius to uploaded image preview when loading
2025-07-18 19:43:43 +05:30
Luis Llanes 9f505c50c2 Draft Issue and Message UI styles (#166)
* fix: draft sync issue

* fix: small styles changes in message UI
2025-07-17 01:57:35 +05:30
Sahaj Jain 4c41596712 AI theme generation just got 10x better (#165)
* feat: Add polar for tweakcn-plus checkout

* migrate to polar nextjs for more control

* chore: save closable chat suggestions state as a preference in local storage

* chore: improve color contrast in user UI message

* feat: add pro features components

* chore: update TextArea styles

* feat: adjust theme generation types, functions and API to support adding an image

* feat: AI components now support and display images

* feat: add support for multiple images

* feat: add support for multiple images to components

* feat: support image only prompts and clean up API code

* chore: save closable chat suggestions state as a preference in local storage

* chore: improve color contrast in user UI message

* feat: add pro features components

* chore: update TextArea styles

* feat: adjust theme generation types, functions and API to support adding an image

* feat: AI components now support and display images

* feat: add support for multiple images

* feat: add support for multiple images to components

* feat: support image only prompts and clean up API code

* add checkout link support

* add ai-usage schema and actions

* feat: dashboard: add AI usage stats with bar chart

* feat: enforce subscription limits and improved error handling for AI theme generation

* feat: Integrate alert-banner with actual usage

* fix: pricing navigation

* feat: Checkout link generation

* feat: add quick action to create a theme from an image in ai page

* feat: add drag and drop for images

* chore: move Image Upload constant vars and update imports

* feat: improve feedback while theme is being generated

* feat: Add pricing page UI

* refactor: Dashboard migration to Settings page

* feat: improve pricing page

* feat: add auth check in checkout and refactor implementation for consistency and typesafety

* refactor: adjust code and API to follow new types and useQuery hook typesafety

* refactor: alert banner displays correctly and uses the new subscription hook

* feat: improve UI feedback for Pro users

* feat: upload images by pasting (cmd/crtl + v)

* feat: add Go Pro dialog, and global store (no implemented in app yet)

* chore(WIP): scaffold of Pro subscription modal show logic

* feat: Add openProModal logic to handleGenerateTheme in chat-interface

* chore: save closable chat suggestions state as a preference in local storage

* chore: improve color contrast in user UI message

* feat: add pro features components

* chore: update TextArea styles

* feat: adjust theme generation types, functions and API to support adding an image

* feat: AI components now support and display images

* feat: add support for multiple images

* feat: add support for multiple images to components

* feat: support image only prompts and clean up API code

* add ai-usage schema and actions

* feat: dashboard: add AI usage stats with bar chart

* feat: enforce subscription limits and improved error handling for AI theme generation

* feat: Integrate alert-banner with actual usage

* fix: pricing navigation

* feat: Checkout link generation

* feat: add quick action to create a theme from an image in ai page

* feat: add drag and drop for images

* chore: move Image Upload constant vars and update imports

* feat: improve feedback while theme is being generated

* feat: Add pricing page UI

* refactor: Dashboard migration to Settings page

* feat: improve pricing page

* feat: add auth check in checkout and refactor implementation for consistency and typesafety

* refactor: adjust code and API to follow new types and useQuery hook typesafety

* refactor: alert banner displays correctly and uses the new subscription hook

* feat: improve UI feedback for Pro users

* feat: upload images by pasting (cmd/crtl + v)

* feat: add Go Pro dialog, and global store (no implemented in app yet)

* chore(WIP): scaffold of Pro subscription modal show logic

* feat: Add openProModal logic to handleGenerateTheme in chat-interface

* refactor: follow naming convention

* chore: refactor components and layout/pages for consistency

* fix: enforce auth checks or redirect in /settings routes

* chore: update Go Pro dialog

* refactor: create reusable theme toggle component

* feat: add Get Pro dialog to header

* chore: rename GoPro dialog to GetPro and update imports

* feat: add AI generation section to Home page and adjust Get Pro dialog

* chore: save closable chat suggestions state as a preference in local storage

* chore: improve color contrast in user UI message

* feat: add pro features components

* chore: update TextArea styles

* feat: adjust theme generation types, functions and API to support adding an image

* feat: AI components now support and display images

* feat: add support for multiple images

* feat: add support for multiple images to components

* feat: support image only prompts and clean up API code

* add ai-usage schema and actions

* feat: dashboard: add AI usage stats with bar chart

* feat: enforce subscription limits and improved error handling for AI theme generation

* feat: Integrate alert-banner with actual usage

* fix: pricing navigation

* feat: Checkout link generation

* feat: add quick action to create a theme from an image in ai page

* feat: add drag and drop for images

* chore: move Image Upload constant vars and update imports

* feat: improve feedback while theme is being generated

* feat: Add pricing page UI

* refactor: Dashboard migration to Settings page

* feat: improve pricing page

* feat: add auth check in checkout and refactor implementation for consistency and typesafety

* refactor: adjust code and API to follow new types and useQuery hook typesafety

* refactor: alert banner displays correctly and uses the new subscription hook

* feat: improve UI feedback for Pro users

* feat: upload images by pasting (cmd/crtl + v)

* feat: add Go Pro dialog, and global store (no implemented in app yet)

* chore(WIP): scaffold of Pro subscription modal show logic

* feat: Add openProModal logic to handleGenerateTheme in chat-interface

* refactor: follow naming convention

* chore: refactor components and layout/pages for consistency

* fix: enforce auth checks or redirect in /settings routes

* chore: update Go Pro dialog

* refactor: create reusable theme toggle component

* feat: add Get Pro dialog to header

* chore: rename GoPro dialog to GetPro and update imports

* feat: add AI generation section to Home page and adjust Get Pro dialog

* feat: Add customer portal

* feat: add chat input draft persistence (not images)

* styles: improve styles for ai generation and alert banner defaults

* feat: Send whole chat context to AI

* fix: silly typo lol

* feat: support images persistence and sync

* feat: edit message (text, mentions and images)

* fix: add eslint-disable for exhaustive-deps warnings

* chore: fix build error & improve text and styles in suggested prompts

* refactor: handle session and subscription checks and handle post login actions

* migrate to turbopack

* refactor: use reducer builder pattern to sync ai-draft-store with image-uploader

* fix: ai-usage computation: account for abort

* feat: Theme limit handling for pro tier

* refactor: remove duplicate code from ai-chat-form and chat-input

* feat: Add faq to pricing page

* fix: /dashboard navigations -> /settings

* feat: update ui for success page

* feat: Migrate ai chat and draft message store to idb-keyval

* feat: move subscription details in-house

* generate migration

* fix: build err

* styles: improve Message UI

* fix: allow scroll in GoPro dialog chat preview

* feat: improve AI usage feedback when theme generation when success or failure

* feat: Message UI enhancement when assistant message is error feedback

* feat: add latest features in /ai page and refactor Core Theme Generation logic hooks

* styles: improve styles and layout for consistency

* styles: improve styles in settings pages for consistency

* cancelled theme doesn't cost requests

* update next to latest (for turbopack compat)

* fail build if polar webhook secret is not set

* update polar sdk and nextjs plugin

* feat: Create customer before creating checkout for them

* chore: save closable chat suggestions state as a preference in local storage

* chore: improve color contrast in user UI message

* feat: add pro features components

* chore: update TextArea styles

* feat: adjust theme generation types, functions and API to support adding an image

* feat: AI components now support and display images

* feat: add support for multiple images

* feat: add support for multiple images to components

* feat: support image only prompts and clean up API code

* add ai-usage schema and actions

* feat: dashboard: add AI usage stats with bar chart

* feat: enforce subscription limits and improved error handling for AI theme generation

* feat: Integrate alert-banner with actual usage

* fix: pricing navigation

* feat: Checkout link generation

* feat: add quick action to create a theme from an image in ai page

* feat: add drag and drop for images

* chore: move Image Upload constant vars and update imports

* feat: improve feedback while theme is being generated

* feat: Add pricing page UI

* refactor: Dashboard migration to Settings page

* feat: improve pricing page

* feat: add auth check in checkout and refactor implementation for consistency and typesafety

* refactor: adjust code and API to follow new types and useQuery hook typesafety

* refactor: alert banner displays correctly and uses the new subscription hook

* feat: improve UI feedback for Pro users

* feat: upload images by pasting (cmd/crtl + v)

* feat: add Go Pro dialog, and global store (no implemented in app yet)

* chore(WIP): scaffold of Pro subscription modal show logic

* feat: Add openProModal logic to handleGenerateTheme in chat-interface

* refactor: follow naming convention

* chore: refactor components and layout/pages for consistency

* fix: enforce auth checks or redirect in /settings routes

* chore: update Go Pro dialog

* refactor: create reusable theme toggle component

* feat: add Get Pro dialog to header

* chore: rename GoPro dialog to GetPro and update imports

* feat: add AI generation section to Home page and adjust Get Pro dialog

* feat: Add customer portal

* feat: add chat input draft persistence (not images)

* styles: improve styles for ai generation and alert banner defaults

* feat: Send whole chat context to AI

* fix: silly typo lol

* feat: support images persistence and sync

* feat: edit message (text, mentions and images)

* fix: add eslint-disable for exhaustive-deps warnings

* chore: fix build error & improve text and styles in suggested prompts

* refactor: handle session and subscription checks and handle post login actions

* migrate to turbopack

* refactor: use reducer builder pattern to sync ai-draft-store with image-uploader

* fix: ai-usage computation: account for abort

* feat: Theme limit handling for pro tier

* refactor: remove duplicate code from ai-chat-form and chat-input

* feat: Add faq to pricing page

* fix: /dashboard navigations -> /settings

* feat: update ui for success page

* feat: Migrate ai chat and draft message store to idb-keyval

* feat: move subscription details in-house

* generate migration

* fix: build err

* styles: improve Message UI

* fix: allow scroll in GoPro dialog chat preview

* feat: improve AI usage feedback when theme generation when success or failure

* feat: Message UI enhancement when assistant message is error feedback

* feat: add latest features in /ai page and refactor Core Theme Generation logic hooks

* styles: improve styles and layout for consistency

* styles: improve styles in settings pages for consistency

* cancelled theme doesn't cost requests

* update next to latest (for turbopack compat)

* fail build if polar webhook secret is not set

* update polar sdk and nextjs plugin

* feat: Create customer before creating checkout for them

---------

Co-authored-by: Luis Llanes <luisllaboj@gmail.com>
2025-07-17 00:00:07 +05:30
HoshangDEV 60e44aa3ff Update use-theme-mutations.ts (#137)
Update theme deletion logic to refresh router after successful deletion
2025-07-01 12:49:32 +05:30
Sahaj Jain abf708af68 fix: focus color now works from any tab 2025-06-29 00:19:29 +05:30
Sahaj Jain 61a5c5b438 refactor inspector hooks and fix minor functionality 2025-06-28 22:45:42 +05:30
Sahaj Jain 617b948a51 refactor: optimize theme inspector scroll performance
- Add ref-based overlay state tracking to prevent unnecessary re-renders
- Cache scrollable viewport element to avoid repeated DOM queries
- Implement efficient scroll event handling with early exit conditions
- Add comprehensive performance documentation and inline comments
- Separate viewport discovery from scroll event management for better organization
2025-06-28 21:57:39 +05:30
Sahaj Jain c2e46df366 refactor: optimize theme inspector for performance
- Move regex creation to module level to prevent recreation on each render
- Memoize event handlers with useCallback to prevent child re-renders
- Extract state update logic into separate memoized functions
- Create separate component for class items to enable granular memoization
- Add custom prop comparison for better React.memo optimization
- Extract classNames computation to dedicated hook

Reduces re-renders significantly in inspector components
2025-06-28 20:39:02 +05:30
Sahaj Jain b2afd79537 fix: ensure compound foreground tokens are matched correctly in inspector
- Sort theme tokens by length descending to prioritize longer matches
- Fixes issue where text-muted-foreground showed as text-muted
- Ensures compound tokens like card-foreground, primary-foreground are captured fully
2025-06-28 18:40:48 +05:30
Sahaj Jain 69662dc282 refactor: Themes API layer + error handling 2025-06-26 00:35:35 +05:30
Sahaj Jain cbf3e42b50 fix: Add back analytics for ai gen theme 2025-06-01 00:19:09 +05:30
Sahaj Jain 2548f49de1 ai chat (#107)
* Enhanced Editor (#100)

* refactor: editor page to improve responsiveness

* feat: add editor tab persistance to url

* chore: clean up classNames

* feat: enhance theme color-preview to make it responsive

* feat: add ai chat tab working with local state

* successful responses return a theme color-preview
* error responses return a generic message

* fix: invalid tabs fallback to default tab "colors"

* fix: remove messages scroll animation on tabs change and remove duplicate preview

* fix: minor fixes in classNames

* feat: Chat starts with a default message

* refactor: Enhance editor controls and toolbar buttons to disable when generating theme

- Updated button components to be extendible.
- Refactored buttons to utilize TooltipWrapper for consistent tooltip behavior.

* fix: sync controls tabs by 'value' instead of 'defaultValue'

* fix: load messages from local storage, otherwise set a default initial message

* fix: editor mention list positions correctly and add a tab handler for selecting mention

* fix: build errors due to unused imports

* chore: improve defaults and styles for ai chat interface and editor

* refactor: move AIChat state management to a zustand store

* feat: preserve control tab between edit mode and traditional editor mode

* feat: reset ai chat on editor reset button click

* feat: load chat messages dynamically to avoid layout shifts due to local storage

* fix: Use const id for default ai message to avoid re-render

* fix: Use searchParams for callback url as well after auth

* refactor: Remove unused getEditorConfig code

* feat: Only have 1 handler per postlogin action type

This was causing issues in AI Chat form. AI_GENERATE_FROM_CHAT action
was being scheduled twice because of re-render (caused by lazy-loaded
component)

* fix: Add user message for post login action

* refactor: Only use JSONContent in application state (derive textContent from it)

* feat: Auto-attach current theme to prompt after 1st user message

* feat: clean up AI interface and add community themes section

* feat: AI entrypoint redirect to main Editor and trigger theme generation

* chore: improve styles on ai page

* refactor: clean up AI components components from AI page and Editor page

* refactor: share repeated theme generation logic

* fix: chat messages inconsistent padding and pill buttons disabled state

* fix: build error

* feat: remove AI Generation Dialog and related logic

* feat: show agent response about the theme

* refactor: simplify theme generation logic and improve error handling

* refactor: transition from JSONContent to AIPromptData for theme generation

* feat: add retry functionality for user messages in AI chat interface

* refactor: remove unused loading fallback component and integrate loading indicator in chat messages

* change position of retry button

* feat: Improve system prompt

* refactor: replace createCurrentThemePrompt with attachCurrentThemeMention for improved prompt handling

* feat: add a placeholder for new chat and fix chat area styles

* chore: hide Community themes from AI page

* fix: build errors

* fix: ai theme generation only happens when there is content to be sent as the prompt

* feat: show AI tab in production

* fix: Early return after showing error message in ai chat

* feat: Attach last generated message instead of current theme for chat

* Use @ mentions in example prompts

* Enhance mention rendering in AI prompts and update mention styles in CSS

* skip posthog on dev

* Enhanced Editor (#100)

* refactor: editor page to improve responsiveness

* feat: add editor tab persistance to url

* chore: clean up classNames

* feat: enhance theme color-preview to make it responsive

* feat: add ai chat tab working with local state

* successful responses return a theme color-preview
* error responses return a generic message

* fix: invalid tabs fallback to default tab "colors"

* fix: remove messages scroll animation on tabs change and remove duplicate preview

* fix: minor fixes in classNames

* feat: Chat starts with a default message

* refactor: Enhance editor controls and toolbar buttons to disable when generating theme

- Updated button components to be extendible.
- Refactored buttons to utilize TooltipWrapper for consistent tooltip behavior.

* fix: sync controls tabs by 'value' instead of 'defaultValue'

* fix: load messages from local storage, otherwise set a default initial message

* fix: editor mention list positions correctly and add a tab handler for selecting mention

* fix: build errors due to unused imports

* chore: improve defaults and styles for ai chat interface and editor

* refactor: move AIChat state management to a zustand store

* feat: preserve control tab between edit mode and traditional editor mode

* feat: reset ai chat on editor reset button click

* feat: load chat messages dynamically to avoid layout shifts due to local storage

* fix: Use const id for default ai message to avoid re-render

* fix: Use searchParams for callback url as well after auth

* refactor: Remove unused getEditorConfig code

* feat: Only have 1 handler per postlogin action type

This was causing issues in AI Chat form. AI_GENERATE_FROM_CHAT action
was being scheduled twice because of re-render (caused by lazy-loaded
component)

* fix: Add user message for post login action

* refactor: Only use JSONContent in application state (derive textContent from it)

* feat: Auto-attach current theme to prompt after 1st user message

* feat: clean up AI interface and add community themes section

* feat: AI entrypoint redirect to main Editor and trigger theme generation

* chore: improve styles on ai page

* refactor: clean up AI components components from AI page and Editor page

* refactor: share repeated theme generation logic

* fix: chat messages inconsistent padding and pill buttons disabled state

* fix: build error

* feat: remove AI Generation Dialog and related logic

* feat: show agent response about the theme

* refactor: simplify theme generation logic and improve error handling

* refactor: transition from JSONContent to AIPromptData for theme generation

* feat: add retry functionality for user messages in AI chat interface

* refactor: remove unused loading fallback component and integrate loading indicator in chat messages

* change position of retry button

* feat: Improve system prompt

* refactor: replace createCurrentThemePrompt with attachCurrentThemeMention for improved prompt handling

* feat: add a placeholder for new chat and fix chat area styles

* chore: hide Community themes from AI page

* fix: build errors

* fix: ai theme generation only happens when there is content to be sent as the prompt

* feat: show AI tab in production

* fix: Early return after showing error message in ai chat

* feat: Attach last generated message instead of current theme for chat

* Use @ mentions in example prompts

* Enhance mention rendering in AI prompts and update mention styles in CSS

* fix: missing fade effect on chat messages scroll area and overflow in placeholder buttons

* feat: add user name from session to the chat placeholder component

* feat: Improve system prompt context

* chore: remove unnecessary context from example prompts

* feat: Enhance mention list with auto-scroll functionality and update prompt structures in no-messages placeholder

* feat: Add character limit for AI prompt input and integrate character count extension

* fix: Simplify prompt data handling in AI chat component and adjust textarea behavior during AI generation

* fix: Update theme state handling to include current mode in editor store

* chore: improve styles for consistency

* feat: add fun prompts to chat placeholder

* feat: add typography demo to preview panel

* feat: add responsive cards demo based on shadcn showcase

* fix: typography demo scroll area

* fix: build errors due to components refactor

* fix: wrap typography demo in ExamplesPreviewContainer

* feat: change default theme to match shadcn/ui default

* chore: move some theme previews into a dropdown to keep ui clean

---------

Co-authored-by: Luis Llanes <137589205+llanesluis@users.noreply.github.com>
Co-authored-by: Luis Llanes <luisllaboj@gmail.com>
2025-05-31 20:08:53 +05:30
Luis Llanes 162f2a0338 refactor: use undo/redo directly from Editor Store instead of depending on a unrelated hook 2025-05-16 22:18:09 +05:30
Sahaj Jain c60880ea7e feat: Add undo/redo functionality 2025-05-15 11:21:32 +05:30
Luis Llanes 09bcf349b2 feat: add on-demand cancellation for theme generation 2025-05-15 11:21:32 +05:30
Luis Llanes 53abfa18b4 feat: Toolbar buttons and dialogs work
* Add global state logic to handle ThemePreviewPanel state
* Extend hook useAIThemeGeneration by creating a Store and adding State
* Provide loading and disabled states as feedback to user
* Adjust /editor/ components to work with the new Hooks
2025-05-15 11:21:32 +05:30
Sahaj Jain e9a54a1908 feat: Add support for payload for post-login action, also added new action 2025-05-15 11:21:32 +05:30
Sahaj Jain b064e17add feat: Add share button with post login actions 2025-05-03 19:20:12 +05:30
Sahaj Jain c88440e703 Feature/ai (#57)
* ai setup

* working ai theme with rich editor

* update action bar ui

* style chnages

* submit on enter

* remove imports

* fix: Merge ai theme with default

* refactor

* put AI behind auth and fix post login action

* feat: Add ratelimiting using kv and use groq

* fix build errors

* lazy load editor
2025-05-03 17:38:35 +05:30
Sahaj Jain b23bb77fde fix: Middleware matcher to reduce invocations 2025-04-28 19:43:27 +05:30
Sahaj Jain 9ec24f2f11 feat: Show saved presets in theme-preset-select 2025-04-27 01:29:30 +05:30
Sahaj Jain a8ebc09001 Save & Edit
* feat: add formatCompactNumber utility for compact number formatting

* Feature/save (#41)

* setup drizzle with better-auth

* switch to turso

* chore: better auth migrations

* feat: add basic signin signup auth

* update form uis

* remove emailAndPassword

* loading state for auth btns

* add theme routes and save function

* migrate to actions

* feat: Add dashboard page to view saved themes

* hook up delete theme functionality

* minor improvements

* feat(auth): add AuthDialogWrapper and integrate with existing components

* setup post login action to open save modal after login

* refactor action bar

* refactor

* add ability to open theme by id

* Use URL param for themeId

* feat(editor): improve theme loading and add theme editing actions component

* feat(theme): implement theme editing functionality with routing updates

* refactor: move to try-catch

* remove unused files for auth and theme routes

* fix build errors

* modify copies

* add theme limit

* fix: Recursive setstate

* fix: Save theme loading state

* feat: Implement theme checkpoint for better reset during editing

* reset theme after save/reset

* feat: Add privacy-policy page

* speed up nav using prefetch and loading with better loader

* refactor

* update dashbaord UI

* add quick apply to theme card

* switch to neon

* minor ui updates
2025-04-25 23:32:45 +05:30
lorenzopalaia 8499dc6ec4 feat: Implement contrast checker and color picker refactor 2025-04-17 17:16:29 +02:00
Sahaj Jain b3f5de8a3d replace contents with tweakcn-next 2025-04-17 14:18:28 +05:30