feat(specials): add curator field
This commit is contained in:
@@ -10,6 +10,7 @@ interface Special {
|
||||
unlockSteps: string;
|
||||
launchDate?: string;
|
||||
endDate?: string;
|
||||
curator?: string;
|
||||
_count?: {
|
||||
songs: number;
|
||||
};
|
||||
@@ -66,6 +67,7 @@ export default function AdminPage() {
|
||||
const [newSpecialUnlockSteps, setNewSpecialUnlockSteps] = useState('[2,4,7,11,16,30,60]');
|
||||
const [newSpecialLaunchDate, setNewSpecialLaunchDate] = useState('');
|
||||
const [newSpecialEndDate, setNewSpecialEndDate] = useState('');
|
||||
const [newSpecialCurator, setNewSpecialCurator] = useState('');
|
||||
|
||||
const [editingSpecialId, setEditingSpecialId] = useState<number | null>(null);
|
||||
const [editSpecialName, setEditSpecialName] = useState('');
|
||||
@@ -73,6 +75,7 @@ export default function AdminPage() {
|
||||
const [editSpecialUnlockSteps, setEditSpecialUnlockSteps] = useState('[2,4,7,11,16,30,60]');
|
||||
const [editSpecialLaunchDate, setEditSpecialLaunchDate] = useState('');
|
||||
const [editSpecialEndDate, setEditSpecialEndDate] = useState('');
|
||||
const [editSpecialCurator, setEditSpecialCurator] = useState('');
|
||||
|
||||
// Edit state
|
||||
const [editingId, setEditingId] = useState<number | null>(null);
|
||||
@@ -186,6 +189,7 @@ export default function AdminPage() {
|
||||
unlockSteps: newSpecialUnlockSteps,
|
||||
launchDate: newSpecialLaunchDate || null,
|
||||
endDate: newSpecialEndDate || null,
|
||||
curator: newSpecialCurator || null,
|
||||
}),
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -194,6 +198,7 @@ export default function AdminPage() {
|
||||
setNewSpecialUnlockSteps('[2,4,7,11,16,30,60]');
|
||||
setNewSpecialLaunchDate('');
|
||||
setNewSpecialEndDate('');
|
||||
setNewSpecialCurator('');
|
||||
fetchSpecials();
|
||||
} else {
|
||||
alert('Failed to create special');
|
||||
@@ -275,6 +280,7 @@ export default function AdminPage() {
|
||||
setEditSpecialUnlockSteps(special.unlockSteps);
|
||||
setEditSpecialLaunchDate(special.launchDate ? new Date(special.launchDate).toISOString().split('T')[0] : '');
|
||||
setEditSpecialEndDate(special.endDate ? new Date(special.endDate).toISOString().split('T')[0] : '');
|
||||
setEditSpecialCurator(special.curator || '');
|
||||
};
|
||||
|
||||
const saveEditedSpecial = async () => {
|
||||
@@ -289,6 +295,7 @@ export default function AdminPage() {
|
||||
unlockSteps: editSpecialUnlockSteps,
|
||||
launchDate: editSpecialLaunchDate || null,
|
||||
endDate: editSpecialEndDate || null,
|
||||
curator: editSpecialCurator || null,
|
||||
}),
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -707,6 +714,10 @@ export default function AdminPage() {
|
||||
<label style={{ fontSize: '0.75rem', color: '#666' }}>End Date</label>
|
||||
<input type="date" value={newSpecialEndDate} onChange={e => setNewSpecialEndDate(e.target.value)} className="form-input" />
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
<label style={{ fontSize: '0.75rem', color: '#666' }}>Curator</label>
|
||||
<input type="text" placeholder="Curator name" value={newSpecialCurator} onChange={e => setNewSpecialCurator(e.target.value)} className="form-input" />
|
||||
</div>
|
||||
<button type="submit" className="btn-primary" style={{ height: '38px' }}>Add Special</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -752,6 +763,10 @@ export default function AdminPage() {
|
||||
<label style={{ fontSize: '0.75rem', color: '#666' }}>End Date</label>
|
||||
<input type="date" value={editSpecialEndDate} onChange={e => setEditSpecialEndDate(e.target.value)} className="form-input" />
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
<label style={{ fontSize: '0.75rem', color: '#666' }}>Curator</label>
|
||||
<input type="text" value={editSpecialCurator} onChange={e => setEditSpecialCurator(e.target.value)} className="form-input" />
|
||||
</div>
|
||||
<button onClick={saveEditedSpecial} className="btn-primary" style={{ height: '38px' }}>Save</button>
|
||||
<button onClick={() => setEditingSpecialId(null)} className="btn-secondary" style={{ height: '38px' }}>Cancel</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user