Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/proposal-body-no-limit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@anticapture/dashboard": patch
---

Remove the 10,000-character limit on the proposal description in the create-proposal form. The body field now accepts descriptions of any length, and the editor footer shows a plain character count instead of a limit counter.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ const markdownHighlightStyle = HighlightStyle.define([
const sourceViewExtensions = [syntaxHighlighting(markdownHighlightStyle)];

import { TabGroup } from "@/shared/components/design-system/tabs/tab-group/TabGroup";
import {
BODY_CHAR_LIMIT,
BODY_WARNING_THRESHOLD,
} from "@/features/create-proposal/constants";
import type { ProposalFormValues } from "@/features/create-proposal/schema";

type Mode = "visual" | "markdown";
Expand All @@ -61,13 +57,6 @@ export const BodyField = ({ version = 0 }: BodyFieldProps) => {
const body = watch("body") ?? "";
const [mode, setMode] = useState<Mode>("visual");

const counterColor =
body.length > BODY_CHAR_LIMIT
? "text-error"
: body.length >= BODY_WARNING_THRESHOLD
? "text-warning"
: "text-secondary";

return (
<div className="flex w-full flex-col gap-1">
<div
Expand Down Expand Up @@ -165,8 +154,8 @@ export const BodyField = ({ version = 0 }: BodyFieldProps) => {
)}
/>
</div>
<p className={`${counterColor} text-xs`}>
{body.length} / {BODY_CHAR_LIMIT.toLocaleString()}
<p className="text-secondary text-xs">
{body.length.toLocaleString()} characters
</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,7 @@ export const ProposalCreationForm = ({
const filledCount =
(hasTitle ? 1 : 0) + (hasBody ? 1 : 0) + (hasActions ? 1 : 0);
const canPublish =
hasTitle &&
hasBody &&
hasActions &&
!!address &&
form.formState.isValid &&
(values.body?.length ?? 0) <= 10_000;
hasTitle && hasBody && hasActions && !!address && form.formState.isValid;

const stashPendingDraft = () => {
try {
Expand Down
3 changes: 0 additions & 3 deletions apps/dashboard/features/create-proposal/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { type Address, getAddress } from "viem";

import { DaoIdEnum } from "@/shared/types/daos";

export const BODY_CHAR_LIMIT = 10_000;
export const BODY_WARNING_THRESHOLD = 9_500;

export const canCreateProposalForDao = (daoId: DaoIdEnum | null | undefined) =>
daoId === DaoIdEnum.ENS || daoId === DaoIdEnum.SHU;

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/features/create-proposal/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ describe("ProposalFormSchema", () => {
).toBe(false);
});

test("rejects body over 10,000 chars", () => {
test("accepts body over 10,000 chars", () => {
expect(
ProposalFormSchema.safeParse({ ...valid, body: "a".repeat(10_001) })
.success,
).toBe(false);
).toBe(true);
});
});
2 changes: 1 addition & 1 deletion apps/dashboard/features/create-proposal/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const ProposalFormSchema = z
return false;
}
}, "Must be a valid URL"),
body: z.string().min(1, "Required").max(10_000, "10,000 character limit"),
body: z.string().min(1, "Required"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align body validation with the draft storage limit

When a description exceeds 100,000 characters, this schema now accepts it and the form enables Save Draft and Share, but both operations send the body to the User API, whose CreateDraftBodySchema and UpdateDraftBodySchema still enforce BODY_MAX = 100_000 (apps/user-api/src/mappers/drafts/index.ts:51,59,68). Those users receive only the generic “Could not save draft” error and cannot share their otherwise-valid proposal; retain the service ceiling in the form or update the persistence contract alongside this change.

Useful? React with 👍 / 👎.

actions: z
.array(ProposalActionSchema)
.min(1, "At least one action is required"),
Expand Down
Loading