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

Feat: 자료집 UI 구현 #379

Merged
merged 21 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
64e549b
delete: 기존 자료집 관련 코드 삭제 (#374)
h-ye-ryoung Jan 19, 2025
be50fa1
chore: 임시 자료집 제거 후 자료집 경로 연결 (#374)
h-ye-ryoung Jan 19, 2025
7e4c6fc
chore: 임시
h-ye-ryoung Jan 19, 2025
56ac8b4
Merge branch 'feat/#374_data_ui' of https://github.com/ssu-student-un…
jongse7 Jan 21, 2025
10c51d6
feat: 자료집 홈 ui (#374)
jongse7 Jan 21, 2025
70f9d5c
feat: 자료집 상세 페이지 ui (#374)
jongse7 Jan 21, 2025
1b1d262
Merge branch 'feat/#374_data_ui' of https://github.com/ssu-student-un…
jongse7 Jan 23, 2025
5aff7ab
refactor: Input 컴포넌트 className 위치 변경 (#374)
jongse7 Jan 23, 2025
92575bb
feat: FileInput을 제외한 data/edit 페이지 작업
jongse7 Jan 23, 2025
87ca081
feat: 자료집 edit 페이지 ui (#374)
jongse7 Jan 24, 2025
40a8d83
chore: merge develop
jongse7 Feb 5, 2025
7f800f7
chore: merge develop
jongse7 Feb 5, 2025
d62ec1c
chore: 자료집 ui 구현 복구 및 develop 최신 사항 반영
jongse7 Feb 5, 2025
8a9edc1
Merge branch 'develop' into feat/#374_data_ui
jongse7 Feb 5, 2025
90ff36c
chore: fix prettier formatting issues
jongse7 Feb 5, 2025
ba4bc06
fix: lint error fix
jongse7 Feb 5, 2025
2077c7b
fix: lint error fix 2
jongse7 Feb 5, 2025
6bf49c9
style: main 공지사항 스크롤 바 위 여백 추가
jongse7 Feb 5, 2025
3c0e93f
fix: 공지사항 게시글 작성 시 캐시 초기화
jongse7 Feb 5, 2025
97daf0c
fix: lint warning fix
jongse7 Feb 5, 2025
6659fe9
fix: yarn run build error
jongse7 Feb 5, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
username: ubuntu
host: ${{ secrets.SSH_HOST }}
key: ${{ secrets.SSH_KEY }}
source: "dist.tar"
target: "/home/ubuntu/"
source: 'dist.tar'
target: '/home/ubuntu/'
- name: Extract artifact with SSH
uses: appleboy/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
username: ubuntu
host: ${{ secrets.SSH_HOST }}
key: ${{ secrets.SSH_KEY }}
source: "dist.tar"
target: "/home/ubuntu/"
source: 'dist.tar'
target: '/home/ubuntu/'
- name: Extract artifact with SSH
uses: appleboy/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"trailingComma": "es5",
"printWidth": 120,
"plugins": ["prettier-plugin-tailwindcss"]
}
}
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/libs/utils"
}
}
}
Binary file added public/image/default/thumbnail/thumbnail.webp
Binary file not shown.
116 changes: 58 additions & 58 deletions src/apis/getBoardDataPosts.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 코드는 전체 주석처리해도 문제 없나요??

Copy link
Contributor

Choose a reason for hiding this comment

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

이 파일 제외하고도 사용하지 않는 api 훅들이 많아 보이는데 다 삭제하죠.

  • getBoardDataPosts.ts
  • getBoardDataPostSearch.ts
  • getOnboardingEmail.ts
  • patchBoardDataPosts.ts
  • postBoardBoardCodeFiles.ts
  • postBoardDataFiles.ts
  • postBoardDataSubCategoryPost.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

자료집 API인데, Lint 오류 때문에 주석 처리했어요. 제가 다시 구현해야 해서 일단 급하게 땜질했습니다

Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
import { clientAuth } from './client';
import { AxiosResponse } from 'axios';
// import { clientAuth } from './client';
// import { AxiosResponse } from 'axios';

// Reuse the Filters interface
interface Filters {
[key: string]: any;
}
// // Reuse the Filters interface
// interface Filters {
// [key: string]: any;
// }

// Request parameters interface
interface GetBoardDataPostsParams {
filters?: Filters;
page: number;
}
// // Request parameters interface
// interface GetBoardDataPostsParams {
// filters?: Filters;
// page: number;
// }

// Define the structure of a single file
interface PostFile {
postFileId: number;
fileName: string;
fileUrl: string;
fileType: string;
}
// // Define the structure of a single file
// interface PostFile {
// postFileId: number;
// fileName: string;
// fileUrl: string;
// fileType: string;
// }

// Define the structure of a single post
interface PostListResDto {
postId: number;
category: string;
date: string;
title: string;
files: PostFile[];
isNotice: boolean;
// Add other relevant fields as needed
}
// // Define the structure of a single post
// interface PostListResDto {
// postId: number;
// category: string;
// date: string;
// title: string;
// files: PostFile[];
// isNotice: boolean;
// // Add other relevant fields as needed
// }

// Define the pagination information
interface PageInfo {
totalElements: number;
totalPages: number;
currentPage: number;
// Add other relevant fields if necessary
}
// // Define the pagination information
// interface PageInfo {
// totalElements: number;
// totalPages: number;
// currentPage: number;
// // Add other relevant fields if necessary
// }

// Define the structure of the API response
interface GetBoardDataPostsResponse {
data: {
postListResDto: PostListResDto[];
pageInfo: PageInfo;
};
}
// // Define the structure of the API response
// interface GetBoardDataPostsResponse {
// data: {
// postListResDto: PostListResDto[];
// pageInfo: PageInfo;
// };
// }

// Update the function to return the correct response type
export const getBoardDataPosts = async ({
filters = {},
page,
}: GetBoardDataPostsParams): Promise<GetBoardDataPostsResponse> => {
const response: AxiosResponse<GetBoardDataPostsResponse> = await clientAuth({
url: `/board/data/posts`,
method: 'get',
params: {
take: 5,
page: page - 1, // Assuming your API uses 0-based pagination
...filters,
},
});
return response.data;
};
// // Update the function to return the correct response type
// export const getBoardDataPosts = async ({
// filters = {},
// page,
// }: GetBoardDataPostsParams): Promise<GetBoardDataPostsResponse> => {
// const response: AxiosResponse<GetBoardDataPostsResponse> = await clientAuth({
// url: `/board/data/posts`,
// method: 'get',
// params: {
// take: 5,
// page: page - 1, // Assuming your API uses 0-based pagination
// ...filters,
// },
// });
// return response.data;
// };
38 changes: 19 additions & 19 deletions src/apis/postBoardDataSubCategoryPost.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { client } from '@/apis/client';
// import { client } from '@/apis/client';

export const postBoardDataSubCategoryPosts = (
fileCategory: string,
resBody: {
title: string | null;
content: string;
categoryCode: string;
thumbNailImage: null;
isNotice: boolean;
postFileList: any[];
},
accessToken: string
) => {
return client.post(`/board/data/${fileCategory}/post`, resBody, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
};
// export const postBoardDataSubCategoryPosts = (
// fileCategory: string,
// resBody: {
// title: string | null;
// content: string;
// categoryCode: string;
// thumbNailImage: null;
// isNotice: boolean;
// postFileList: any[];
// },
// accessToken: string
// ) => {
// return client.post(`/board/data/${fileCategory}/post`, resBody, {
// headers: {
// Authorization: `Bearer ${accessToken}`,
// },
// });
// };
2 changes: 1 addition & 1 deletion src/apis/postBoardFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function postBoardFiles({
boardCode,
files = [],
images = [],
}: postBoardFilesProps): Promise<AxiosResponse<any>> {
}: postBoardFilesProps): Promise<AxiosResponse> {
Copy link
Contributor

Choose a reason for hiding this comment

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

이건 백엔드의 리턴 타입대로 구현하는게 맞을 것 같네요.

Suggested change
}: postBoardFilesProps): Promise<AxiosResponse> {
}: postBoardFilesProps): Promise<AxiosResponse<ApiResponse<UploadFilesResponse>>> {

Copy link
Contributor

Choose a reason for hiding this comment

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

다만 apis 아래의 훅들은 점진적으로 Deprecated 처리해야 할 것 같습니다.

const formData = new FormData();

files.forEach((file) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apis/postBoardPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface postBoardPostsProps {
content: string;
categoryCode?: string;
groupCode?: string;
memberCode?: string;
memberCode?: string | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

어떤 경우에 memberCode가 null이 되나요?
그리고 백엔드에서 null로 보내준다면 ?를 제거해야 하지 않을까요?

만약 이게 patch 같은 곳에서도 사용해야 하는 값이라면 PatchBoardPostsProps 같은 이름으로 먼저 정의하고 Required<> Utility Type을 사용해서 다른 타입을 또 정의하는게 좋겠습니다.

thumbNailImage?: string | null;
isNotice?: boolean;
postFileList?: number[] | null;
Expand Down
6 changes: 3 additions & 3 deletions src/components/BoardNew/detail/PostFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DeleteButton } from '@/components/Buttons/BoardActionButtons.tsx';
import { buttonVariants } from '@/components/ui/button.tsx';
import { ButtonVariants } from '@/components/ui/button.tsx';
import { List, Pencil } from '@phosphor-icons/react';
import { Skeleton } from '@/components/ui/skeleton.tsx';
import { ArticleFooter } from '@/containers/new/ArticleFooter.tsx';
Expand All @@ -20,12 +20,12 @@ export function PostFooter({ boardUrl, deletable, editable, editUrl, onDelete, c
<div className="flex w-full max-w-[1040px] justify-end gap-4">
{deletable && <DeleteButton onClick={onDelete} />}
{editable && (
<a className={cn(buttonVariants({ variant: 'List_Edit' }), 'select-none')} href={editUrl}>
<a className={cn(ButtonVariants({ variant: 'List_Edit' }), 'select-none')} href={editUrl}>
<Pencil className="text-lg" />
<p className="text-lg">편집</p>
</a>
)}
<a className={cn(buttonVariants({ variant: 'List_Edit' }), 'select-none')} href={boardUrl}>
<a className={cn(ButtonVariants({ variant: 'List_Edit' }), 'select-none')} href={boardUrl}>
<List className="text-lg" />
<p className="text-lg">목록</p>
</a>
Expand Down
Loading