Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
94cbb4a
refactor : 게시글 수정 디자인 수정
junye0l Nov 26, 2025
2ad9003
refactor : 스타일 수정 및 가독성 개선
junye0l Nov 26, 2025
3069b93
refactor : 계정 설정 페이지 디자인 수정
junye0l Nov 26, 2025
7b2b27a
refactor : 토스트 컴포넌트 아웃라인 속성 제거
junye0l Nov 26, 2025
6ee5e0e
fix : 마진 병합으로 인한 레이아웃 시프트 버그 해결
junye0l Nov 26, 2025
f54fa34
feat : 팀 참여 페이지 메타데이터 작업
junye0l Nov 27, 2025
0775ec9
feat : 팀 생성 페이지 메타데이터 작업
junye0l Nov 27, 2025
03dc067
feat : 계정 설정 페이지 메타데이터 작업
junye0l Nov 27, 2025
8d81680
Merge branch 'develop' into feat/metadata-setting
junye0l Nov 27, 2025
d274260
feat : 자유게시판 페이지 메타데이터 작업
junye0l Nov 27, 2025
69682e0
feat : 자유게시판 상세 페이지 동적 메타데이터 작업
junye0l Nov 27, 2025
5da67c5
feat : 자유게시판 게시글 작성 페이지 메타데이터 작업
junye0l Nov 27, 2025
1795210
refactor : 자유게시판 동적 메타데이터 개선 작업
junye0l Nov 27, 2025
1efcc50
refactor : 메타데이터 일부 수정
junye0l Nov 27, 2025
c87ddd4
design : 자유게시판 더보기 버튼 제거
junye0l Nov 27, 2025
4b54af8
chore : 기존 스크롤 방지 로직으로 롤백
junye0l Nov 27, 2025
f2864eb
refactor : 쿠키 전달하는 로직 추가
junye0l Nov 27, 2025
6d2d7b3
refactor : 토큰 없을시 로그인 페이지로 리다이렉트 연결
junye0l Nov 27, 2025
dc00106
Merge branch 'develop' into feat/metadata-setting
junye0l Nov 28, 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
31 changes: 31 additions & 0 deletions src/api/articles/get-article-detail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import axios from "axios";
import { Article } from "@/types/article";

const getArticleDetail = async (
articleId: number,
accessToken?: string
): Promise<Article | null> => {
try {
const headers: Record<string, string> = {
"Content-Type": "application/json",
};

if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`;
}

const response = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/articles/${articleId}`,
{ headers }
);

if (!response) throw new Error("데이터를 불러오지 못했습니다.");

return response.data;
} catch (error) {
console.error(error);
return null;
}
};

export default getArticleDetail;
22 changes: 22 additions & 0 deletions src/app/addteam/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import type { Metadata } from "next";
import AddTeamContents from "./_components/add-team-contents";

export const metadata: Metadata = {
title: "팀 생성",
description: "새로운 Coworkers 팀을 생성하세요",
openGraph: {
title: "팀 생성 | Coworkers",
description: "새로운 Coworkers 팀을 생성하세요",
type: "website",
url: "https://coworkes.com/addteam",
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 팀 생성",
},
],
},
};

const addTeamPage = () => {
return (
<div className="min-h-screen flex-center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { useEffect } from "react";
import { useGetArticleDetail } from "@/hooks/api/articles/use-get-article-detail";
import ArticleHeader from "./article-header/article-header";
import ArticleContents from "./article-contents/article-contents";
Expand All @@ -16,10 +17,16 @@ export default function ArticleDetailClient({
}: ArticleDetailClientProps) {
const { data, isPending, isError } = useGetArticleDetail(articleId);

useEffect(() => {
if (data?.article?.title) {
document.title = data.article.title;
}
}, [data]);

if (isPending) return <ArticleDetailSkeleton />;

if (isError || !data?.article) {
notFound();
return notFound();
}

const articleData = data.article;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"use client";

import { useEffect } from "react";
import cn from "@/utils/clsx";
import { useGetArticleDetail } from "@/hooks/api/articles/use-get-article-detail";
import { ArticleEditSkeleton } from "@/components";
import ArticleEditContents from "./article-edit-contents/article-edit-contents";
import { notFound } from "next/navigation";

interface ArticleEditClientProps {
articleId: number;
}

export default function ArticleEditClient({
articleId,
}: ArticleEditClientProps) {
const { data, isPending } = useGetArticleDetail(articleId);

useEffect(() => {
if (data?.article?.title) {
document.title = `${data.article.title} 수정`;
}
}, [data]);

if (isPending) return <ArticleEditSkeleton />;

if (!data?.article) {
notFound();
}

return (
<div
className={cn(
"mx-auto mt-[36px] w-full max-w-[343px] rounded-[20px] bg-white",
"tablet:mt-[117px] tablet:max-w-[620px]",
"pc:mt-[100px] pc:max-w-[900px]"
)}
>
<ArticleEditContents article={data.article} />
</div>
);
}
71 changes: 53 additions & 18 deletions src/app/boards/[articleId]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,61 @@
"use client";
import type { Metadata } from "next";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import ArticleEditClient from "./_components/article-edit-client";
import getArticleDetail from "@/api/articles/get-article-detail";

import { useParams } from "next/navigation";
import { useGetArticleDetail } from "@/hooks/api/articles/use-get-article-detail";
import { ArticleEditSkeleton } from "@/components";
import ArticleEditContents from "./_components/article-edit-contents/article-edit-contents";
import { notFound } from "next/navigation";
interface PageProps {
params: Promise<{ articleId: string }>;
}

async function getAccessToken() {
const cookieStore = await cookies();
return cookieStore.get("accessToken")?.value;
}

export default function EditPage() {
const params = useParams();
const articleId = params.articleId;
export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
const { articleId } = await params;
const accessToken = await getAccessToken();
const article = await getArticleDetail(Number(articleId), accessToken);

const { data, isPending } = useGetArticleDetail(Number(articleId));
if (!article) {
return {
title: "게시글 수정",
description: "Coworkers 자유게시판 게시글 수정",
};
}

return {
title: `${article.title} 수정`,
description: "Coworkers 자유게시판 게시글 수정",
openGraph: {
title: `${article.title} 수정 | Coworkers`,
description: "Coworkers 자유게시판 게시글 수정",
type: "website",
url: `https://coworkes.com/boards/${articleId}/edit`,
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 게시글 수정",
},
],
},
};
}

if (isPending) return <ArticleEditSkeleton />;
export default async function EditPage({ params }: PageProps) {
const { articleId } = await params;
const accessToken = await getAccessToken();

if (!data?.article) {
notFound();
if (!accessToken) {
redirect("/signin");
}

return (
<div className="mx-auto my-[36px] w-full max-w-[343px] rounded-[20px] bg-white tablet:mb-[137px] tablet:mt-[117px] tablet:max-w-[620px] pc:my-[100px] pc:max-w-[900px]">
<ArticleEditContents article={data.article} />
</div>
);
return <ArticleEditClient articleId={Number(articleId)} />;
}
50 changes: 50 additions & 0 deletions src/app/boards/[articleId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,61 @@
import type { Metadata } from "next";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import ArticleDetailClient from "./_components/article-detail-client";
import getArticleDetail from "@/api/articles/get-article-detail";

interface PageProps {
params: Promise<{ articleId: string }>;
}

async function getAccessToken() {
const cookieStore = await cookies();
return cookieStore.get("accessToken")?.value;
}

export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
const { articleId } = await params;
const accessToken = await getAccessToken();
const article = await getArticleDetail(Number(articleId), accessToken);

if (!article) {
return {
title: "게시글",
description: "Coworkers 자유게시판",
};
}

return {
title: article.title,
description: article.content.slice(0, 160),
openGraph: {
title: `${article.title} | Coworkers`,
description: article.content.slice(0, 160),
type: "article",
url: `https://coworkes.com/boards/${articleId}`,
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 자유게시판",
},
],
},
};
}

export default async function Page({ params }: PageProps) {
const { articleId } = await params;
const accessToken = await getAccessToken();

if (!accessToken) {
redirect("/signin");
}

return <ArticleDetailClient articleId={Number(articleId)} />;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Icon } from "@/components/index";

const BoardsBestHeader = () => {
return (
<div className="mx-auto flex w-full items-center justify-between tablet:max-w-[616px] pc:max-w-[1058px]">
<div className="mx-auto w-full tablet:max-w-[616px] pc:max-w-[1058px]">
<h2 className="m-0 text-xl font-semibold">베스트 게시글</h2>
<div className="gap-[2px] flex-center">
<span className="text-sm text-gray-700">더보기</span>
<Icon className="h-4 w-4" icon="rightArrow" />
</div>
</div>
);
};
Expand Down
29 changes: 29 additions & 0 deletions src/app/boards/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Metadata } from "next";
import { ReactNode } from "react";

export const metadata: Metadata = {
title: "자유게시판",
description: "Coworkers 자유게시판에서 다양한 이야기를 나누세요",
openGraph: {
title: "자유게시판 | Coworkers",
description: "Coworkers 자유게시판에서 다양한 이야기를 나누세요",
type: "website",
url: "https://coworkes.com/boards",
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 자유게시판",
},
],
},
};

const Layout = ({ children }: { children: ReactNode }) => {
return <>{children}</>;
};

export default Layout;
22 changes: 22 additions & 0 deletions src/app/boards/write/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import type { Metadata } from "next";
import cn from "@/utils/clsx";
import ArticleWriteContents from "./_components/article-write-contents/article-write-contents";

export const metadata: Metadata = {
title: "게시글 작성",
description: "Coworkers 자유게시판에 새로운 글을 작성하세요",
openGraph: {
title: "게시글 작성 | Coworkers",
description: "Coworkers 자유게시판에 새로운 글을 작성하세요",
type: "website",
url: "https://coworkes.com/boards/write",
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 게시글 작성",
},
],
},
};

const Page = () => {
return (
<div
Expand Down
24 changes: 23 additions & 1 deletion src/app/mypage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import type { Metadata } from "next";
import UserSettingContents from "./_components/user-setting-contents";

export const metadata: Metadata = {
title: "계정 설정",
description: "Coworkers 계정 설정 페이지",
openGraph: {
title: "계정 설정 | Coworkers",
description: "Coworkers 계정 설정 페이지",
type: "website",
url: "https://coworkes.com/mypage",
locale: "ko_KR",
siteName: "Coworkers",
images: [
{
url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg",
width: 1200,
height: 630,
alt: "Coworkers 계정 설정",
},
],
},
};

const MyPage = () => {
return (
<div className="mt-[75px] flex-center tablet:mt-[176px] pc:mt-[156px]">
<div className="min-h-[calc(100vh-60px)] flex-center tablet:min-h-screen pc:min-h-screen">
<div className="min-h-[556px] w-[343px] rounded-[20px] bg-white tablet:h-[745px] tablet:w-[550px] pc:w-[940px]">
<UserSettingContents />
</div>
Expand Down
Loading