feat: media & music file name
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
Badge,
|
||||
} from "@/components/ui";
|
||||
import { EditIcon, PlusIcon, TrashIcon } from "@/components/icons";
|
||||
import { formatMinutes } from "@/lib/utils";
|
||||
import { formatMinutes, fileNameToTitle } from "@/lib/utils";
|
||||
import { MediaPreview } from "@/components/MediaPreview";
|
||||
import { ImagePicker } from "@/components/ImagePicker";
|
||||
import { pickUrl, SOUND_KEYS, VIDEO_KEYS, IMAGE_KEYS } from "@/lib/media";
|
||||
@@ -397,7 +397,12 @@ export default function MediaPage() {
|
||||
<Input
|
||||
type="file"
|
||||
accept="audio/*,video/*"
|
||||
onChange={(e) => setFile(e.target.files?.[0] ?? null)}
|
||||
onChange={(e) => {
|
||||
const f = e.target.files?.[0] ?? null;
|
||||
setFile(f);
|
||||
// Fill the title from the file name if still empty.
|
||||
if (f && !title.trim()) setTitle(fileNameToTitle(f.name));
|
||||
}}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user