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

학습자료가 존재하지 않을 시 알림 메시지 추가 #318

Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 23 additions & 18 deletions src/app/team/[teamId]/study/[studyId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { Flex, Grid, IconButton, Text, Link } from '@chakra-ui/react';
import { Flex, Grid, IconButton, Text, Link, Card } from '@chakra-ui/react';
import NextLink from 'next/link';
import { useEffect, useState } from 'react';
import { MdOutlineArrowForwardIos } from 'react-icons/md';
Expand All @@ -10,7 +10,6 @@ import { getStudy } from '@/app/api/study';
import DocumentCard from '@/components/DocumentCard';
import Title from '@/components/Title';
import CurriculumCard from '@/containers/study/CurriculumCard';
// import Feed from '@/containers/study/Feed';
import DeleteStudyModal from '@/containers/study/Modal/DeleteStudyModal';
import StudyModal from '@/containers/study/Modal/StudyModal';
import TerminateStudyModal from '@/containers/study/Modal/TerminateStudyModal';
Expand Down Expand Up @@ -65,7 +64,7 @@ const Page = ({ params }: { params: { teamId: number; studyId: number } }) => {
<CurriculumCard cropId={studyData.cropId} studyProgressRatio={studyData.studyProgressRatio} />
)}

<Flex align="right" direction="column" rowGap="3">
<Flex align="right" direction="column" rowGap="3" w="100%" h={{ base: '25vh', lg: '30vh', '2xl': '35vh' }}>
<Link
as={NextLink}
gap="3"
Expand All @@ -84,21 +83,27 @@ const Page = ({ params }: { params: { teamId: number; studyId: number } }) => {
/>
<Text>전체 보기</Text>
</Link>
<Grid gap="2" templateColumns={{ base: 'repeat(2, 1fr)', lg: 'repeat(4, 1fr)' }}>
{documentArray.map((data) => (
<DocumentCard
id={data.id}
key={data.title}
title={data.title}
description={data.description}
date={data.date}
uploaderName={data.uploaderName}
setReload={() => {}}
files={data.files}
type={data.type}
/>
))}
</Grid>
{documentArray && documentArray.length > 0 ? (
<Grid gap="2" templateColumns={{ base: 'repeat(2, 1fr)', lg: 'repeat(4, 1fr)' }}>
{documentArray.map((data) => (
<DocumentCard
id={data.id}
key={data.title}
title={data.title}
description={data.description}
date={data.date}
uploaderName={data.uploaderName}
setReload={() => {}}
files={data.files}
type={data.type}
/>
))}
</Grid>
) : (
<Card alignItems="center" justifyContent="center" w="100%" h="100%" borderRadius={{ base: '2xl' }}>
<Text textStyle="lg">학습 자료가 존재하지 않습니다.</Text>
</Card>
)}
</Flex>
</Flex>
<Flex direction="column" rowGap={{ base: '6', '2xl': '12' }}>
Expand Down
52 changes: 30 additions & 22 deletions src/containers/document/Documents/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { Flex, Grid, useBreakpointValue } from '@chakra-ui/react';
import { Flex, Grid, useBreakpointValue, Card, Text } from '@chakra-ui/react';
import { useEffect, useState } from 'react';

import { getDocumentList } from '@/app/api/document';
Expand Down Expand Up @@ -31,28 +31,36 @@ const Documents = ({ groupId, category }: DocumentPageProps) => {
}, [documentLength, category, groupId, reload]);

return (
<Flex direction="column">
<Grid gap={{ sm: '2', md: '4', xl: '8' }} templateColumns={`repeat(${itemsPerPage / 2}, 1fr)`} w="100%">
{currentData.map((data) => (
<DocumentCard
id={data.id}
key={data.id}
title={data.title}
description={data.description}
date={data.date}
uploaderName={data.uploaderName}
setReload={setReload}
files={data.files}
type={data.type}
<Flex direction="column" w="100%" h="100%">
{documentArray && documentArray.length > 0 ? (
<>
<Grid gap={{ sm: '2', md: '4', xl: '8' }} templateColumns={`repeat(${itemsPerPage / 2}, 1fr)`} w="100%">
{currentData.map((data) => (
<DocumentCard
id={data.id}
key={data.id}
title={data.title}
description={data.description}
date={data.date}
uploaderName={data.uploaderName}
setReload={setReload}
files={data.files}
type={data.type}
/>
))}
</Grid>
<PageNavigator
currentPage={currentPage}
setCurrentPage={setCurrentPage}
componentLength={documentLength}
itemsPerPage={itemsPerPage}
/>
))}
</Grid>
<PageNavigator
currentPage={currentPage}
setCurrentPage={setCurrentPage}
componentLength={documentLength}
itemsPerPage={itemsPerPage}
/>
</>
) : (
<Card alignItems="center" justifyContent="center" w="100%" h="50%" borderRadius={{ base: '2xl' }}>
<Text textStyle="lg">학습 자료가 존재하지 않습니다.</Text>
</Card>
)}
</Flex>
);
};
Expand Down