Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
10adb95
🎨style: 돌아가기 버튼 이미지 추가
yuj2n Jun 17, 2025
131a4d8
✨feat: 컴포넌트 세분화
yuj2n Jun 17, 2025
ee3e3b5
🎨style: 돌아가기 버튼 이미지 추가
yuj2n Jun 17, 2025
addf5d3
✨feat: 컴포넌트 세분화
yuj2n Jun 17, 2025
fa5afbe
🔧chore: alias 설정 추가
yuj2n Jun 18, 2025
dd43fb7
🎨style: 초대하기 흰색 버튼 이미지 추가
yuj2n Jun 18, 2025
7bede1a
🎨style: 페이지네이션 버튼 이미지 추가
yuj2n Jun 18, 2025
8be8ca2
✨feat: 대시보드 색상 공용화
yuj2n Jun 18, 2025
92075b8
🫧modify: 대시보드 색상 사용하던 곳 코드 수정
yuj2n Jun 18, 2025
24b3772
🎨style: 버튼 색상 추가
yuj2n Jun 18, 2025
3cf0bef
🫧modify: 헤더 너비 수정 및 프로필 이미지 왼쪽 보더 추가
yuj2n Jun 18, 2025
b71e8a7
🫧modify: 사용자 프로필 이미지 null 여부 추가
yuj2n Jun 18, 2025
a505111
🔧chore: 폴더 구조 변경 및 경로 축소를 위한 alias 설정 추가
yuj2n Jun 18, 2025
785028e
✨feat: 대시보드 수정 페이지 작성
yuj2n Jun 18, 2025
99978d3
✨feat: 사용자 정보 수정 컴포넌트 구현
yuj2n Jun 18, 2025
2d65361
✨feat: 구성원 수정 컴포넌트 구현
yuj2n Jun 18, 2025
5c2d252
✨feat: 초대하기 컴포넌트 구현
yuj2n Jun 18, 2025
542ed51
✨feat: 사용자 정보 임시 데이터 작성
yuj2n Jun 18, 2025
0184490
Merge branch 'feature/dashboard_modify-UI' of https://github.com/CoPl…
yuj2n Jun 18, 2025
d5d176a
🫧modify: 미사용 함수 import 제거
yuj2n Jun 18, 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
Binary file added public/images/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/invitation-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/prev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/app/dashboard/[id]/edit/components/EditInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function EditInfo() {
return <p>대시보드 수정 페이지</p>
}
3 changes: 3 additions & 0 deletions src/app/dashboard/[id]/edit/components/EditInvitation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function EditInvitation() {
return <p>대시보드 초대 수정 페이지</p>
}
3 changes: 3 additions & 0 deletions src/app/dashboard/[id]/edit/components/EditMember.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function EditMember() {
return <p>대시보드 멤버 수정 페이지</p>
}
29 changes: 21 additions & 8 deletions src/app/dashboard/[id]/edit/page.tsx
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()}

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() 이라는 함수가 존재합니다! 동작은 동일하지만 일관성을 위해서 해당 함수를 사용하는 게 좋을 거 같습니다! 공식 문서

import { useRouter } from 'next/navigation'

export default function Page() {
  const router = useRouter()

  return (
    <button type="button" onClick={() => router.back()}>
      Click here to go back
    </button>
  )
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

적용했습니다~

>
<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 src/app/features/dashboard/components/edit/EditInfo.tsx
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 src/app/features/dashboard/components/edit/EditInvitation.tsx
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>
)
}
48 changes: 48 additions & 0 deletions src/app/features/dashboard/components/edit/EditMember.tsx
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>
)
}
24 changes: 24 additions & 0 deletions src/app/features/dashboard/components/edit/mockMember.js
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,
},
]
3 changes: 3 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ body {
.Text-error {
@apply text-[#D6173A];
}
.Text-btn {
@apply text-[#5FBBFF] dark:text-[#228DFF];
}
.Border-error {
@apply border border-[#D6173A];
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/components/common/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Avatar } from './Avatar'

type UserInfoProps = {
nickname: string
imageUrl?: string
imageUrl?: string | null
size?: number
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/shared/components/common/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Header() {
const pathname = usePathname()

return (
<header className="BG-white Border-bottom Text-black w-full overflow-x-hidden border-b px-48 py-12">
<header className="BG-white Border-bottom Text-black w-full overflow-x-hidden border-b px-48 py-10">
<div className="flex w-full items-center justify-between pr-16">
{/* 좌측 대시보드명 */}
<div className="flex shrink-0 items-center gap-8 pr-16">
Expand Down Expand Up @@ -41,7 +41,7 @@ export default function Header() {
<Link
href="/modal"
className={cn(
'Border-btn mr-16 flex items-center gap-6 rounded-md border px-12 py-6',
'Border-btn mr-16 flex items-center gap-6 rounded-md px-12 py-6',
pathname === '/modal' && 'font-semibold',
)}
>
Expand All @@ -52,8 +52,8 @@ export default function Header() {
</Link>
</nav>
{/* 협업자 목록 */}
<CollaboratorList />|
<div className="flex items-center gap-32">
<CollaboratorList />
<div className="flex items-center gap-32 border-l pl-16">
{/* 사용자 정보 드롭다운 */}
<UserDropdown />
{/* 다크모드 토글 */}
Expand Down
Loading