-
Notifications
You must be signed in to change notification settings - Fork 2
✨ Feat: 대시보드 수정 페이지 기초 UI 작업 #75
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
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
10adb95
🎨style: 돌아가기 버튼 이미지 추가
yuj2n 131a4d8
✨feat: 컴포넌트 세분화
yuj2n ee3e3b5
🎨style: 돌아가기 버튼 이미지 추가
yuj2n addf5d3
✨feat: 컴포넌트 세분화
yuj2n fa5afbe
🔧chore: alias 설정 추가
yuj2n dd43fb7
🎨style: 초대하기 흰색 버튼 이미지 추가
yuj2n 7bede1a
🎨style: 페이지네이션 버튼 이미지 추가
yuj2n 8be8ca2
✨feat: 대시보드 색상 공용화
yuj2n 92075b8
🫧modify: 대시보드 색상 사용하던 곳 코드 수정
yuj2n 24b3772
🎨style: 버튼 색상 추가
yuj2n 3cf0bef
🫧modify: 헤더 너비 수정 및 프로필 이미지 왼쪽 보더 추가
yuj2n b71e8a7
🫧modify: 사용자 프로필 이미지 null 여부 추가
yuj2n a505111
🔧chore: 폴더 구조 변경 및 경로 축소를 위한 alias 설정 추가
yuj2n 785028e
✨feat: 대시보드 수정 페이지 작성
yuj2n 99978d3
✨feat: 사용자 정보 수정 컴포넌트 구현
yuj2n 2d65361
✨feat: 구성원 수정 컴포넌트 구현
yuj2n 5c2d252
✨feat: 초대하기 컴포넌트 구현
yuj2n 542ed51
✨feat: 사용자 정보 임시 데이터 작성
yuj2n 0184490
Merge branch 'feature/dashboard_modify-UI' of https://github.com/CoPl…
yuj2n d5d176a
🫧modify: 미사용 함수 import 제거
yuj2n 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 @@ | ||
| export default function EditInfo() { | ||
| return <p>대시보드 수정 페이지</p> | ||
| } |
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,3 @@ | ||
| export default function EditInvitation() { | ||
| return <p>대시보드 초대 수정 페이지</p> | ||
| } |
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,3 @@ | ||
| export default function EditMember() { | ||
| return <p>대시보드 멤버 수정 페이지</p> | ||
| } |
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 |
|---|---|---|
| @@ -1,24 +1,37 @@ | ||
| 'use client' | ||
|
|
||
| import EditInfo from '@dashboard/components/edit/EditInfo' | ||
| import EditInvitation from '@dashboard/components/edit/EditInvitation' | ||
| import EditMember from '@dashboard/components/edit/EditMember' | ||
| import { showError, showSuccess } from '@lib/toast' | ||
| import Image from 'next/image' | ||
|
|
||
| export default function DashBoardEditPage() { | ||
| const handleSuccess = () => { | ||
| showSuccess('대시보드가 성공적으로 저장되었습니다.') | ||
| showSuccess('대시보드가 성공적으로 수정되었습니다.') | ||
| } | ||
|
|
||
| const handleError = () => { | ||
| showError('저장 중 오류가 발생했습니다.') | ||
| showError('수정 중 오류가 발생했습니다.') | ||
| } | ||
|
|
||
| return ( | ||
| <div className="space-y-4 p-6"> | ||
| <p className="text-xl font-semibold">대시보드 수정 페이지</p> | ||
|
|
||
| <div className="flex gap-4"> | ||
| <button onClick={handleSuccess}>성공 토스트</button> | ||
| <button onClick={handleError}>에러 토스트</button> | ||
| <div className="BG-gray"> | ||
| <div | ||
| className="flex cursor-pointer items-center gap-12 p-16" | ||
| onClick={() => window.history.back()} | ||
| > | ||
| <Image src="/images/back.png" alt="돌아가기" width={8} height={4} /> | ||
| <p>돌아가기</p> | ||
| </div> | ||
| <div className="flex w-500 flex-col gap-16 p-16"> | ||
| <EditInfo /> | ||
| <EditMember /> | ||
| <EditInvitation /> | ||
| </div> | ||
| <button className="Text-btn Border-btn ml-16 rounded-md px-64 py-12"> | ||
| 대시보드 삭제하기 | ||
| </button> | ||
| </div> | ||
| ) | ||
| } | ||
129 changes: 129 additions & 0 deletions
129
src/app/features/dashboard/components/edit/EditInfo.tsx
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,129 @@ | ||
| import api from '@lib/axios' | ||
| import Image from 'next/image' | ||
| import { useRouter } from 'next/navigation' | ||
| import React, { useEffect, useState } from 'react' | ||
|
|
||
| import { DASHBOARD_COLORS } from '@/app/shared/constants/colors' | ||
| import { CreateDashboardRequest } from '@/app/shared/types/dashboard' | ||
|
|
||
| export default function EditInfo() { | ||
| const router = useRouter() | ||
| const [formData, setFormData] = useState<CreateDashboardRequest>({ | ||
| title: '', | ||
| color: DASHBOARD_COLORS[0], | ||
| }) | ||
|
|
||
| const [isSubmitting, setIsSubmitting] = useState(false) | ||
|
|
||
| /// 입력값 변경 처리 | ||
| const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
| const { name, value } = e.target | ||
| setFormData((prev) => ({ | ||
| ...prev, | ||
| [name]: value, | ||
| })) | ||
| } | ||
| // 색상 선택 처리 | ||
| const handleColorSelect = (color: string) => { | ||
| setFormData((prev) => ({ ...prev, color })) | ||
| } | ||
| const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { | ||
| e.preventDefault() | ||
|
|
||
| if (!formData.title || !formData.color) { | ||
| return | ||
| } | ||
| try { | ||
| setIsSubmitting(true) | ||
|
|
||
| if (!process.env.NEXT_PUBLIC_TEAM_ID) { | ||
| throw new Error('NEXT_PUBLIC_TEAM_ID 환경변수가 설정되지 않았습니다.') | ||
| } | ||
|
|
||
| const response = await api.post( | ||
| `/${process.env.NEXT_PUBLIC_TEAM_ID}/dashboards`, | ||
| formData, | ||
| ) | ||
|
|
||
| const data = response.data | ||
|
|
||
| // 성공 시 대시보드 상세 페이지로 이동 | ||
| router.push(`/dashboard/${data.id}`) | ||
| } catch (error) { | ||
| console.error('대시보드 생성 오류:', error) | ||
| } finally { | ||
| setIsSubmitting(false) | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <div> | ||
| {/* 컨테이너 */} | ||
| <div className="BG-white h-300 w-584 rounded-16 px-32 py-24"> | ||
| <h2 className="Text-black mb-24 text-18 font-bold">새로운 대시보드</h2> | ||
|
|
||
| <form onSubmit={handleSubmit}> | ||
| {/* 제목 입력 */} | ||
| <div className="mb-16"> | ||
| <label htmlFor="title" className="Text-black mb-8 block text-16"> | ||
| 대시보드 이름 | ||
| </label> | ||
| <input | ||
| type="text" | ||
| id="title" | ||
| name="title" | ||
| value={formData.title} | ||
| onChange={handleChange} | ||
| placeholder="대시보드 이름을 입력해주세요." | ||
| className="Border-section w-512 rounded-8 px-12 py-10 text-16 outline-none" | ||
| required | ||
| /> | ||
| </div> | ||
|
|
||
| {/* 색상 선택 */} | ||
| <div className="mb-30"> | ||
| <div className="flex gap-8"> | ||
| {DASHBOARD_COLORS.map((color) => ( | ||
| <button | ||
| key={color} | ||
| type="button" | ||
| onClick={() => handleColorSelect(color)} | ||
| className="relative flex size-30 items-center justify-center rounded-full" | ||
| style={{ backgroundColor: color }} | ||
| aria-label={`색상 ${color}`} | ||
| > | ||
| {/* 선택된 색상 체크 */} | ||
| {formData.color === color && ( | ||
| <div className="relative size-24 items-center justify-center"> | ||
| <Image | ||
| src="/images/check.svg" | ||
| alt="check" | ||
| fill | ||
| className="object-contain" | ||
| /> | ||
| </div> | ||
| )} | ||
| </button> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* 하단 버튼 */} | ||
| <div> | ||
| <button | ||
| type="submit" | ||
| disabled={!formData.title || !formData.color || isSubmitting} | ||
| className={`BG-violet h-48 w-512 rounded-8 px-16 py-10 text-16 font-semibold text-white transition-opacity ${ | ||
| !formData.title || !formData.color || isSubmitting | ||
| ? 'cursor-not-allowed opacity-50' | ||
| : 'hover:opacity-90' | ||
| }`} | ||
| > | ||
| 변경 | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
67 changes: 67 additions & 0 deletions
67
src/app/features/dashboard/components/edit/EditInvitation.tsx
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,67 @@ | ||
| import { UserInfo } from '@components/common/UserInfo' | ||
| import { cn } from '@lib/cn' | ||
| import Image from 'next/image' | ||
| import Link from 'next/link' | ||
| import { usePathname } from 'next/navigation' | ||
| import React from 'react' | ||
|
|
||
| import { mockMembers } from './mockMember' | ||
|
|
||
| export default function EditInvitation() { | ||
| const pathname = usePathname() | ||
| return ( | ||
| <div> | ||
| {/* 컨테이너 */} | ||
| <div className="BG-white h-360 w-584 rounded-16 px-32 py-24"> | ||
| <div className="mb-24 flex items-center justify-between"> | ||
| <h2 className="Text-black text-18 font-bold">초대 내역</h2> | ||
|
|
||
| <div className="flex items-center"> | ||
| <p className="Text-gray mr-16 text-12">1 페이지 중 1</p> | ||
| <Image src="/images/prev.png" alt="이전" width={36} height={36} /> | ||
| <Image src="/images/next.png " alt="다음" width={36} height={36} /> | ||
| <Link | ||
| href="/modal" | ||
| className={cn( | ||
| 'BG-violet ml-16 flex items-center gap-8 rounded-5 px-12 py-6', | ||
| pathname === '/modal' && 'font-semibold', | ||
| )} | ||
| > | ||
| <div className="relative flex size-12"> | ||
| <Image | ||
| src="/images/invitation-white.png" | ||
| fill | ||
| alt="초대 버튼" | ||
| /> | ||
| </div> | ||
| <p className="text-14 text-white">초대하기</p> | ||
| </Link> | ||
| </div> | ||
| </div> | ||
|
|
||
| <form> | ||
| <label htmlFor="title" className="Text-black mb-8 block text-16"> | ||
| 이메일 | ||
| </label> | ||
| <div className="flex flex-col gap-4"> | ||
| {mockMembers.map((member, index) => ( | ||
| <div | ||
| key={index} | ||
| className="Border-bottom flex items-center justify-between py-4" | ||
| > | ||
| <UserInfo | ||
| key={index} | ||
| nickname={member.nickname} | ||
| imageUrl={member.imageUrl} | ||
| /> | ||
| <button className="Text-btn Border-btn rounded-md px-16 py-2"> | ||
| 취소 | ||
| </button> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
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,48 @@ | ||
| import Image from 'next/image' | ||
| import React from 'react' | ||
|
|
||
| import { UserInfo } from '@/app/shared/components/common/UserInfo' | ||
|
|
||
| import { mockMembers } from './mockMember' | ||
|
|
||
| export default function EditMember() { | ||
| return ( | ||
| <div> | ||
| {/* 컨테이너 */} | ||
| <div className="BG-white h-360 w-584 rounded-16 px-32 py-24"> | ||
| <div className="mb-24 flex items-center justify-between"> | ||
| <h2 className="Text-black text-18 font-bold">구성원</h2> | ||
|
|
||
| <div className="flex items-center"> | ||
| <p className="Text-gray mr-16 text-12">1 페이지 중 1</p> | ||
| <Image src="/images/prev.png" alt="이전" width={36} height={36} /> | ||
| <Image src="/images/next.png " alt="다음" width={36} height={36} /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <form> | ||
| <label htmlFor="title" className="Text-black mb-8 block text-16"> | ||
| 이름 | ||
| </label> | ||
| <div className="flex flex-col gap-4"> | ||
| {mockMembers.map((member, index) => ( | ||
| <div | ||
| key={index} | ||
| className="Border-bottom flex items-center justify-between py-4" | ||
| > | ||
| <UserInfo | ||
| key={index} | ||
| nickname={member.nickname} | ||
| imageUrl={member.imageUrl} | ||
| /> | ||
| <button className="Text-btn Border-btn rounded-md px-16 py-2"> | ||
| 삭제 | ||
| </button> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
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,24 @@ | ||
| // mockMember.js | ||
|
|
||
| export const mockMembers = [ | ||
| { | ||
| nickname: '민준', | ||
| imageUrl: '/images/profile.gif', | ||
| }, | ||
| { | ||
| nickname: '서연', | ||
| imageUrl: null, | ||
| }, | ||
| { | ||
| nickname: 'James', | ||
| imageUrl: null, | ||
| }, | ||
| { | ||
| nickname: '나연 ', | ||
| imageUrl: '/images/profile.gif', | ||
| }, | ||
| { | ||
| nickname: 'Emily', | ||
| imageUrl: null, | ||
| }, | ||
| ] | ||
yuj2n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
widow.history.back()은 Next에useRouter에서 동일하게back()이라는 함수가 존재합니다! 동작은 동일하지만 일관성을 위해서 해당 함수를 사용하는 게 좋을 거 같습니다! 공식 문서There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
적용했습니다~