Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "Chromaflow",
"short_name": "Chromaflow",
"description": "Create beautiful animated SVG gradients with 326+ templates",
"theme_color": "#000000",
"background_color": "#ffffff",
"theme_color": "#0f1012",
"background_color": "#0f1012",
"display": "standalone",
"orientation": "portrait",
"scope": "/",
Expand All @@ -16,7 +16,7 @@
"purpose": "maskable"
},
{
"src": "/icon-512.png",
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
Expand All @@ -31,7 +31,7 @@
},
{
"src": "/screenshot-2.png",
"sizes": "412x915",
"sizes": "412x915",
"type": "image/png"
}
],
Expand All @@ -51,4 +51,4 @@
"icons": [{ "src": "/icon-96.png", "sizes": "96x96" }]
}
]
}
}
4 changes: 2 additions & 2 deletions public/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Service Worker for PWA functionality
// v3: Fixed cache.addAll failure due to missing favicon.ico
const CACHE_NAME = 'gradient-svg-v3';
// v4: Ink Room redesign — bump cache to invalidate stale pre-redesign shell
const CACHE_NAME = 'gradient-svg-v4';
const urlsToCache = [
'/',
'/create',
Expand Down
46 changes: 46 additions & 0 deletions src/components/common/SectionHeading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import * as React from 'react';
import { cn } from '../../lib/utils';

export interface SectionHeadingProps {
/** Mono uppercase overline label above the title. */
overline?: string;
/** Optional index counter shown before the overline (e.g. "01"). */
counter?: string;
/** The display heading. Size comes from className. */
title: React.ReactNode;
/** Optional right-aligned action slot (e.g. a "View all" link/button). */
action?: React.ReactNode;
className?: string;
}

/**
* Shared editorial section header: mono uppercase overline (optionally with a
* counter prefix) over a single-weight display heading, with an optional
* right-aligned action. Reused across WP1/2/3 sections.
*/
export function SectionHeading({
overline,
counter,
title,
action,
className,
}: SectionHeadingProps) {
return (
<div
className={cn('flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between', className)}
>
<div className="flex flex-col gap-3">
{overline && (
<span className="font-mono text-[13px] uppercase tracking-[0.15em] text-muted-foreground">
{counter && <span className="mr-3 text-foreground/50">{counter}</span>}
{overline}
</span>
)}
<h2 className="font-normal tracking-display text-foreground">{title}</h2>
</div>
{action && <div className="shrink-0">{action}</div>}
</div>
);
}

export default SectionHeading;
6 changes: 2 additions & 4 deletions src/components/features/SwipeableTemplateCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
>
<Card className="overflow-hidden">
<div className="aspect-2/1 relative">
<img

Check warning on line 109 in src/components/features/SwipeableTemplateCarousel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
src={`/api/svg?text=PREVIEW&template=${currentTemplate.name}&height=200`}
alt={currentTemplate.displayName}
className="w-full h-full object-cover"
Expand All @@ -117,7 +117,7 @@

<div className="absolute bottom-0 left-0 right-0 p-4">
<div className="flex items-center justify-between mb-2">
<h3 className="text-white font-semibold text-lg">
<h3 className="text-white text-sm font-mono uppercase tracking-[0.08em]">
{currentTemplate.displayName}
</h3>
<Button
Expand All @@ -129,9 +129,7 @@
onFavorite(currentTemplate.name);
}}
>
<Star
className={cn('h-5 w-5', isFavorite && 'fill-current text-yellow-400')}
/>
<Star className={cn('h-5 w-5', isFavorite && 'fill-current')} />
</Button>
</div>
<Badge className="bg-white/20 text-white border-white/30">
Expand Down
58 changes: 33 additions & 25 deletions src/components/features/TemplateCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo, type MouseEvent } from 'react';
import Link from 'next/link';
import { Star, Eye, ArrowRight } from 'lucide-react';
import { Star } from 'lucide-react';
import { cn } from '../../lib/utils';

export interface TemplateCardData {
Expand Down Expand Up @@ -57,9 +57,9 @@
}
}}
className={cn(
'group relative flex flex-col overflow-hidden rounded-xl border bg-card text-left',
'transition-all duration-300 ease-out cursor-pointer',
'hover:-translate-y-0.5 hover:border-primary/50 hover:shadow-xl',
'group relative flex flex-col overflow-hidden rounded-2xl border border-border bg-card text-left',
'transition-colors duration-200 cursor-pointer',
'hover:border-foreground/40',
'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
)}
>
Expand All @@ -67,7 +67,7 @@
className="relative w-full overflow-hidden bg-muted"
style={{ aspectRatio: PREVIEW_ASPECT_RATIO }}
>
<img

Check warning on line 70 in src/components/features/TemplateCard.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
src={`/api/svg?text=${encodeURIComponent(template.displayName)}&template=${template.name}&height=180&v=2`}
alt={template.displayName}
loading="lazy"
Expand All @@ -80,29 +80,39 @@
onClick={handleFavorite}
className={cn(
'absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-full',
'bg-black/35 text-white backdrop-blur-md transition-all',
'hover:bg-black/55 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',
isFavorite && 'bg-yellow-500/90 text-white hover:bg-yellow-500',
'bg-black/50 transition-colors',
'hover:bg-black/70 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',
)}
>
<Star className={cn('h-3.5 w-3.5', isFavorite && 'fill-current')} />
<Star
className={cn('h-3.5 w-3.5', isFavorite ? 'fill-white text-white' : 'text-white/70')}
/>
</button>
</div>

<div className="flex flex-col gap-0.5 border-t px-3.5 py-3">
<div className="flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground">
{template.categoryIcon ? <span>{template.categoryIcon}</span> : null}
<span className="capitalize">{template.category}</span>
{/* Info strip — height must stay visually constant so the virtualizer's
GRID_CARD_INFO_HEIGHT estimate holds. Fixed leading enforces that. */}
<div className="border-t border-border px-4 py-3.5">
<div className="font-mono text-[11px] uppercase tracking-[0.08em] leading-4 text-muted-foreground line-clamp-1">
{template.category}
</div>
<div className="mt-1.5 flex items-center justify-between gap-2">
<span className="text-[15px] font-normal leading-5 text-foreground line-clamp-1">
{template.displayName}
</span>
<span
aria-hidden
className="shrink-0 text-foreground/40 transition-transform duration-200 group-hover:translate-x-0.5"
>
→
</span>
</div>
<h3 className="text-sm font-semibold text-foreground line-clamp-1">
{template.displayName}
</h3>
</div>

<div
className={cn(
'absolute inset-0 flex items-center justify-center gap-2 p-4',
'bg-black/50 backdrop-blur-[2px] opacity-0',
'bg-black/60 opacity-0',
'transition-opacity duration-200',
'group-hover:opacity-100 group-focus-within:opacity-100',
)}
Expand All @@ -111,25 +121,23 @@
type="button"
onClick={handlePreview}
className={cn(
'inline-flex items-center gap-1.5 rounded-md border border-white/40 bg-white/10 px-3 h-9',
'text-sm font-medium text-white backdrop-blur-sm transition-colors',
'hover:bg-white/20 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white',
'inline-flex items-center rounded-full border border-white/40 px-4 h-9',
'font-mono text-[12px] uppercase tracking-[0.08em] text-white transition-colors',
'hover:bg-white/10 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white',
)}
>
<Eye className="h-4 w-4" />
Preview
</button>
<Link
href={`/create?template=${template.name}`}
onClick={(e) => e.stopPropagation()}
className={cn(
'inline-flex items-center gap-1.5 rounded-md bg-primary px-3 h-9',
'text-sm font-medium text-primary-foreground transition-colors',
'hover:bg-primary/90 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white',
'inline-flex items-center gap-1.5 rounded-full bg-white px-4 h-9',
'font-mono text-[12px] uppercase tracking-[0.08em] text-black transition-colors',
'hover:bg-white/90 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white',
)}
>
Use Template
<ArrowRight className="h-4 w-4" />
Use <span aria-hidden>→</span>
</Link>
</div>
</div>
Expand Down
49 changes: 31 additions & 18 deletions src/components/features/TemplatePreviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@
<DialogHeader>
<div className="flex items-start justify-between pr-8">
<div>
<DialogTitle className="text-2xl">{template.displayName}</DialogTitle>
<DialogDescription className="mt-2 flex items-center gap-2">
<Badge>{template.category}</Badge>
<span className="text-sm">{template.description}</span>
<DialogTitle className="text-2xl tracking-display font-normal">
{template.displayName}
</DialogTitle>
<DialogDescription className="mt-3 flex flex-wrap items-center gap-3">
<Badge variant="outline">{template.category}</Badge>
<span className="text-sm text-muted-foreground">{template.description}</span>
</DialogDescription>
</div>
<Button
variant="ghost"
size="icon"
onClick={() => onFavorite(template.name)}
className="mt-1"
aria-label={isFavorite ? 'Remove from favorites' : 'Add to favorites'}
>
<Star className={cn('h-5 w-5', isFavorite && 'fill-current text-yellow-500')} />
<Star className={cn('h-5 w-5', isFavorite && 'fill-current text-foreground')} />
</Button>
</div>
</DialogHeader>
Expand All @@ -102,49 +105,55 @@
</TabsList>

<TabsContent value="preview" className="mt-4">
<div className="rounded-lg border bg-muted/30 p-8">
<div className="rounded-2xl border border-border bg-muted/20 p-8">
<div className="max-w-full overflow-hidden">
<img src={previewUrl} alt={template.displayName} className="w-full h-auto" />

Check warning on line 110 in src/components/features/TemplatePreviewModal.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
</div>
</div>
<div className="mt-4 flex items-center gap-4">
<p className="text-sm text-muted-foreground">
Animation: {template.animationDuration} • Type: {template.gradientType} • Colors:{' '}
<p className="font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
Animation {template.animationDuration} · Type {template.gradientType} · Colors{' '}
{template.colors?.length || 0}
</p>
</div>
</TabsContent>

<TabsContent value="customize" className="mt-4 space-y-4">
<div>
<label className="text-sm font-medium mb-2 block">Preview Text</label>
<label className="mb-2 block font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
Preview Text
</label>
<Input
value={previewText}
onChange={(e) => setPreviewText(e.target.value)}
placeholder="Enter preview text..."
/>
</div>
<div>
<label className="text-sm font-medium mb-2 block">Height: {previewHeight}px</label>
<label className="mb-2 block font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
Height {previewHeight}px
</label>
<input
type="range"
min="30"
max="300"
value={previewHeight}
onChange={(e) => setPreviewHeight(parseInt(e.target.value))}
className="w-full"
className="w-full accent-foreground"
/>
</div>
<div className="rounded-lg border bg-muted/30 p-4">
<div className="rounded-2xl border border-border bg-muted/20 p-4">
<img src={previewUrl} alt="Custom preview" className="w-full h-auto" />

Check warning on line 146 in src/components/features/TemplatePreviewModal.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
</div>
</TabsContent>

<TabsContent value="code" className="mt-4 space-y-4">
<div>
<label className="text-sm font-medium mb-2 block">Markdown</label>
<label className="mb-2 block font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
Markdown
</label>
<div className="relative">
<pre className="rounded-lg bg-muted p-4 text-sm overflow-x-auto">
<pre className="rounded-xl border border-border bg-muted p-4 text-sm overflow-x-auto">
<code>{`![${previewText}](${apiUrl})`}</code>
</pre>
<Button
Expand All @@ -158,9 +167,11 @@
</div>
</div>
<div>
<label className="text-sm font-medium mb-2 block">HTML</label>
<label className="mb-2 block font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
HTML
</label>
<div className="relative">
<pre className="rounded-lg bg-muted p-4 text-sm overflow-x-auto">
<pre className="rounded-xl border border-border bg-muted p-4 text-sm overflow-x-auto">
<code>{`<img src="${apiUrl}" alt="${previewText}" />`}</code>
</pre>
<Button
Expand All @@ -174,9 +185,11 @@
</div>
</div>
<div>
<label className="text-sm font-medium mb-2 block">API URL</label>
<label className="mb-2 block font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground">
API URL
</label>
<div className="relative">
<pre className="rounded-lg bg-muted p-4 text-sm overflow-x-auto">
<pre className="rounded-xl border border-border bg-muted p-4 text-sm overflow-x-auto">
<code>{apiUrl}</code>
</pre>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
export default function MobilePropertiesPanel({ isOpen, onClose }: MobilePropertiesPanelProps) {
const [activeTab, setActiveTab] = useState('basic');

const currentConfig = useStore((state: any) => state.currentConfig);

Check warning on line 20 in src/components/features/properties-panel/MobilePropertiesPanel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Unexpected any. Specify a different type
const updateConfig = useStore((state: any) => state.updateConfig);

Check warning on line 21 in src/components/features/properties-panel/MobilePropertiesPanel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Unexpected any. Specify a different type
const baseTemplate = useStore((state: any) => state.baseTemplate);

Check warning on line 22 in src/components/features/properties-panel/MobilePropertiesPanel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Unexpected any. Specify a different type
const isModified = useStore((state: any) => state.isModified);

Check warning on line 23 in src/components/features/properties-panel/MobilePropertiesPanel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Unexpected any. Specify a different type
const resetToTemplate = useStore((state: any) => state.resetToTemplate);

Check warning on line 24 in src/components/features/properties-panel/MobilePropertiesPanel.tsx

View workflow job for this annotation

GitHub Actions / Lint · Typecheck · Test · Build

Unexpected any. Specify a different type

const { colors, handleColorUpdate, handleAddColor, handleRemoveColor } = useColorManagement();
const { panelHeight, heightClass, cycleHeight } = usePanelHeight({
Expand All @@ -35,7 +35,7 @@
return (
<div
className={cn(
'fixed inset-x-0 bottom-0 z-50 bg-background border-t rounded-t-[10px] shadow-lg',
'fixed inset-x-0 bottom-0 z-50 bg-background border-t border-border rounded-t-[10px]',
'mobile-properties-sheet',
heightClass,
'transition-all duration-300 overflow-hidden flex flex-col',
Expand All @@ -45,7 +45,9 @@

<div className="flex items-start justify-between p-4 pb-2 pt-0">
<div className="flex-1">
<h3 className="text-lg font-semibold">Properties</h3>
<h3 className="font-mono text-[11px] uppercase tracking-[0.2em] text-muted-foreground">
Properties
</h3>
<Badge
variant={baseTemplate && !isModified ? 'default' : 'outline'}
className="w-fit mt-1"
Expand Down
Loading
Loading