Delning av böcker, skydd mot kolliderande ändringar och import från Word
Böcker kan delas med roller (läsare, redaktör, administratör), och behörigheten kontrolleras på servern. Formulär för poster, relationer och händelser skickar med version, och en krock visar vad som skiljer och låter användaren spara ändå eller ladda om. Ifyllda Word-mallar kan importeras med förhandsgranskning. Importerade ID flyttar nu räknaren. Migrering 0007. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd269d70a5
commit
86fd435438
64 files changed
+4796
-235
No files matched your search
@@ -3,10 +3,12 @@ import { notFound } from "next/navigation";
|
||||
import { IconTrash } from "@tabler/icons-react";
|
||||
import { deleteEvent, saveEvent } from "@/actions/events";
|
||||
import { ConfirmSubmit } from "@/components/confirm-submit";
|
||||
import { ConflictForm } from "@/components/conflict-form";
|
||||
import { EntitySelect } from "@/components/entity-select";
|
||||
import { PageBody, PageHeader } from "@/components/page";
|
||||
import { StoryDateInput } from "@/components/story-date-input";
|
||||
import { getT } from "@/i18n/server";
|
||||
import { versionOf } from "@/lib/conflict";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { requireBook } from "@/lib/session";
|
||||
|
||||
@@ -19,7 +21,7 @@ export default async function EventPage({
|
||||
}) {
|
||||
const { bookId, eventId } = await params;
|
||||
const { saved, error } = await searchParams;
|
||||
await requireBook(bookId);
|
||||
await requireBook(bookId, "EDITOR");
|
||||
const { t } = await getT();
|
||||
|
||||
const event = await prisma.storyEvent.findFirst({ where: { id: eventId, bookId }, include: { participants: true } });
|
||||
@@ -49,7 +51,7 @@ export default async function EventPage({
|
||||
<PageBody>
|
||||
{saved ? <div className="alert alert-success">{t("common.saved")}</div> : null}
|
||||
{error === "date" ? <div className="alert alert-danger">{t("timeline.invalidDate")}</div> : null}
|
||||
<form action={saveEvent}>
|
||||
<ConflictForm action={saveEvent} version={versionOf(event.updatedAt)}>
|
||||
<input type="hidden" name="bookId" value={bookId} />
|
||||
<input type="hidden" name="id" value={event.id} />
|
||||
<div className="card mb-3">
|
||||
@@ -88,7 +90,7 @@ export default async function EventPage({
|
||||
{t("common.save")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</ConflictForm>
|
||||
</PageBody>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { EmptyState, PageBody, PageHeader } from "@/components/page";
|
||||
import { StoryDateInput } from "@/components/story-date-input";
|
||||
import { getT } from "@/i18n/server";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { hasRole } from "@/lib/access";
|
||||
import { requireBook } from "@/lib/session";
|
||||
import { storyYear } from "@/lib/story-date";
|
||||
import { loadTimeline, TIMELINE_KINDS, type TimelineItem, type TimelineKind } from "@/lib/timeline";
|
||||
@@ -28,7 +29,7 @@ export default async function TimelinePage({
|
||||
}) {
|
||||
const { bookId } = await params;
|
||||
const { person, kind, error } = await searchParams;
|
||||
await requireBook(bookId);
|
||||
const canEdit = hasRole((await requireBook(bookId)).role, "EDITOR");
|
||||
const { t } = await getT();
|
||||
|
||||
const wanted = (Array.isArray(kind) ? kind : kind ? [kind] : []).filter((k): k is TimelineKind => (TIMELINE_KINDS as string[]).includes(k));
|
||||
@@ -184,7 +185,7 @@ export default async function TimelinePage({
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="col-lg-4">
|
||||
<div className="col-lg-4" hidden={!canEdit}>
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{t("timeline.addEvent")}</h3>
|
||||
|
||||
Reference in new issue
Block a user