changed checklist order and added what is next when collaped.
This commit is contained in:
+29
-2
@@ -1974,7 +1974,29 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
||||
questionPage * QUESTION_PAGE_SIZE,
|
||||
(questionPage + 1) * QUESTION_PAGE_SIZE,
|
||||
)
|
||||
const checklistTasksSorted = [...podcastChecklist.tasks].sort((a, b) => a.label.localeCompare(b.label, undefined, { sensitivity: 'base' }))
|
||||
const checklistTaskOrder = [
|
||||
'verify_script',
|
||||
'read_script',
|
||||
'record',
|
||||
'mix',
|
||||
'edit',
|
||||
'video_script',
|
||||
'post_spotify',
|
||||
'update_website',
|
||||
'send_email',
|
||||
]
|
||||
const checklistTaskOrderIndex = new Map(checklistTaskOrder.map((id, index) => [id, index]))
|
||||
const checklistTasksSorted = [...podcastChecklist.tasks].sort((a, b) => {
|
||||
const aIndex = checklistTaskOrderIndex.get(a.id)
|
||||
const bIndex = checklistTaskOrderIndex.get(b.id)
|
||||
const aKnown = typeof aIndex === 'number'
|
||||
const bKnown = typeof bIndex === 'number'
|
||||
|
||||
if (aKnown && bKnown) return aIndex - bIndex
|
||||
if (aKnown && !bKnown) return -1
|
||||
if (!aKnown && bKnown) return 1
|
||||
return a.label.localeCompare(b.label, undefined, { sensitivity: 'base' })
|
||||
})
|
||||
const checklistPreTasks = checklistTasksSorted.filter(task => task.phase === 'pre')
|
||||
const checklistPostTasks = checklistTasksSorted.filter(task => task.phase === 'post')
|
||||
const checklistEpisodesSorted = [...podcastChecklist.episodes].sort((a, b) => {
|
||||
@@ -2739,6 +2761,7 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
||||
{checklistEpisodesSorted.map(episode => {
|
||||
const doneCount = checklistTasksSorted.reduce((count, task) => count + (episode.tasks[task.id] ? 1 : 0), 0)
|
||||
const totalCount = checklistTasksSorted.length
|
||||
const nextTask = checklistTasksSorted.find(task => !episode.tasks[task.id])
|
||||
const episodeLabelParts = [episode.series?.trim()]
|
||||
if (episode.episodeNumber !== null) {
|
||||
episodeLabelParts.push(String(episode.episodeNumber))
|
||||
@@ -2753,7 +2776,11 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
||||
<summary className="admin-collapsible-summary">
|
||||
<div>
|
||||
<strong>{episodeLabel}</strong>
|
||||
<p>{totalCount > 0 ? `${doneCount}/${totalCount} tasks completed` : 'No tasks assigned yet'}</p>
|
||||
<p>
|
||||
{totalCount > 0
|
||||
? `${doneCount}/${totalCount} tasks completed • Next: ${nextTask?.label ?? 'All done'}`
|
||||
: 'No tasks assigned yet'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="admin-collapsible-hint">Expand to edit</span>
|
||||
</summary>
|
||||
|
||||
Reference in New Issue
Block a user