Skip to content

Commit 61fc08d

Browse files
committed
i just need to resolve conflicts and fix some tests
1 parent 047b85e commit 61fc08d

File tree

21 files changed

+1329
-1229
lines changed

21 files changed

+1329
-1229
lines changed

src/components/active-students/ActiveStudentsBlock.tsx

Lines changed: 84 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -15,89 +15,100 @@ import { defaultResponses } from '~/constants'
1515
import { authRoutes } from '~/router/constants/authRoutes'
1616

1717
const ActiveStudentsBlock = () => {
18-
const { t } = useTranslation()
19-
const navigate = useNavigate()
20-
const { findOffers, cooperationDetails } = authRoutes
18+
const { t } = useTranslation()
19+
const navigate = useNavigate()
20+
const { findOffers, cooperationDetails } = authRoutes
2121

22-
const getMyCooperations = useCallback(
23-
() => cooperationService.getCooperations({ limit: 3, status: 'active' }),
24-
[]
25-
)
26-
27-
const { isLoading, data, error } = useQuery({
28-
queryKey: ['cooperations'],
29-
queryFn: getMyCooperations,
30-
options: {
31-
initialData: defaultResponses.itemsWithCount
32-
}
33-
})
22+
const getMyCooperations = useCallback(
23+
() => cooperationService.getCooperations({ limit: 3, status: 'active' }),
24+
[]
25+
)
3426

35-
if (isLoading) {
36-
return <Loader pageLoad size={50} />
27+
const { isLoading, data, error } = useQuery({
28+
queryKey: ['cooperations'],
29+
queryFn: getMyCooperations,
30+
options: {
31+
initialData: defaultResponses.itemsWithCount
3732
}
33+
})
3834

39-
if (error) {
40-
return null
41-
}
35+
const activeStudents = data?.items.map((cooperation) => (
36+
<ActiveStudent
37+
cooperationId={cooperation._id}
38+
firstName={cooperation.user.firstName}
39+
key={cooperation._id}
40+
lastName={cooperation.user.lastName}
41+
photo={cooperation.user.photo}
42+
subjectName={cooperation.subject.name}
43+
/>
44+
))
4245

43-
const onShowMoreClick = () => {
44-
navigate(cooperationDetails.path)
45-
}
46+
if (isLoading) {
47+
return <Loader pageLoad size={50} />
48+
}
4649

47-
const onAddStudentClick = () => {
48-
navigate(findOffers.path)
49-
}
50+
if (error) {
51+
return null
52+
}
53+
54+
const onShowMoreClick = () => {
55+
navigate(cooperationDetails.path)
56+
}
5057

51-
if (!data.items.length)
52-
return (
53-
<>
54-
<Typography sx={styles.title}>{t('activeStudents.title')}</Typography>
55-
<Box sx={styles.noStudentsWrapper}>
56-
<Typography sx={styles.title}>
57-
{t('activeStudents.noStudentsYet')}
58-
</Typography>
59-
<Box
60-
data-testid='addStudent'
61-
onClick={onAddStudentClick}
62-
sx={styles.showMoreWrapper}
63-
>
64-
<AppIconButton isToggled size='lg' toggleAble>
65-
<Add />
66-
</AppIconButton>
67-
<Typography>{t('activeStudents.addStudent')}</Typography>
68-
</Box>
69-
</Box>
70-
</>
71-
)
58+
const onAddStudentClick = () => {
59+
navigate(findOffers.path)
60+
}
7261

73-
const activeStudents = data.items.map((cooperation) => (
74-
<ActiveStudent
75-
cooperationId={cooperation._id}
76-
firstName={cooperation.user.firstName}
77-
key={cooperation._id}
78-
lastName={cooperation.user.lastName}
79-
photo={cooperation.user.photo}
80-
subjectName={cooperation.offer.subject.name}
81-
/>
82-
))
62+
if (!data.items.length)
8363
return (
84-
<>
85-
<Typography sx={styles.title}>{t('activeStudents.title')}</Typography>
86-
<Box sx={styles.activeStudentsWrapper}>
87-
{activeStudents}
88-
<Box
89-
data-testid='showMore'
90-
onClick={onShowMoreClick}
91-
sx={styles.showMoreWrapper}
92-
>
93-
<AppIconButton isToggled size='lg' toggleAble>
94-
<MoreHoriz />
95-
</AppIconButton>
96-
<Typography>{t('activeStudents.showMore')}</Typography>
97-
</Box>
98-
</Box>
99-
</>
64+
<>
65+
<Typography sx={styles.title}>{t('activeStudents.title')}</Typography>
66+
<Box sx={styles.noStudentsWrapper}>
67+
<Typography sx={styles.title}>
68+
{t('activeStudents.noStudentsYet')}
69+
</Typography>
70+
<Box
71+
data-testid='addStudent'
72+
onClick={onAddStudentClick}
73+
sx={styles.showMoreWrapper}
74+
>
75+
<AppIconButton isToggled size='lg' toggleAble>
76+
<Add />
77+
</AppIconButton>
78+
<Typography>{t('activeStudents.addStudent')}</Typography>
79+
</Box>
80+
</Box>
81+
</>
10082
)
83+
84+
// const activeStudents = data.items.map((cooperation) => (
85+
// <ActiveStudent
86+
// cooperationId={cooperation._id}
87+
// firstName={cooperation.user.firstName}
88+
// key={cooperation._id}
89+
// lastName={cooperation.user.lastName}
90+
// photo={cooperation.user.photo}
91+
// subjectName={cooperation.offer.subject.name}
92+
// />
93+
// ))
94+
return (
95+
<>
96+
<Typography sx={styles.title}>{t('activeStudents.title')}</Typography>
97+
<Box sx={styles.activeStudentsWrapper}>
98+
{activeStudents}
99+
<Box
100+
data-testid='showMore'
101+
onClick={onShowMoreClick}
102+
sx={styles.showMoreWrapper}
103+
>
104+
<AppIconButton isToggled size='lg' toggleAble>
105+
<MoreHoriz />
106+
</AppIconButton>
107+
<Typography>{t('activeStudents.showMore')}</Typography>
108+
</Box>
109+
</Box>
110+
</>
111+
)
101112
}
102113

103114
export default ActiveStudentsBlock

src/constants/translations/en/offer-details-page.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"description": "Send a Request to Create a Cooperation",
55
"inputs": {
66
"level": "Choose the appropriate level of tutoring you require.",
7-
"info": "Ask the questions you have, describe your learning needs or specify your preferred teaching approach."
7+
"additionalInfo": "Ask the questions you have, describe your learning needs or specify your preferred teaching approach."
88
},
99
"labels": {
1010
"level": "Your required level",
1111
"preferredPrice": "Set your preferred price for the lesson. Keep in mind that choosing a lower or higher price may affect tutor availability.",
12-
"info": "Additional information"
12+
"additionalInfo": "Additional information"
1313
},
1414
"successMessage": "Request for cooperation sent successfully"
1515
},
@@ -18,7 +18,6 @@
1818
"student": "Offer details",
1919
"tutor": "Offer details"
2020
},
21-
2221
"description": {
2322
"student": "Here, you can access all the essential details about the offer you've selected. This page includes details about the chosen offer. Take a moment to review this information and make an informed decision about your tutoring needs.",
2423
"tutor": "Here, you can access all the essential details about the offer you've selected. This page includes details about the chosen offer. Take a moment to review this information and make an informed decision about your tutoring needs."

src/constants/translations/uk/offer-details-page.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"description": "Надіслати запит на створення співпраці",
55
"inputs": {
66
"level": "Виберіть відповідний рівень, який вам потрібен.",
7-
"info": "Задайте свої запитання, опишіть свої потреби, або вкажіть бажаний підхід до викладання."
7+
"additionalInfo": "Задайте свої запитання, опишіть свої потреби, або вкажіть бажаний підхід до викладання."
88
},
99
"labels": {
1010
"level": "Ваш рівень",
1111
"preferredPrice": "Встановіть бажану ціну за урок. Майте на увазі, що вибір нижчої або вищої ціни може вплинути на доступність репетитора.",
12-
"info": "Додаткова інформація"
12+
"additionalInfo": "Додаткова інформація"
1313
},
1414
"successMessage": "Запит на співпрацю надіслано успішно"
1515
},
@@ -18,7 +18,6 @@
1818
"student": "Деталі пропозиції",
1919
"tutor": "Деталі пропозиції"
2020
},
21-
2221
"description": {
2322
"student": "Тут ви можете отримати доступ до всіх важливих деталей про вибрану пропозицію. На цій сторінці міститься інформація про вибрану пропозицію. Знайдіть час, щоб переглянути цю інформацію та прийняти обґрунтоване рішення щодо ваших потреб у репетиторстві.",
2423
"tutor": "Тут ви можете отримати доступ до всіх важливих деталей про вибрану пропозицію. На цій сторінці міститься інформація про вибрану пропозицію. Знайдіть час, щоб переглянути цю інформацію та прийняти обґрунтоване рішення щодо ваших потреб у репетиторстві."

0 commit comments

Comments
 (0)