{overviewState.kind === 'ready' ? (
) : (
{overviewState.kind === 'error' ? (
) : (
)}
)}
{scheduleStatus(scheduleState)}
{scheduleState.kind === 'ready' ? (
) : (
)}
void refreshRequests()}
stateKind={requestsState.kind}
/>
{dialogLesson && (
setDialogLesson(null)}
onSubmitted={handleSubmitRequest}
/>
)}
);
}
function scheduleStatus(scheduleState) {
if (scheduleState.kind === 'error') {
return scheduleState.message || 'Не удалось загрузить расписание';
}
if (scheduleState.kind === 'ready') {
const count = scheduleState.lessons.length;
return count > 0 ? `Найдено занятий: ${count}` : 'На этой неделе занятий нет';
}
return 'Загрузка расписания...';
}