Compare commits
1 Commits
todo/mvp1-
...
todo/mvp1-
| Author | SHA1 | Date | |
|---|---|---|---|
|
18b709b4b0
|
5
TODO.md
5
TODO.md
@@ -114,7 +114,7 @@ This file is the single source of truth for roadmap and delivery progress.
|
|||||||
media model, artwork entity, grouping primitives (gallery/album/category/tag), rendition slots
|
media model, artwork entity, grouping primitives (gallery/album/category/tag), rendition slots
|
||||||
- [~] [P1] `todo/mvp1-media-upload-pipeline`:
|
- [~] [P1] `todo/mvp1-media-upload-pipeline`:
|
||||||
S3/local upload adapter, media processing presets, metadata input flows, admin media CRUD UI
|
S3/local upload adapter, media processing presets, metadata input flows, admin media CRUD UI
|
||||||
- [~] [P1] `todo/mvp1-pages-navigation-builder`:
|
- [x] [P1] `todo/mvp1-pages-navigation-builder`:
|
||||||
page CRUD, navigation tree, reusable page blocks (forms/price cards/gallery embeds)
|
page CRUD, navigation tree, reusable page blocks (forms/price cards/gallery embeds)
|
||||||
- [~] [P1] `todo/mvp1-commissions-customers`:
|
- [~] [P1] `todo/mvp1-commissions-customers`:
|
||||||
commission request intake + admin CRUD + kanban + customer entity/linking
|
commission request intake + admin CRUD + kanban + customer entity/linking
|
||||||
@@ -136,7 +136,7 @@ This file is the single source of truth for roadmap and delivery progress.
|
|||||||
|
|
||||||
### Admin App (Primary Focus)
|
### Admin App (Primary Focus)
|
||||||
|
|
||||||
- [~] [P1] Page management (create/edit/publish/unpublish/schedule)
|
- [x] [P1] Page management (create/edit/publish/unpublish/schedule)
|
||||||
- [x] [P1] Page builder with reusable content blocks (hero, rich text, gallery, CTA, forms, price cards)
|
- [x] [P1] Page builder with reusable content blocks (hero, rich text, gallery, CTA, forms, price cards)
|
||||||
- [x] [P1] Navigation management (menus, nested items, order, visibility)
|
- [x] [P1] Navigation management (menus, nested items, order, visibility)
|
||||||
- [~] [P1] Media library (upload, browse, replace, delete) with media-type classification (artwork, banner, promo, generic, video/gif)
|
- [~] [P1] Media library (upload, browse, replace, delete) with media-type classification (artwork, banner, promo, generic, video/gif)
|
||||||
@@ -371,6 +371,7 @@ This file is the single source of truth for roadmap and delivery progress.
|
|||||||
- [2026-02-12] Commissions management completed: admin kanban cards now include inline detail editing (assignee/customer/budget/due date/notes), linked-artwork references via `linkedArtworkIds`, and creation/edit flows use assignable users instead of raw ID entry.
|
- [2026-02-12] Commissions management completed: admin kanban cards now include inline detail editing (assignee/customer/budget/due date/notes), linked-artwork references via `linkedArtworkIds`, and creation/edit flows use assignable users instead of raw ID entry.
|
||||||
- [2026-02-12] Announcements/news completed: announcements now support locale audience targeting (`targetLocales`) with public locale-aware rendering, and homepage news list now uses locale-aware published posts only.
|
- [2026-02-12] Announcements/news completed: announcements now support locale audience targeting (`targetLocales`) with public locale-aware rendering, and homepage news list now uses locale-aware published posts only.
|
||||||
- [2026-02-12] Public rendering integration completed: portfolio now supports locale-aware tag filters and explicit sort controls, while db/service sorting and rendition selection align public listing/detail media delivery.
|
- [2026-02-12] Public rendering integration completed: portfolio now supports locale-aware tag filters and explicit sort controls, while db/service sorting and rendition selection align public listing/detail media delivery.
|
||||||
|
- [2026-02-12] Page scheduling completed: `Page.scheduledPublishAt` added with admin create/edit support and public page resolution now treating due scheduled pages as published.
|
||||||
- [2026-02-12] Public UX pass: commission request flow now reports explicit invalid budget range errors, and header navigation now falls back to localized defaults (`home`, `portfolio`, `news`, `commissions`) when no CMS menu exists; seed data now creates those default menu entries.
|
- [2026-02-12] Public UX pass: commission request flow now reports explicit invalid budget range errors, and header navigation now falls back to localized defaults (`home`, `portfolio`, `news`, `commissions`) when no CMS menu exists; seed data now creates those default menu entries.
|
||||||
- [2026-02-12] Added `e2e/public-rendering.pw.ts` web coverage for fallback navigation visibility, portfolio routes, and commission submission validation (invalid budget range + successful submission path).
|
- [2026-02-12] Added `e2e/public-rendering.pw.ts` web coverage for fallback navigation visibility, portfolio routes, and commission submission validation (invalid budget range + successful submission path).
|
||||||
- [2026-02-12] Testing execution is temporarily paused for delivery velocity: root test scripts are stubbed and CI test steps are disabled; all testing backlog is consolidated under `MVP 3: Testing and Quality`.
|
- [2026-02-12] Testing execution is temporarily paused for delivery velocity: root test scripts are stubbed and CI test steps are disabled; all testing backlog is consolidated under `MVP 3: Testing and Quality`.
|
||||||
|
|||||||
@@ -42,6 +42,31 @@ function readNullableString(formData: FormData, field: string): string | null {
|
|||||||
return value.length > 0 ? value : null
|
return value.length > 0 ? value : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readNullableDate(formData: FormData, field: string): Date | null {
|
||||||
|
const value = readInputString(formData, field)
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const parsed = new Date(value)
|
||||||
|
return Number.isNaN(parsed.getTime()) ? null : parsed
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDateTimeLocalInput(value: Date | null): string {
|
||||||
|
if (!value) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
const year = value.getFullYear()
|
||||||
|
const month = String(value.getMonth() + 1).padStart(2, "0")
|
||||||
|
const day = String(value.getDate()).padStart(2, "0")
|
||||||
|
const hour = String(value.getHours()).padStart(2, "0")
|
||||||
|
const minute = String(value.getMinutes()).padStart(2, "0")
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}T${hour}:${minute}`
|
||||||
|
}
|
||||||
|
|
||||||
function redirectWithState(pageId: string, params: { notice?: string; error?: string }) {
|
function redirectWithState(pageId: string, params: { notice?: string; error?: string }) {
|
||||||
const query = new URLSearchParams()
|
const query = new URLSearchParams()
|
||||||
|
|
||||||
@@ -109,6 +134,7 @@ export default async function PageEditorPage({ params, searchParams }: PageProps
|
|||||||
content: readInputString(formData, "content"),
|
content: readInputString(formData, "content"),
|
||||||
seoTitle: readNullableString(formData, "seoTitle"),
|
seoTitle: readNullableString(formData, "seoTitle"),
|
||||||
seoDescription: readNullableString(formData, "seoDescription"),
|
seoDescription: readNullableString(formData, "seoDescription"),
|
||||||
|
scheduledPublishAt: readNullableDate(formData, "scheduledPublishAt"),
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
redirectWithState(pageId, {
|
redirectWithState(pageId, {
|
||||||
@@ -224,6 +250,16 @@ export default async function PageEditorPage({ params, searchParams }: PageProps
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label className="space-y-1">
|
||||||
|
<span className="text-xs text-neutral-600">Scheduled publish (optional)</span>
|
||||||
|
<input
|
||||||
|
name="scheduledPublishAt"
|
||||||
|
type="datetime-local"
|
||||||
|
defaultValue={formatDateTimeLocalInput(page.scheduledPublishAt)}
|
||||||
|
className="w-full rounded border border-neutral-300 px-3 py-2 text-sm"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label className="space-y-1">
|
<label className="space-y-1">
|
||||||
<span className="text-xs text-neutral-600">Slug</span>
|
<span className="text-xs text-neutral-600">Slug</span>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -29,6 +29,17 @@ function readNullableString(formData: FormData, field: string): string | null {
|
|||||||
return value.length > 0 ? value : null
|
return value.length > 0 ? value : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readNullableDate(formData: FormData, field: string): Date | null {
|
||||||
|
const value = readInputString(formData, field)
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const parsed = new Date(value)
|
||||||
|
return Number.isNaN(parsed.getTime()) ? null : parsed
|
||||||
|
}
|
||||||
|
|
||||||
function redirectWithState(params: { notice?: string; error?: string }) {
|
function redirectWithState(params: { notice?: string; error?: string }) {
|
||||||
const query = new URLSearchParams()
|
const query = new URLSearchParams()
|
||||||
|
|
||||||
@@ -62,6 +73,7 @@ async function createPageAction(formData: FormData) {
|
|||||||
content: readInputString(formData, "content"),
|
content: readInputString(formData, "content"),
|
||||||
seoTitle: readNullableString(formData, "seoTitle"),
|
seoTitle: readNullableString(formData, "seoTitle"),
|
||||||
seoDescription: readNullableString(formData, "seoDescription"),
|
seoDescription: readNullableString(formData, "seoDescription"),
|
||||||
|
scheduledPublishAt: readNullableDate(formData, "scheduledPublishAt"),
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
redirectWithState({
|
redirectWithState({
|
||||||
@@ -122,6 +134,7 @@ export default async function PagesManagementPage({
|
|||||||
<th className="py-2 pr-4">Title</th>
|
<th className="py-2 pr-4">Title</th>
|
||||||
<th className="py-2 pr-4">Slug</th>
|
<th className="py-2 pr-4">Slug</th>
|
||||||
<th className="py-2 pr-4">Status</th>
|
<th className="py-2 pr-4">Status</th>
|
||||||
|
<th className="py-2 pr-4">Scheduled</th>
|
||||||
<th className="py-2 pr-4">Updated</th>
|
<th className="py-2 pr-4">Updated</th>
|
||||||
<th className="py-2 pr-4">Action</th>
|
<th className="py-2 pr-4">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -129,7 +142,7 @@ export default async function PagesManagementPage({
|
|||||||
<tbody>
|
<tbody>
|
||||||
{pages.length === 0 ? (
|
{pages.length === 0 ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td className="py-3 text-neutral-500" colSpan={5}>
|
<td className="py-3 text-neutral-500" colSpan={6}>
|
||||||
No pages yet.
|
No pages yet.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -139,6 +152,11 @@ export default async function PagesManagementPage({
|
|||||||
<td className="py-3 pr-4">{page.title}</td>
|
<td className="py-3 pr-4">{page.title}</td>
|
||||||
<td className="py-3 pr-4 text-neutral-600">/{page.slug}</td>
|
<td className="py-3 pr-4 text-neutral-600">/{page.slug}</td>
|
||||||
<td className="py-3 pr-4">{page.status}</td>
|
<td className="py-3 pr-4">{page.status}</td>
|
||||||
|
<td className="py-3 pr-4 text-neutral-600">
|
||||||
|
{page.scheduledPublishAt
|
||||||
|
? page.scheduledPublishAt.toLocaleString("en-US")
|
||||||
|
: "-"}
|
||||||
|
</td>
|
||||||
<td className="py-3 pr-4 text-neutral-600">
|
<td className="py-3 pr-4 text-neutral-600">
|
||||||
{page.updatedAt.toLocaleDateString("en-US")}
|
{page.updatedAt.toLocaleDateString("en-US")}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -77,6 +77,15 @@ export function CreatePageForm({ action }: CreatePageFormProps) {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label className="space-y-1">
|
||||||
|
<span className="text-xs text-neutral-600">Scheduled publish (optional)</span>
|
||||||
|
<input
|
||||||
|
name="scheduledPublishAt"
|
||||||
|
type="datetime-local"
|
||||||
|
className="w-full rounded border border-neutral-300 px-3 py-2 text-sm"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
<Button type="submit">Create page</Button>
|
<Button type="submit">Create page</Button>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ export const createPageInputSchema = z.object({
|
|||||||
content: z.string().min(1),
|
content: z.string().min(1),
|
||||||
seoTitle: z.string().max(180).nullable().optional(),
|
seoTitle: z.string().max(180).nullable().optional(),
|
||||||
seoDescription: z.string().max(320).nullable().optional(),
|
seoDescription: z.string().max(320).nullable().optional(),
|
||||||
|
scheduledPublishAt: z.date().nullable().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const updatePageInputSchema = z.object({
|
export const updatePageInputSchema = z.object({
|
||||||
@@ -114,6 +115,7 @@ export const updatePageInputSchema = z.object({
|
|||||||
content: z.string().min(1).optional(),
|
content: z.string().min(1).optional(),
|
||||||
seoTitle: z.string().max(180).nullable().optional(),
|
seoTitle: z.string().max(180).nullable().optional(),
|
||||||
seoDescription: z.string().max(320).nullable().optional(),
|
seoDescription: z.string().max(320).nullable().optional(),
|
||||||
|
scheduledPublishAt: z.date().nullable().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const upsertPageTranslationInputSchema = z.object({
|
export const upsertPageTranslationInputSchema = z.object({
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE "Page"
|
||||||
|
ADD COLUMN "scheduledPublishAt" TIMESTAMP(3);
|
||||||
|
|
||||||
|
CREATE INDEX "Page_scheduledPublishAt_idx" ON "Page"("scheduledPublishAt");
|
||||||
@@ -291,6 +291,7 @@ model Page {
|
|||||||
seoTitle String?
|
seoTitle String?
|
||||||
seoDescription String?
|
seoDescription String?
|
||||||
publishedAt DateTime?
|
publishedAt DateTime?
|
||||||
|
scheduledPublishAt DateTime?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
navItems NavigationItem[]
|
navItems NavigationItem[]
|
||||||
|
|||||||
@@ -29,6 +29,15 @@ function resolvePublishedAt(status: string): Date | null {
|
|||||||
return status === "published" ? new Date() : null
|
return status === "published" ? new Date() : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolvePublicPageWhere(slug?: string) {
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
|
return {
|
||||||
|
...(slug ? { slug } : {}),
|
||||||
|
OR: [{ status: "published" }, { scheduledPublishAt: { lte: now } }],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function listPages(limit = 50) {
|
export async function listPages(limit = 50) {
|
||||||
return db.page.findMany({
|
return db.page.findMany({
|
||||||
orderBy: [{ updatedAt: "desc" }],
|
orderBy: [{ updatedAt: "desc" }],
|
||||||
@@ -38,7 +47,7 @@ export async function listPages(limit = 50) {
|
|||||||
|
|
||||||
export async function listPublishedPageSlugs() {
|
export async function listPublishedPageSlugs() {
|
||||||
const pages = await db.page.findMany({
|
const pages = await db.page.findMany({
|
||||||
where: { status: "published" },
|
where: resolvePublicPageWhere(),
|
||||||
orderBy: { updatedAt: "desc" },
|
orderBy: { updatedAt: "desc" },
|
||||||
select: {
|
select: {
|
||||||
slug: true,
|
slug: true,
|
||||||
@@ -57,19 +66,13 @@ export async function getPageById(id: string) {
|
|||||||
|
|
||||||
export async function getPublishedPageBySlug(slug: string) {
|
export async function getPublishedPageBySlug(slug: string) {
|
||||||
return db.page.findFirst({
|
return db.page.findFirst({
|
||||||
where: {
|
where: resolvePublicPageWhere(slug),
|
||||||
slug,
|
|
||||||
status: "published",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPublishedPageBySlugForLocale(slug: string, locale: string) {
|
export async function getPublishedPageBySlugForLocale(slug: string, locale: string) {
|
||||||
const page = await db.page.findFirst({
|
const page = await db.page.findFirst({
|
||||||
where: {
|
where: resolvePublicPageWhere(slug),
|
||||||
slug,
|
|
||||||
status: "published",
|
|
||||||
},
|
|
||||||
include: {
|
include: {
|
||||||
translations: {
|
translations: {
|
||||||
where: {
|
where: {
|
||||||
@@ -98,11 +101,13 @@ export async function getPublishedPageBySlugForLocale(slug: string, locale: stri
|
|||||||
|
|
||||||
export async function createPage(input: unknown) {
|
export async function createPage(input: unknown) {
|
||||||
const payload = createPageInputSchema.parse(input)
|
const payload = createPageInputSchema.parse(input)
|
||||||
|
const isImmediatelyPublished = payload.status === "published"
|
||||||
|
|
||||||
return db.page.create({
|
return db.page.create({
|
||||||
data: {
|
data: {
|
||||||
...payload,
|
...payload,
|
||||||
publishedAt: resolvePublishedAt(payload.status),
|
publishedAt: resolvePublishedAt(payload.status),
|
||||||
|
scheduledPublishAt: isImmediatelyPublished ? null : (payload.scheduledPublishAt ?? null),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -110,6 +115,7 @@ export async function createPage(input: unknown) {
|
|||||||
export async function updatePage(input: unknown) {
|
export async function updatePage(input: unknown) {
|
||||||
const payload = updatePageInputSchema.parse(input)
|
const payload = updatePageInputSchema.parse(input)
|
||||||
const { id, ...data } = payload
|
const { id, ...data } = payload
|
||||||
|
const isImmediatelyPublished = data.status === "published"
|
||||||
|
|
||||||
return db.page.update({
|
return db.page.update({
|
||||||
where: { id },
|
where: { id },
|
||||||
@@ -117,6 +123,12 @@ export async function updatePage(input: unknown) {
|
|||||||
...data,
|
...data,
|
||||||
publishedAt:
|
publishedAt:
|
||||||
data.status === undefined ? undefined : data.status === "published" ? new Date() : null,
|
data.status === undefined ? undefined : data.status === "published" ? new Date() : null,
|
||||||
|
scheduledPublishAt:
|
||||||
|
data.scheduledPublishAt === undefined
|
||||||
|
? undefined
|
||||||
|
: isImmediatelyPublished
|
||||||
|
? null
|
||||||
|
: data.scheduledPublishAt,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user