diff --git a/src/components/inputs/editor/BottomEditorBar.tsx b/src/components/inputs/editor/BottomEditorBar.tsx index 39caa0a8..de9fc48f 100644 --- a/src/components/inputs/editor/BottomEditorBar.tsx +++ b/src/components/inputs/editor/BottomEditorBar.tsx @@ -95,7 +95,7 @@ export default function BottomEditorBar(props: Props) { languages={languages} onSelectLanguages={onSelectLanguages} /> - + diff --git a/src/components/inputs/editor/CharacterCount.tsx b/src/components/inputs/editor/CharacterCount.tsx index 8f26ceb7..7d02b220 100644 --- a/src/components/inputs/editor/CharacterCount.tsx +++ b/src/components/inputs/editor/CharacterCount.tsx @@ -2,17 +2,18 @@ import { CircularProgressbar } from "react-circular-progressbar"; interface Props { charCount: number; + max: number; } export default function CharacterCount(props: Props) { - const { charCount } = props; - const percentage = (100 * charCount) / 300; + const { charCount, max } = props; + const percentage = (100 * charCount) / max; return (
{percentage > 100 && ( - {300 - charCount} + {max - charCount} )} ([]); const [images, setImages] = useState(); const [embedSuggestions, setEmbedSuggestions] = useState>( - new Set("") + new Set(""), ); const [linkEmbed, setLinkEmbed] = useState(""); const [linkCard, setLinkCard] = useState(null); @@ -49,7 +49,7 @@ export default function Editor(props: Props) { const quoteAuthor = quote?.author.displayName || quote?.author.handle; const placeholderText = getComposerPlaceholder( replyTo ? "reply" : quote ? "quote" : "post", - replyAuthor ?? quoteAuthor + replyAuthor ?? quoteAuthor, ); const editor = useEditor({ @@ -152,7 +152,7 @@ export default function Editor(props: Props) { numberOfImages={images?.length ?? 0} /> - + diff --git a/src/components/inputs/editor/UploadPreview.tsx b/src/components/inputs/editor/UploadPreview.tsx index d7b48608..46c416a8 100644 --- a/src/components/inputs/editor/UploadPreview.tsx +++ b/src/components/inputs/editor/UploadPreview.tsx @@ -5,6 +5,8 @@ import Image from "next/image"; import { SetStateAction, useState } from "react"; import Textarea from "../textarea/Textarea"; import { CgClose } from "react-icons/cg"; +import CharacterCount from "./CharacterCount"; +import { MAX_ALT_TEXT_LENGTH } from "@/lib/consts/general"; interface Props { images: UploadImage[]; @@ -19,7 +21,7 @@ export default function UploadPreview(props: Props) { const handleRemove = (image: UploadImage) => { onUpdate((prev) => - prev?.filter((prevImage) => prevImage.url !== image.url) + prev?.filter((prevImage) => prevImage.url !== image.url), ); }; @@ -74,6 +76,7 @@ export default function UploadPreview(props: Props) {