fix typo
polling interval from config qrcode as link courses list page journal.pl as name fix package-lock lesson missed students merge students list reset version 1.0.0 styled page of visits rename students fake students, delete comments Обновил Readme Squashed commit of the following: commit ebc511e36b84c077f7bc029540ead1e3c58c49ab Author: Alexei <adu864222@gmail.com> Date: Tue Mar 19 00:23:30 2024 +1000 fake students, delete comments commit 018582d16c581663103e5fded99cc10fca400532 Author: Alexei <adu864222@gmail.com> Date: Mon Mar 18 23:13:01 2024 +1000 rename students commit e53922d7fd89cf371c90e167c6486b36b0789036 Author: Alexei <adu864222@gmail.com> Date: Sun Mar 17 00:45:11 2024 +1000 styled page of visits Обновил Readme Squashed commit of the following: commit ebc511e36b84c077f7bc029540ead1e3c58c49ab Author: Alexei <adu864222@gmail.com> Date: Tue Mar 19 00:23:30 2024 +1000 fake students, delete comments commit 018582d16c581663103e5fded99cc10fca400532 Author: Alexei <adu864222@gmail.com> Date: Mon Mar 18 23:13:01 2024 +1000 rename students commit e53922d7fd89cf371c90e167c6486b36b0789036 Author: Alexei <adu864222@gmail.com> Date: Sun Mar 17 00:45:11 2024 +1000 styled page of visits JRL-51 breadcrumbs + fonts 1.1.0 1.2.0 correct width h1 on page of visits students styled card of course
This commit is contained in:
58
src/pages/user-page.tsx
Normal file
58
src/pages/user-page.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import React from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
ErrorSpan,
|
||||
LessonItem,
|
||||
Lessonname,
|
||||
MainWrapper,
|
||||
StartWrapper,
|
||||
} from './style'
|
||||
import { api } from '../__data__/api/api'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const UserPage = () => {
|
||||
const { lessonId, accessId } = useParams()
|
||||
const acc = api.useGetAccessQuery({ accessCode: accessId })
|
||||
|
||||
const ls = api.useLessonByIdQuery(lessonId, {
|
||||
pollingInterval: 1000,
|
||||
skipPollingIfUnfocused: true,
|
||||
})
|
||||
|
||||
return (
|
||||
<MainWrapper>
|
||||
<StartWrapper>
|
||||
{acc.isLoading && <h1>Отправляем запрос</h1>}
|
||||
{acc.isSuccess && <h1>Успешно</h1>}
|
||||
|
||||
{acc.error && (
|
||||
<div style={{ padding: 12, marginTop: 24, fontSize: 36 }}>
|
||||
<ErrorSpan>
|
||||
{(acc as any).error?.data?.body?.errorMessage ===
|
||||
'Code is expired' ? (
|
||||
'Не удалось активировать код доступа. Попробуйте отсканировать код ещё раз'
|
||||
) : (
|
||||
<pre>{JSON.stringify(acc.error, null, 4)}</pre>
|
||||
)}
|
||||
</ErrorSpan>
|
||||
</div>
|
||||
)}
|
||||
<h1>Тема занятия - {ls.data?.body?.name}</h1>
|
||||
<span>{dayjs(ls.data?.body?.date).format('DD MMMM YYYYг.')}</span>
|
||||
|
||||
<ul style={{ paddingLeft: 0 }}>
|
||||
{ls.data?.body?.students?.map((student, index) => (
|
||||
<LessonItem key={index}>
|
||||
<Lessonname>
|
||||
{student.name || student.preferred_username}
|
||||
</Lessonname>
|
||||
</LessonItem>
|
||||
))}
|
||||
</ul>
|
||||
</StartWrapper>
|
||||
</MainWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
export default UserPage
|
||||
Reference in New Issue
Block a user