mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: ability to edit mii descriptions
I forgot
This commit is contained in:
parent
75ed926b39
commit
2d82be8453
2 changed files with 21 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ export default function EditForm({ mii, likes }: Props) {
|
|||
|
||||
const [name, setName] = useState(mii.name);
|
||||
const [tags, setTags] = useState(mii.tags);
|
||||
const [description, setDescription] = useState(mii.description);
|
||||
const hasFilesChanged = useRef(false);
|
||||
|
||||
const handleSubmit = async () => {
|
||||
|
|
@ -64,6 +65,8 @@ export default function EditForm({ mii, likes }: Props) {
|
|||
const formData = new FormData();
|
||||
if (name != mii.name) formData.append("name", name);
|
||||
if (tags != mii.tags) formData.append("tags", JSON.stringify(tags));
|
||||
if (description != mii.description) formData.append("description", description);
|
||||
|
||||
if (hasFilesChanged.current) {
|
||||
files.forEach((file, index) => {
|
||||
// image1, image2, etc.
|
||||
|
|
@ -172,6 +175,20 @@ export default function EditForm({ mii, likes }: Props) {
|
|||
<TagSelector tags={tags} setTags={setTags} />
|
||||
</div>
|
||||
|
||||
<div className="w-full grid grid-cols-3 items-start">
|
||||
<label htmlFor="reason-note" className="font-semibold py-2">
|
||||
Description
|
||||
</label>
|
||||
<textarea
|
||||
rows={3}
|
||||
maxLength={256}
|
||||
placeholder="(optional) Type a description..."
|
||||
className="pill input !rounded-xl resize-none col-span-2"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Separator */}
|
||||
<div className="flex items-center gap-4 text-zinc-500 text-sm font-medium mt-8 mb-2">
|
||||
<hr className="flex-grow border-zinc-300" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue