Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed the way and places where study material access is displayed #2839

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ShadowOfTheSpace marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import Divider from '@mui/material/Divider'

import SettingItem from '~/components/setting-item/SettingItem'
import AppButton from '~/components/app-button/AppButton'
import AppSelect from '~/components/app-select/AppSelect'

import { cooperationAccessValues } from '~/containers/my-cooperations/cooperation-completion/CooperationCompletion.constants'
import { styles } from '~/containers/my-cooperations/cooperation-completion/CooperationCompletion.styles'
import {
ButtonVariantEnum,
SizeEnum,
CooperationMaterialsAccessEnum
} from '~/types'
import { ButtonVariantEnum, SizeEnum } from '~/types'

const CooperationCompletion = () => {
const { t } = useTranslation()

const [materialsAccess, setMaterialsAccess] =
useState<CooperationMaterialsAccessEnum>(
CooperationMaterialsAccessEnum.OneMonthAccess
)
// const [materialsAccess, setMaterialsAccess] =
// useState<CooperationMaterialsAccessEnum>(
// CooperationMaterialsAccessEnum.OneMonthAccess
// )

return (
<Box>
Expand All @@ -44,7 +37,7 @@ const CooperationCompletion = () => {
{t('cooperationsPage.cooperationDetails.closeCooperationBtn')}
</AppButton>
</SettingItem>
<SettingItem
{/* <SettingItem
subtitle={t('cooperationsPage.cooperationDetails.accessDescription')}
title={t('cooperationsPage.cooperationDetails.accessTitle')}
>
Expand All @@ -54,7 +47,7 @@ const CooperationCompletion = () => {
sx={styles.dropdown}
value={materialsAccess}
/>
</SettingItem>
</SettingItem> */}
</Box>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useState } from 'react'

import SettingItem from '~/components/setting-item/SettingItem'
import AppSelect from '~/components/app-select/AppSelect'
import { useTranslation } from 'react-i18next'
import { styles } from '~/containers/my-cooperations/cooperation-completion/CooperationCompletion.styles'

import { cooperationAccessValues } from '~/containers/my-cooperations/cooperation-completion/CooperationCompletion.constants'
import { CooperationMaterialsAccessEnum } from '~/types'

const StudyMaterials = () => {
const { t } = useTranslation()

const [materialsAccess, setMaterialsAccess] =
useState<CooperationMaterialsAccessEnum>(
CooperationMaterialsAccessEnum.OneMonthAccess
)

return (
<SettingItem
subtitle={t('cooperationsPage.cooperationDetails.accessDescription')}
title={t('cooperationsPage.cooperationDetails.accessTitle')}
>
<AppSelect
fields={cooperationAccessValues(t)}
setValue={setMaterialsAccess}
sx={styles.dropdown}
value={materialsAccess}
/>
</SettingItem>
)
}

export default StudyMaterials
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import DoneIcon from '@mui/icons-material/Done'
import TitleWithDescription from '~/components/title-with-description/TitleWithDescription'
import IconTitleDescription from '~/components/icon-title-description/IconTitleDescription'
import AppCard from '~/components/app-card/AppCard'
import StudyMaterials from '~/containers/my-cooperations/cooperation-completion/StudyMaterials'

import { styles } from '~/containers/offer-details/offer-general-info/OfferGeneralInfo.styles'
import { Offer, SizeEnum } from '~/types'
Expand Down Expand Up @@ -74,7 +75,10 @@ const OfferGeneralInfo: FC<OfferGeneralInfo> = ({ offer }) => {
{t('offerDetailsPage.generalInfo.title')}
</Typography>

<Box sx={styles.cardsContainer}>{generalInfoCards}</Box>
<Box sx={styles.cardsContainer}>
{generalInfoCards}
<StudyMaterials />
</Box>
</Box>
)
}
Expand Down
7 changes: 6 additions & 1 deletion src/containers/offer-page/teaching-block/TeachingBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import AppTextField from '~/components/app-text-field/AppTextField'
import AppChipList from '~/components/app-chips-list/AppChipList'
import AppTextArea from '~/components/app-text-area/AppTextArea'
import OrderedListItem from '~/components/ordered-list-item/OrderedListItem'
import StudyMaterials from '~/containers/my-cooperations/cooperation-completion/StudyMaterials'

import {
CreateOfferBlockProps,
LanguagesEnum,
CreateOrUpdateOfferData
CreateOrUpdateOfferData,
UserRoleEnum
} from '~/types'
import { styles } from '~/containers/offer-page/OfferPage.styles'

Expand Down Expand Up @@ -51,6 +53,8 @@ const TeachingBlock = <T extends CreateOrUpdateOfferData>({
}
}

const studyMaterials = userRole === UserRoleEnum.Student && <StudyMaterials />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it is better not to create a variable but just move userRole === UserRoleEnum.Student && <StudyMaterials /> to 140 line and put it in brackets instead of studyMaterials. It is not necessary, it's up to you


return (
<OrderedListItem
number={2}
Expand Down Expand Up @@ -133,6 +137,7 @@ const TeachingBlock = <T extends CreateOrUpdateOfferData>({
required
value={data.price}
/>
{studyMaterials}
</Box>
</Box>
</OrderedListItem>
Expand Down
Loading