Skip to content

Commit 9e626ef

Browse files
committed
feat(community) : public 상태 repository 화면 작성
1 parent 76eb8d9 commit 9e626ef

File tree

10 files changed

+257
-194
lines changed

10 files changed

+257
-194
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.backend.domain.community.dto.response;
2+
3+
public class CommunityAnalysisResultResponseDto {
4+
}

front/next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const nextConfig = {
99
if (process.env.NEXT_PUBLIC_DEV_PROXY === 'true') {
1010
return [
1111
{
12-
source: "/api/:path*",
12+
source: "/:path*",
1313
destination: `${process.env.NEXT_PUBLIC_BACKEND_URL}/:path*`,
1414
},
1515
];

front/package-lock.json

Lines changed: 193 additions & 189 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
"zod": "3.23.8"
2626
},
2727
"devDependencies": {
28-
"@tailwindcss/postcss": "^4.1.14",
28+
"@tailwindcss/postcss": "^4.1.15",
2929
"@types/node": "22.7.4",
3030
"@types/react": "18.3.5",
3131
"@types/react-dom": "18.3.0",
3232
"autoprefixer": "^10.4.21",
3333
"eslint": "9.12.0",
3434
"eslint-config-next": "15.0.0",
3535
"postcss": "^8.5.6",
36-
"tailwindcss": "^4.1.14",
36+
"tailwindcss": "^4.1.15",
3737
"typescript": "5.6.2"
3838
}
3939
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
// 커뮤니티 사용자 분석 결과 상세 페이지, 댓글 기능 있어야 하는 곳

front/src/app/community/page.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
// 커뮤니티 메인 페이지
1+
// 커뮤니티 사용자 분석 결과 상세 페이지, 댓글 기능 있어야 하는 곳
2+
"use client"
3+
4+
import { useCommunity } from "@/hooks/community/useCommunity"
5+
import RepoList from "@/components/community/RepoList"
6+
7+
export default function CommunityPage() {
8+
const { repos, loading, error } = useCommunity()
9+
10+
if (loading) return <div>Loading...</div>
11+
if (error) return <div>에러가 발생했습니다 😢</div>
12+
13+
return <RepoList repos={repos} />
14+
}

front/src/app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Suspense } from "react"
66
import Header from "@/components/Header"
77
import Footer from "@/components/Footer"
88
import { ToastProvider } from "@/components/ui/Toast"
9+
import Link from "next/link";
910

1011
const inter = Inter({
1112
subsets: ["latin"],
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use client"
2+
3+
import { useEffect, useState } from "react"
4+
import { Repo } from "@/types/community"
5+
6+
export function useCommunity() {
7+
const [repos, setRepos] = useState<Repo[]>([])
8+
const [loading, setLoading] = useState(true)
9+
const [error, setError] = useState<Error | null>(null)
10+
11+
useEffect(() => {
12+
fetch("http://localhost:8080/api/community/repositories")
13+
.then(res => res.json())
14+
.then(data => {
15+
setRepos(data)
16+
setLoading(false)
17+
})
18+
.catch(err => {
19+
console.error(err)
20+
setError(err)
21+
setLoading(false)
22+
})
23+
}, [])
24+
25+
return { repos, loading, error }
26+
}

front/src/lib/api/community.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
// community 도메인 API
2+
import { Repo } from "../../types/community"
3+
4+
export const fetchRepos = async (): Promise<Repo[]> => {
5+
const res = await fetch("http://localhost:8080/api/community/repositories")
6+
if (!res.ok) throw new Error("레포지토리 조회 실패")
7+
return res.json()
8+
}

front/src/types/community.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
// community 도메인 타입
2+
export type Repo = {
3+
id: number
4+
userName: string
5+
userImage?: string
6+
repoName: string
7+
summary: string
8+
languages?: string[]
9+
totalScore: number
10+
}

0 commit comments

Comments
 (0)