Skip to content

Commit

Permalink
changed the way and places where study material access is displayed (#…
Browse files Browse the repository at this point in the history
…2839)

* changed the way and places where study material access is displayed

* removed comments
  • Loading branch information
markgol777 authored and Made1ra committed Nov 26, 2024
1 parent 7422ce0 commit 2e12072
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
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
)

return (
<Box>
<Divider />
Expand All @@ -44,17 +32,6 @@ const CooperationCompletion = () => {
{t('cooperationsPage.cooperationDetails.closeCooperationBtn')}
</AppButton>
</SettingItem>
<SettingItem
subtitle={t('cooperationsPage.cooperationDetails.accessDescription')}
title={t('cooperationsPage.cooperationDetails.accessTitle')}
>
<AppSelect
fields={cooperationAccessValues(t)}
setValue={setMaterialsAccess}
sx={styles.dropdown}
value={materialsAccess}
/>
</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 />

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

0 comments on commit 2e12072

Please sign in to comment.