feat: full studio build -- light theme, canvas thumbnails, i18n (fa/en)

This commit is contained in:
Soroush.Asadi
2026-05-24 17:37:21 +03:30
parent d962483359
commit c61f587767
295 changed files with 29797 additions and 265 deletions
+45
View File
@@ -0,0 +1,45 @@
-- Run in Supabase SQL Editor (Dashboard → SQL)
create table if not exists public.profiles (
id uuid primary key references auth.users (id) on delete cascade,
email text,
plan text not null default 'free' check (plan in ('free', 'pro', 'business')),
billing_period text check (billing_period in ('monthly', 'annual')),
stripe_customer_id text,
stripe_subscription_id text,
updated_at timestamptz not null default now()
);
alter table public.profiles enable row level security;
create policy "Users can read own profile"
on public.profiles
for select
using (auth.uid() = id);
create policy "Users can update own profile"
on public.profiles
for update
using (auth.uid() = id);
-- Optional: auto-create profile on signup
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer
set search_path = public
as $$
begin
insert into public.profiles (id, email, plan)
values (new.id, new.email, 'free')
on conflict (id) do nothing;
return new;
end;
$$;
drop trigger if exists on_auth_user_created on auth.users;
create trigger on_auth_user_created
after insert on auth.users
for each row
execute function public.handle_new_user();
+49
View File
@@ -0,0 +1,49 @@
-- Video render job queue (run in Supabase SQL Editor)
-- Also create Storage bucket "renders" (public) in Dashboard → Storage
create table if not exists public.render_jobs (
id uuid primary key default gen_random_uuid(),
project_id text not null,
status text not null default 'queued'
check (status in ('queued', 'processing', 'completed', 'failed')),
progress integer not null default 0 check (progress >= 0 and progress <= 100),
progress_message text,
output_url text,
scenes jsonb not null,
settings jsonb not null,
error_message text,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists render_jobs_project_id_idx
on public.render_jobs (project_id);
create index if not exists render_jobs_status_idx
on public.render_jobs (status);
alter table public.render_jobs enable row level security;
-- Service role bypasses RLS; allow authenticated read via API routes only.
create policy "Authenticated users can read render jobs"
on public.render_jobs
for select
to authenticated
using (true);
create or replace function public.set_render_jobs_updated_at()
returns trigger
language plpgsql
as $$
begin
new.updated_at = now();
return new;
end;
$$;
drop trigger if exists render_jobs_updated_at on public.render_jobs;
create trigger render_jobs_updated_at
before update on public.render_jobs
for each row
execute function public.set_render_jobs_updated_at();
+56
View File
@@ -0,0 +1,56 @@
-- User projects (run in Supabase SQL Editor)
create table if not exists public.projects (
id uuid primary key default gen_random_uuid(),
user_id uuid not null references auth.users (id) on delete cascade,
name text not null default 'Untitled project',
type text not null check (type in ('video', 'image', 'trimmer')),
scene_data jsonb not null default '{}'::jsonb,
render_url text,
status text not null default 'draft'
check (status in ('draft', 'rendering', 'ready')),
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists projects_user_id_idx on public.projects (user_id);
create index if not exists projects_updated_at_idx on public.projects (updated_at desc);
alter table public.projects enable row level security;
create policy "Users can read own projects"
on public.projects
for select
using (auth.uid() = user_id);
create policy "Users can insert own projects"
on public.projects
for insert
with check (auth.uid() = user_id);
create policy "Users can update own projects"
on public.projects
for update
using (auth.uid() = user_id);
create policy "Users can delete own projects"
on public.projects
for delete
using (auth.uid() = user_id);
create or replace function public.set_projects_updated_at()
returns trigger
language plpgsql
as $$
begin
new.updated_at = now();
return new;
end;
$$;
drop trigger if exists projects_updated_at on public.projects;
create trigger projects_updated_at
before update on public.projects
for each row
execute function public.set_projects_updated_at();