Repository navigation
[FE] 관리자 페이지 피드백 확인하기 페이지 #353
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
Merged
The head ref may contain hidden characters: "20260405_FE]352-\uAE30\uB2A5\uCD94\uAC00fe-\uD53C\uB4DC\uBC31-\uD655\uC778-\uD398\uC774\uC9C0-\uCD94\uAC00"
+404
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
frontend/src/components/AdminFeedback/AdminFeedbackList.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| import { useCallback, useEffect, useMemo, useState } from 'react'; | ||
| import { MessageSquare, RefreshCw } from 'lucide-react'; | ||
| import styles from './AdminFeedbackList.module.css'; | ||
| import { getAdminFeedbacks } from '../../utils/adminFeedbackApi'; | ||
|
|
||
| const PAGE_SIZE = 10; | ||
|
|
||
| const formatDateTime = (value) => { | ||
| if (!value) return '-'; | ||
|
|
||
| const date = new Date(value); | ||
| if (Number.isNaN(date.getTime())) return '-'; | ||
|
|
||
| return date.toLocaleString('ko-KR', { | ||
| year: 'numeric', | ||
| month: '2-digit', | ||
| day: '2-digit', | ||
| hour: '2-digit', | ||
| minute: '2-digit', | ||
| }); | ||
| }; | ||
|
|
||
| const AdminFeedbackList = () => { | ||
| const [feedbacks, setFeedbacks] = useState([]); | ||
| const [page, setPage] = useState(0); | ||
| const [totalPages, setTotalPages] = useState(0); | ||
| const [totalElements, setTotalElements] = useState(0); | ||
| const [isLoading, setIsLoading] = useState(false); | ||
| const [error, setError] = useState(''); | ||
|
|
||
| const fetchFeedbacks = useCallback(async (nextPage = page) => { | ||
| setIsLoading(true); | ||
| setError(''); | ||
|
|
||
| try { | ||
| const result = await getAdminFeedbacks({ page: nextPage, size: PAGE_SIZE }); | ||
| const content = Array.isArray(result?.content) ? result.content : []; | ||
|
|
||
| setFeedbacks(content); | ||
| setPage(result?.number ?? nextPage); | ||
| setTotalPages(result?.totalPages ?? 0); | ||
| setTotalElements(result?.totalElements ?? content.length); | ||
| } catch (loadError) { | ||
| setFeedbacks([]); | ||
|
sangkyu39 marked this conversation as resolved.
|
||
| setError(loadError?.message || '피드백을 불러오지 못했습니다. 잠시 후 다시 시도해주세요.'); | ||
| } finally { | ||
|
sangkyu39 marked this conversation as resolved.
|
||
| setIsLoading(false); | ||
| } | ||
| }, [page]); | ||
|
|
||
| useEffect(() => { | ||
| fetchFeedbacks(0); | ||
| }, [fetchFeedbacks]); | ||
|
sangkyu39 marked this conversation as resolved.
sangkyu39 marked this conversation as resolved.
|
||
|
|
||
| const pageLabel = useMemo(() => { | ||
| if (totalPages === 0) return '0 / 0'; | ||
| return `${page + 1} / ${totalPages}`; | ||
| }, [page, totalPages]); | ||
|
|
||
| const goPrev = () => { | ||
| if (isLoading || page <= 0) return; | ||
| fetchFeedbacks(page - 1); | ||
| }; | ||
|
|
||
| const goNext = () => { | ||
| if (isLoading || page + 1 >= totalPages) return; | ||
| fetchFeedbacks(page + 1); | ||
| }; | ||
|
|
||
| return ( | ||
| <section className={styles.container}> | ||
| <div className={styles.headerRow}> | ||
| <div className={styles.titleWrap}> | ||
| <MessageSquare size={18} /> | ||
| <h2 className={styles.title}>사용자 피드백</h2> | ||
| <span className={styles.count}>총 {totalElements.toLocaleString()}건</span> | ||
| </div> | ||
|
|
||
| <button | ||
| type="button" | ||
| className={styles.refreshButton} | ||
| onClick={() => fetchFeedbacks(page)} | ||
| disabled={isLoading} | ||
| > | ||
| <RefreshCw size={16} className={isLoading ? styles.spin : ''} /> | ||
| 새로고침 | ||
| </button> | ||
| </div> | ||
|
|
||
| {error && <p className={styles.errorText}>{error}</p>} | ||
|
|
||
| <div className={styles.listWrap}> | ||
| {isLoading && <p className={styles.statusText}>피드백을 불러오는 중입니다...</p>} | ||
|
|
||
| {!isLoading && feedbacks.length === 0 && !error && ( | ||
| <p className={styles.statusText}>등록된 피드백이 없습니다.</p> | ||
| )} | ||
|
|
||
| {!isLoading && feedbacks.length > 0 && ( | ||
| <ul className={styles.list}> | ||
| {feedbacks.map((item) => ( | ||
| <li key={item.feedbackId} className={styles.item}> | ||
| <div className={styles.itemMeta}> | ||
| <span className={styles.feedbackId}>익명</span> | ||
| <time className={styles.dateText}>{formatDateTime(item.createdDate)}</time> | ||
| </div> | ||
| <p className={styles.content}>{item.content || '-'}</p> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| )} | ||
| </div> | ||
|
|
||
| <div className={styles.pagination}> | ||
| <button | ||
| type="button" | ||
| className={styles.pageButton} | ||
| onClick={goPrev} | ||
| disabled={isLoading || page <= 0} | ||
| > | ||
| 이전 | ||
| </button> | ||
| <span className={styles.pageLabel}>{pageLabel}</span> | ||
| <button | ||
| type="button" | ||
| className={styles.pageButton} | ||
| onClick={goNext} | ||
| disabled={isLoading || page + 1 >= totalPages} | ||
| > | ||
| 다음 | ||
| </button> | ||
| </div> | ||
| </section> | ||
| ); | ||
| }; | ||
|
|
||
| export default AdminFeedbackList; | ||
191 changes: 191 additions & 0 deletions
191
frontend/src/components/AdminFeedback/AdminFeedbackList.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| .container { | ||
| border-radius: 18px; | ||
| border: 1px solid #e6ebf2; | ||
| background: #ffffff; | ||
| box-shadow: 0 10px 30px rgba(19, 33, 68, 0.06); | ||
| padding: 20px; | ||
| } | ||
|
|
||
| .headerRow { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| gap: 12px; | ||
| margin-bottom: 16px; | ||
| } | ||
|
|
||
| .titleWrap { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| color: #1f2937; | ||
| } | ||
|
|
||
| .title { | ||
| font-size: 18px; | ||
| font-weight: 700; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .count { | ||
| color: #6b7280; | ||
| font-size: 13px; | ||
| } | ||
|
|
||
| .refreshButton { | ||
| border: 1px solid #d7dce5; | ||
| background: #ffffff; | ||
| color: #1f2937; | ||
| border-radius: 10px; | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 6px; | ||
| padding: 8px 12px; | ||
| font-size: 14px; | ||
| font-weight: 600; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .refreshButton:hover:not(:disabled) { | ||
| background: #f9fafb; | ||
| } | ||
|
|
||
| .refreshButton:disabled { | ||
| cursor: not-allowed; | ||
| opacity: 0.6; | ||
| } | ||
|
|
||
| .spin { | ||
| animation: spin 1s linear infinite; | ||
| } | ||
|
|
||
| @keyframes spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
|
|
||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
|
|
||
| .errorText { | ||
| margin: 0 0 12px; | ||
| color: #b91c1c; | ||
| font-size: 14px; | ||
| } | ||
|
|
||
| .listWrap { | ||
| border: 1px solid #edf1f7; | ||
| border-radius: 14px; | ||
| background: #fcfdff; | ||
| min-height: 240px; | ||
| } | ||
|
|
||
| .statusText { | ||
| margin: 0; | ||
| padding: 24px; | ||
| color: #6b7280; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .list { | ||
| list-style: none; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .item { | ||
| padding: 16px; | ||
| border-bottom: 1px solid #eef2f7; | ||
| } | ||
|
|
||
| .item:last-child { | ||
| border-bottom: none; | ||
| } | ||
|
|
||
| .itemMeta { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| gap: 12px; | ||
| margin-bottom: 8px; | ||
| } | ||
|
|
||
| .feedbackId { | ||
| font-size: 12px; | ||
| color: #6b7280; | ||
| word-break: break-all; | ||
| } | ||
|
|
||
| .dateText { | ||
| font-size: 12px; | ||
| color: #6b7280; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .content { | ||
| margin: 0; | ||
| line-height: 1.6; | ||
| color: #111827; | ||
| white-space: pre-wrap; | ||
| } | ||
|
|
||
| .pagination { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 12px; | ||
| margin-top: 16px; | ||
| } | ||
|
|
||
| .pageLabel { | ||
| min-width: 72px; | ||
| text-align: center; | ||
| color: #4b5563; | ||
| font-weight: 600; | ||
| } | ||
|
|
||
| .pageButton { | ||
| border: 1px solid #d7dce5; | ||
| background: #ffffff; | ||
| color: #1f2937; | ||
| border-radius: 10px; | ||
| padding: 8px 14px; | ||
| font-size: 14px; | ||
| font-weight: 600; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .pageButton:hover:not(:disabled) { | ||
| background: #f9fafb; | ||
| } | ||
|
|
||
| .pageButton:disabled { | ||
| cursor: not-allowed; | ||
| opacity: 0.5; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| .container { | ||
| padding: 16px; | ||
| } | ||
|
|
||
| .headerRow { | ||
| flex-direction: column; | ||
| align-items: stretch; | ||
| } | ||
|
|
||
| .refreshButton { | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .itemMeta { | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| } | ||
|
|
||
| .dateText { | ||
| white-space: normal; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import AdminHeader from '../components/AdminHome/AdminHeader'; | ||
| import AdminSidebar from '../components/AdminHome/AdminSidebar'; | ||
| import AdminFeedbackList from '../components/AdminFeedback/AdminFeedbackList'; | ||
| import styles from './AdminFeedback.module.css'; | ||
|
|
||
| const AdminFeedback = () => { | ||
| return ( | ||
| <div className={styles.layout}> | ||
| <AdminSidebar /> | ||
|
|
||
| <div className={styles.mainArea}> | ||
| <AdminHeader title="피드백 확인" /> | ||
| <div className={styles.contentArea}> | ||
| <AdminFeedbackList /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AdminFeedback; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.