Skip to content

Commit

Permalink
Merge pull request #1131 from ita-social-projects/feature/1097/change…
Browse files Browse the repository at this point in the history
…-real-attachments-instead-of-mock-data

Replaced mock data to real attachments in lesson details
  • Loading branch information
TetianaDeresh authored Sep 20, 2023
2 parents afb891f + f3ed341 commit 0d675f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
33 changes: 0 additions & 33 deletions src/pages/lesson-details/LessonDetails.constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,3 @@ export const defaultResponse = {
updatedAt: '',
_id: ''
}

export const attachmentsMock = [
{
_id: '64e8940b7a9b6f9db48352ed',
author: '6477007a6fa4d05e1a800ce5',
fileName: 'file1.png',
link: '1692963850652-file1.png',
size: 763775,
createdAt: '2023-08-25T11:44:11.171Z',
updatedAt: '2023-08-25T11:44:11.171Z'
},
{
_id: '64e890625757da9cc83a13fc',
author: '6477007a6fa4d05e1a800ce5',
fileName: 'file2.png',
link: '1692962913878-file2.png',
size: 763774,
createdAt: '2023-08-25T11:28:34.397Z',
updatedAt: '2023-08-25T11:28:34.397Z'
},
{
_id: '64dcbb2ce04abdca4434c813',
author: '6477007a6fa4d05e1a800ce5',
fileName: 'file3.jpeg',
link: '1692187436676-file3.jpeg',
size: 104764,
createdAt: '2023-08-16T12:03:56.773Z',
updatedAt: '2023-08-16T12:03:56.773Z'
}
]

export const contentMock =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quis lobortis nisl cursus bibendum sit nulla accumsan sodales ornare. At urna viverra non suspendisse neque, lorem. Pretium condimentum pellentesque gravida id etiam sit sed arcu euismod. Rhoncus proin orci duis scelerisque molestie cursus tincidunt aliquam.'
7 changes: 2 additions & 5 deletions src/pages/lesson-details/LessonDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import TitleWithDescription from '~/components/title-with-description/TitleWithD
import PageWrapper from '~/components/page-wrapper/PageWrapper'
import useAxios from '~/hooks/use-axios'
import { ResourceService } from '~/services/resource-service'
import {
attachmentsMock,
defaultResponse
} from '~/pages/lesson-details/LessonDetails.constants'
import { defaultResponse } from '~/pages/lesson-details/LessonDetails.constants'
import Accordions from '~/components/accordion/Accordions'
import IconExtensionWithTitle from '~/components/icon-extension-with-title/IconExtensionWithTitle'
import AppButton from '~/components/app-button/AppButton'
Expand Down Expand Up @@ -67,7 +64,7 @@ const LessonDetails = () => {
navigate(createUrlPath(authRoutes.myResources.editLesson.path, id))
}

const attachmentsList = attachmentsMock.map((attachment) => (
const attachmentsList = response.attachments.map((attachment) => (
<Box key={attachment.size} sx={styles.attachment}>
<IconExtensionWithTitle
size={attachment.size}
Expand Down
4 changes: 2 additions & 2 deletions src/types/my-resources/interfaces/myResources.interface.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CommonEntityFields, RequestParams } from '~/types'
import { Attachment, CommonEntityFields, RequestParams } from '~/types'

export interface Lesson extends CommonEntityFields {
title: string
author: string
content: string
description: string
attachments: string[]
attachments: Attachment[]
}

export interface GetResourcesParams extends Partial<RequestParams> {
Expand Down

0 comments on commit 0d675f8

Please sign in to comment.