main: fix build issue
Signed-off-by: nfel <nfilsaraee@gmail.com>
This commit is contained in:
parent
c33570d3ec
commit
9fd79a2d4e
@ -1,5 +1,5 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import { ZarinPal } from 'zarinpal-node-sdk';
|
import ZarinPal from 'zarinpal-node-sdk';
|
||||||
import { getDatabase } from '@/lib/db';
|
import { getDatabase } from '@/lib/db';
|
||||||
|
|
||||||
const zarinpal = new ZarinPal({
|
const zarinpal = new ZarinPal({
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import { ZarinPal } from 'zarinpal-node-sdk';
|
import ZarinPal from 'zarinpal-node-sdk';
|
||||||
import { getDatabase } from '@/lib/db';
|
import { getDatabase } from '@/lib/db';
|
||||||
|
|
||||||
const zarinpal = new ZarinPal({
|
const zarinpal = new ZarinPal({
|
||||||
|
|||||||
@ -22,6 +22,9 @@ export default function AddAlbumModal({ show, onClose, onAdd }: AddAlbumModalPro
|
|||||||
const [isUploading, setIsUploading] = useState(false);
|
const [isUploading, setIsUploading] = useState(false);
|
||||||
const [songs, setSongs] = useState<Song[]>([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
const [songs, setSongs] = useState<Song[]>([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
|
const [tag, setTag] = useState<'Album' | 'EP' | 'Demo' | 'Deluxe' | 'Single'>('Album');
|
||||||
|
const [format, setFormat] = useState<'mp3' | 'm4a' | 'flac' | 'wav'>('mp3');
|
||||||
|
const [bitrate, setBitrate] = useState('320kbps');
|
||||||
|
|
||||||
const handleAddSong = () => {
|
const handleAddSong = () => {
|
||||||
setSongs([...songs, { id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
setSongs([...songs, { id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
||||||
@ -134,6 +137,9 @@ export default function AddAlbumModal({ show, onClose, onAdd }: AddAlbumModalPro
|
|||||||
description,
|
description,
|
||||||
price: priceNum,
|
price: priceNum,
|
||||||
songs: albumSongs,
|
songs: albumSongs,
|
||||||
|
tag,
|
||||||
|
format,
|
||||||
|
bitrate,
|
||||||
};
|
};
|
||||||
|
|
||||||
onAdd(newAlbum);
|
onAdd(newAlbum);
|
||||||
@ -150,6 +156,9 @@ export default function AddAlbumModal({ show, onClose, onAdd }: AddAlbumModalPro
|
|||||||
setCoverImageFile(null);
|
setCoverImageFile(null);
|
||||||
setSongs([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
setSongs([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
||||||
setError('');
|
setError('');
|
||||||
|
setTag('Album');
|
||||||
|
setFormat('mp3');
|
||||||
|
setBitrate('320kbps');
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -309,6 +318,56 @@ export default function AddAlbumModal({ show, onClose, onAdd }: AddAlbumModalPro
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Tag, Format, and Bitrate */}
|
||||||
|
<div className="grid grid-cols-3 gap-4">
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Tag *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
value={tag}
|
||||||
|
onChange={(e) => setTag(e.target.value as any)}
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-cyan focus:outline-none focus:ring-2 focus:ring-accent-cyan/50 text-white"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="Album">Album</option>
|
||||||
|
<option value="EP">EP</option>
|
||||||
|
<option value="Demo">Demo</option>
|
||||||
|
<option value="Deluxe">Deluxe</option>
|
||||||
|
<option value="Single">Single</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Format *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
value={format}
|
||||||
|
onChange={(e) => setFormat(e.target.value as any)}
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-cyan focus:outline-none focus:ring-2 focus:ring-accent-cyan/50 text-white"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="mp3">MP3</option>
|
||||||
|
<option value="m4a">M4A</option>
|
||||||
|
<option value="flac">FLAC</option>
|
||||||
|
<option value="wav">WAV</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Bitrate *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={bitrate}
|
||||||
|
onChange={(e) => setBitrate(e.target.value)}
|
||||||
|
placeholder="320kbps"
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-cyan focus:outline-none focus:ring-2 focus:ring-accent-cyan/50 text-white placeholder-gray-500"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Songs */}
|
{/* Songs */}
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
|
|||||||
@ -23,6 +23,9 @@ export default function EditAlbumModal({ show, album, onClose, onUpdate }: EditA
|
|||||||
const [isUploading, setIsUploading] = useState(false);
|
const [isUploading, setIsUploading] = useState(false);
|
||||||
const [songs, setSongs] = useState<Song[]>([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
const [songs, setSongs] = useState<Song[]>([{ id: '', title: '', duration: '', previewUrl: '', fullUrl: '' }]);
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
|
const [tag, setTag] = useState<'Album' | 'EP' | 'Demo' | 'Deluxe' | 'Single'>('Album');
|
||||||
|
const [format, setFormat] = useState<'mp3' | 'm4a' | 'flac' | 'wav'>('mp3');
|
||||||
|
const [bitrate, setBitrate] = useState('320kbps');
|
||||||
|
|
||||||
// Populate form when album changes
|
// Populate form when album changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -34,6 +37,9 @@ export default function EditAlbumModal({ show, album, onClose, onUpdate }: EditA
|
|||||||
setPrice(album.price.toString());
|
setPrice(album.price.toString());
|
||||||
setCoverImage(album.coverImage || '');
|
setCoverImage(album.coverImage || '');
|
||||||
setSongs(album.songs.map((song) => ({ ...song })));
|
setSongs(album.songs.map((song) => ({ ...song })));
|
||||||
|
setTag(album.tag);
|
||||||
|
setFormat(album.format);
|
||||||
|
setBitrate(album.bitrate);
|
||||||
}
|
}
|
||||||
}, [album]);
|
}, [album]);
|
||||||
|
|
||||||
@ -149,6 +155,9 @@ export default function EditAlbumModal({ show, album, onClose, onUpdate }: EditA
|
|||||||
description,
|
description,
|
||||||
price: priceNum,
|
price: priceNum,
|
||||||
songs: albumSongs,
|
songs: albumSongs,
|
||||||
|
tag,
|
||||||
|
format,
|
||||||
|
bitrate,
|
||||||
};
|
};
|
||||||
|
|
||||||
onUpdate(album.id, updatedAlbum);
|
onUpdate(album.id, updatedAlbum);
|
||||||
@ -318,6 +327,56 @@ export default function EditAlbumModal({ show, album, onClose, onUpdate }: EditA
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Tag, Format, and Bitrate */}
|
||||||
|
<div className="grid grid-cols-3 gap-4">
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Tag *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
value={tag}
|
||||||
|
onChange={(e) => setTag(e.target.value as any)}
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-orange focus:outline-none focus:ring-2 focus:ring-accent-orange/50 text-white"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="Album">Album</option>
|
||||||
|
<option value="EP">EP</option>
|
||||||
|
<option value="Demo">Demo</option>
|
||||||
|
<option value="Deluxe">Deluxe</option>
|
||||||
|
<option value="Single">Single</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Format *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
value={format}
|
||||||
|
onChange={(e) => setFormat(e.target.value as any)}
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-orange focus:outline-none focus:ring-2 focus:ring-accent-orange/50 text-white"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="mp3">MP3</option>
|
||||||
|
<option value="m4a">M4A</option>
|
||||||
|
<option value="flac">FLAC</option>
|
||||||
|
<option value="wav">WAV</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-300 mb-2">
|
||||||
|
Bitrate *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={bitrate}
|
||||||
|
onChange={(e) => setBitrate(e.target.value)}
|
||||||
|
placeholder="320kbps"
|
||||||
|
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-lg focus:border-accent-orange focus:outline-none focus:ring-2 focus:ring-accent-orange/50 text-white placeholder-gray-500"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Songs */}
|
{/* Songs */}
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
|
|||||||
@ -163,7 +163,10 @@ export const albums: Album[] = [
|
|||||||
coverImage: "/albums/showbiz.jpg",
|
coverImage: "/albums/showbiz.jpg",
|
||||||
year: 1999,
|
year: 1999,
|
||||||
genre: "Alternative Rock / Progressive Rock",
|
genre: "Alternative Rock / Progressive Rock",
|
||||||
price: 11.99,
|
price: 250000,
|
||||||
|
tag: "Album",
|
||||||
|
format: "mp3",
|
||||||
|
bitrate: "320kbps",
|
||||||
description: "A powerful debut album blending alternative rock with progressive elements. Features raw energy, soaring vocals, and guitar-driven anthems that established a unique sound in the late 90s rock scene.",
|
description: "A powerful debut album blending alternative rock with progressive elements. Features raw energy, soaring vocals, and guitar-driven anthems that established a unique sound in the late 90s rock scene.",
|
||||||
songs: [
|
songs: [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user