diff --git a/web/src/components/BBSPanel.tsx b/web/src/components/BBSPanel.tsx new file mode 100644 index 0000000..198e720 --- /dev/null +++ b/web/src/components/BBSPanel.tsx @@ -0,0 +1,52 @@ +import { Link } from "react-router-dom"; + +const cardStyle = + "bg-neutral-900 border border-neutral-800 rounded px-4 py-3 text-neutral-300 hover:text-neutral-200 hover:border-neutral-700"; + +interface BBSPanelProps { + hasBBS: boolean; + userHandle: string; + onDelete: () => void; +} + +export default function BBSPanel({ hasBBS, userHandle, onDelete }: BBSPanelProps) { + if (!hasBBS) { + return ( + <> +

+ You haven't set up a BBS yet. +

+ + create a bbs + + + ); + } + + return ( +
+ +
Browse
+
View your BBS.
+ + +
Edit
+
Name, boards, intro.
+ + +
Moderate
+
Bans and hidden posts.
+ + +
+ ); +} diff --git a/web/src/components/BoardRowEditor.tsx b/web/src/components/BoardRowEditor.tsx index bc20303..d89456a 100644 --- a/web/src/components/BoardRowEditor.tsx +++ b/web/src/components/BoardRowEditor.tsx @@ -16,11 +16,11 @@ export default function BoardRowEditor({ boards, onChange, }: BoardRowEditorProps) { - function updateField(index: number, field: keyof BoardRow, value: string) { - const next = boards.map((b, i) => - i === index ? { ...b, [field]: value } : b, + function updateBoard(index: number, field: keyof BoardRow, value: string) { + const updated = boards.map((board, i) => + i === index ? { ...board, [field]: value } : board, ); - onChange(next); + onChange(updated); } return ( @@ -34,20 +34,20 @@ export default function BoardRowEditor({
updateField(i, "slug", e.target.value)} + onChange={(e) => updateBoard(i, "slug", e.target.value)} placeholder="slug" className="w-1/4!" /> updateField(i, "name", e.target.value)} + onChange={(e) => updateBoard(i, "name", e.target.value)} placeholder="Name" maxLength={limits.BOARD_NAME} className="w-1/3!" /> updateField(i, "desc", e.target.value)} + onChange={(e) => updateBoard(i, "desc", e.target.value)} placeholder="Description" maxLength={limits.BOARD_DESCRIPTION} className="flex-1!" diff --git a/web/src/components/ComposeForm.tsx b/web/src/components/ComposeForm.tsx index 6e82d6b..468c12e 100644 --- a/web/src/components/ComposeForm.tsx +++ b/web/src/components/ComposeForm.tsx @@ -1,5 +1,6 @@ import type { SyntheticEvent } from "react"; import { Input, Textarea, Button } from "./Form"; +import FileChips from "./FileChips"; import { MAX_ATTACHMENTS } from "../lib/limits"; interface ComposeFormProps { @@ -35,11 +36,11 @@ export default function ComposeForm({ onFilesChange, quote, onClearQuote, + bodyMaxLength, + titleMaxLength, submitLabel = "post", posting = false, className = "", - bodyMaxLength, - titleMaxLength, }: ComposeFormProps) { function addFiles(fileList: FileList | null) { if (!fileList) return; @@ -47,7 +48,7 @@ export default function ComposeForm({ onFilesChange(combined); } - const atLimit = files.length >= MAX_ATTACHMENTS; + const attachmentsAtLimit = files.length >= MAX_ATTACHMENTS; function removeFile(index: number) { onFilesChange(files.filter((_, i) => i !== index)); @@ -96,27 +97,14 @@ export default function ComposeForm({ /> {files.length > 0 && ( -
- {files.map((f, i) => ( - - {f.name} - - - ))} -
+ )}
- {!atLimit && ( + {!attachmentsAtLimit && (