DE
Beta-Übersetzung

@core / kit-landing

1.0.1 ▾
verifiziertMIT
GitHub

Landingpage-Kit für Next.js: Blockseiten, Lead-Formulare, Cookie-Banner und Pixel nur mit Einwilligung

Code14 DateienKontext~910 TokensPrüfung bestanden

Der genaue Baum, der nach .genpmignore eingebunden wird. Gepinnt an

src/app/(landing)/_lib/widgets.tsschreibgeschützt · f730e59
// Widget del panel: leads por landing en los últimos 7 días (envíos de formularios hechos desde /lp/…).
import { and, count, desc, gte, like } from 'drizzle-orm';
import type { AdminWidget } from '@/lib/admin';
import { getDb } from '@/lib/db';
import { formSubmissions } from '@/lib/forms';
import { LANDING_PREFIX } from './landings';

export const leadsByLandingWidget: AdminWidget = {
  name: 'leads-by-landing',
  title: 'Leads by landing (7 days)',
  permission: 'submissions:read',
  async load() {
    const rows = await getDb()
      .select({ path: formSubmissions.sourcePath, n: count() })
      .from(formSubmissions)
      .where(and(like(formSubmissions.sourcePath, `${LANDING_PREFIX}/%`), gte(formSubmissions.createdAt, new Date(Date.now() - 7 * 86_400_000))))
      .groupBy(formSubmissions.sourcePath)
      .orderBy(desc(count()))
      .limit(10);
    return { rows: rows.map((r) => ({ label: r.path ?? '', value: r.n, href: r.path ?? undefined })) };
  },
};

@core/kit-landing melden

Melde dich mit GitHub an, um ein Paket zu melden.