Skip to content

Commit

Permalink
implemented comments suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nebby2105 committed Nov 30, 2024
1 parent c4d9cc9 commit 8e84a2a
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 41 deletions.
6 changes: 5 additions & 1 deletion src/constants/translations/en/cooperation-details.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"yourProgress": "Your progress",
"completed": "completed",
"needToComplete": "to complete"
}
},
"closingMessage1": " started a closing process for the current cooperation. You will have ",
"accessDuration": "1 month of access",
"closingMessage2": " to study materials after the cooperation has been closed.",
"acceptBtn": "Accept"
}
3 changes: 2 additions & 1 deletion src/constants/translations/en/titles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"confirmTitle": "Please Confirm",
"discardOffer": "Discard offer changes?",
"discardChanges": "Discard recent changes?",
"confirmCooperationClosing": "Confirmation of cooperation closing"
"confirmCooperationClosing": "Confirmation of cooperation closing",
"acceptCooperationClosing": "Cooperation closing process"
}
6 changes: 5 additions & 1 deletion src/constants/translations/uk/cooperation-details.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"yourProgress": "Ваш прогрес",
"completed": "виконано",
"needToComplete": "до завершення"
}
},
"closingMessage1": " ініціював(-ла) процес припинення співпраці. У вас залишиться доступ до матеріалів поточної співпраці протягом ",
"accessDuration": "1 місяця",
"closingMessage2": " з моменту закриття.",
"acceptBtn": "Прийняти"
}
2 changes: 1 addition & 1 deletion src/constants/translations/uk/cooperations-page.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@
"confirmDeletionTitle": "Ви підтверджуєте видалення нотатки?"
},
"closeCooperationModal": {
"message": "Ви впевнені, що хочете завершити кооперацію?"
"message": "Ви впевнені, що хочете завершити співпрацю?"
}
}
3 changes: 2 additions & 1 deletion src/constants/translations/uk/titles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"confirmTitle": "Підтвердіть вихід",
"discardOffer": "Відхилити зміни пропозиції?",
"discardChanges": "Зберегти останні зміни?",
"confirmCooperationClosing": "Підтвердження закриття кооперації"
"confirmCooperationClosing": "Підтвердження припинення cпівпраці",
"acceptCooperationClosing": "Процес припинення співпраці"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import palette from '~/styles/app-theme/app.pallete'
export const styles = {
root: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
border: `1px solid ${palette.basic.pinkishRed}`,
backgroundColor: palette.basic.softGray,
borderRadius: '5px',
padding: '24px',
justifyContent: 'space-between',
gap: '16px'
},
span: {
Expand All @@ -18,15 +18,10 @@ export const styles = {
color: palette.basic.mediumRed,
fontWeight: '500',
display: 'flex',
flexDirection: 'row',
gap: '8px',
mb: '4px'
},
body: {
color: palette.basic.darkGray
},
button: {
color: `${palette.basic.deepRed} !important`,
backgroundColor: `${palette.basic.lightRed} !important`
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
import { Box, Typography } from '@mui/material'
import { Box, styled, Typography } from '@mui/material'
import { FC } from 'react'
import AppButton from '~/components/app-button/AppButton'

import { styles } from './AcceptCooperationClosing.styles'
import { ErrorOutlineRounded } from '@mui/icons-material'
import { SizeEnum } from '~/types'
import Button from '~/design-system/components/button/Button'
import { useTranslation } from 'react-i18next'

interface AcceptCooperationClosureProps {
user: string
onAccept: () => void
}

const BoldText = styled('span')({
fontWeight: 500
})

const AcceptCooperationClosing: FC<AcceptCooperationClosureProps> = ({
user,
onAccept
}) => {
const { t } = useTranslation()
return (
<Box sx={styles.root}>
<Box>
<Box sx={styles.title}>
<ErrorOutlineRounded />
<Typography>Cooperation closing process</Typography>
<Typography>{t('titles.acceptCooperationClosing')}</Typography>
</Box>
<Typography sx={styles.body}>
<span style={styles.span}>{user}</span> started a closing process for
the current cooperation. You will have{' '}
<span style={styles.span}> 1 month of access</span> to study materials
after the cooperation has been closed.
<BoldText>{user}</BoldText>
{t('cooperationDetailsPage.closingMessage1')}
<BoldText>{t('cooperationDetailsPage.accessDuration')}</BoldText>
{t('cooperationDetailsPage.closingMessage2')}
</Typography>
</Box>
<AppButton
color='error'
onClick={onAccept}
size={SizeEnum.Small}
sx={styles.button}
>
Accept
</AppButton>
<Button color='tonal-error' onClick={onAccept} size='xs'>
{t('cooperationDetailsPage.acceptBtn')}
</Button>
</Box>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,5 @@ export const styles = {
dropdown: {
maxWidth: '216px',
ml: '15px'
},
closeCooperationModal: {
text: {
padding: '30px'
},
button: {
display: 'flex',
justifyContent: 'center'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
setCooperationStatus,
setIsActivityCreated
} from '~/redux/features/cooperationsSlice'
import AcceptCooperationClosing from '../accept-cooperation-close/AcceptCooperationClosing'
import AcceptCooperationClosing from '~/containers/my-cooperations/accept-cooperation-close/AcceptCooperationClosing'

const CooperationDetails = () => {
const dispatch = useAppDispatch()
Expand Down Expand Up @@ -139,7 +139,7 @@ const CooperationDetails = () => {
return cooperationContent
}

const handleCooperationStatusUpdate = async () => {
const isCooperationStatusUpdated = async () => {
await cooperationService.updateCooperation({
_id: id,
status: StatusEnum.Closed
Expand All @@ -149,7 +149,7 @@ const CooperationDetails = () => {
}

const handleCooperationCloseAccept = () => {
void handleCooperationStatusUpdate()
void isCooperationStatusUpdated()
}

const cooperationCompletionConditions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const MyCooperationsDetails = () => {

const handleCooperationStatusUpdate = async () => {
const confirmed = await checkConfirmation({
title: 'titles.confirmCooperationClosing',
title: t('titles.confirmCooperationClosing'),
message: t('cooperationsPage.closeCooperationModal.message'),
check: true
})
Expand Down

0 comments on commit 8e84a2a

Please sign in to comment.