-
Notifications
You must be signed in to change notification settings - Fork 2
develop <-- feature/dashboard_id #95
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
Changes from all commits
28122d5
1bcd962
39b8d7b
d237bfe
c0dbf8d
7573566
2b003df
83e718d
0c2a7fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export default function ColumnTitle({ title }: { title: string }) { | ||
| return ( | ||
| <div className="BG-lightblue flex w-fit items-center gap-6 rounded-16 px-10 py-4"> | ||
| <div className="size-6 rounded-25 bg-[#228DFF]"></div> | ||
| <div className="Text-deepblue pb-4 pt-6 text-14 font-medium leading-none"> | ||
| {title} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Avatar } from '@/app/shared/components/common/Avatar' | ||
|
|
||
| import { Assignee } from '../type/Card.type' | ||
|
|
||
| export default function MyAssignee({ assignee }: { assignee: Assignee }) { | ||
| return ( | ||
| <div className="flex items-center gap-6"> | ||
| <Avatar | ||
| size={26} | ||
| name={assignee.nickname} | ||
| imageUrl={assignee.profileImageUrl} | ||
| /> | ||
| <span className="regular Text-black block pt-1 text-16 leading-none"> | ||
| {assignee.nickname} | ||
| </span> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,23 +1,39 @@ | ||||||||||||||||
| import { useTheme } from 'next-themes' | ||||||||||||||||
|
|
||||||||||||||||
| import { getColor } from '@/app/shared/lib/getColor' | ||||||||||||||||
|
|
||||||||||||||||
| export default function Tags({ tags }: { tags: string[] }) { | ||||||||||||||||
| //ํ๊ทธ ์ปฌ๋ฌ - ๋๋ค ๋ฐฐ์ | ||||||||||||||||
| //์นด๋ ์์ฑ ์ - ๋์ผ ํ๊ทธ ์ ๋ ฅ ๋ถ๊ฐํ๋๋ก | ||||||||||||||||
| const bgColors = ['#F9EEE3', '#E7F7DB', '#F7DBF0', '#DBE6F7'] | ||||||||||||||||
| const bgColorsDark = ['#774212', '#366712', '#711E5C', '#0F3167'] | ||||||||||||||||
| const textColors = ['#D58D49', '#86D549', '#D549B6', '#4981D5'] | ||||||||||||||||
|
|
||||||||||||||||
| const { resolvedTheme } = useTheme() | ||||||||||||||||
| const isDark = resolvedTheme === 'dark' | ||||||||||||||||
|
|
||||||||||||||||
| return ( | ||||||||||||||||
| <div className="flex flex-wrap gap-6"> | ||||||||||||||||
| {tags.map((tag) => { | ||||||||||||||||
| const colorIndex = getColor(tag, bgColors.length) | ||||||||||||||||
| // const colorIndex = getColor(tag, bgColors.length) | ||||||||||||||||
| // getColorsํจ์ ์ฌ์ฉํ๋ฉด NaN๊ฐ์ด ๋ ์ ์๋์ ์ํจ.. ์๋ ๋ฌธ์ ์์๋๋ฐ ์ด์ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์. | ||||||||||||||||
| const hash = tag | ||||||||||||||||
| .split('') | ||||||||||||||||
| .reduce((acc, char) => acc + char.charCodeAt(0), 0) | ||||||||||||||||
| const colorIndex = hash % 4 | ||||||||||||||||
|
Comment on lines
+18
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐ ๏ธ Refactor suggestion getColor ํจ์ ๋ฌธ์ ์ ๊ทผ๋ณธ ์์ธ์ ํด๊ฒฐํ์ธ์. ์ฃผ์์์ ์ธ๊ธํ getColor ํจ์์ NaN ๋ฌธ์ ๋ฅผ ๊ทผ๋ณธ์ ์ผ๋ก ํด๊ฒฐํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค. ํ์ฌ ์ธ๋ผ์ธ์ผ๋ก ๊ตฌํํ ํด์ ๊ณ์ฐ์ getColor ํจ์์ ๋์ผํ ๋ก์ง์ ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ ์ ์์ต๋๋ค: - // const colorIndex = getColor(tag, bgColors.length)
- // getColorsํจ์ ์ฌ์ฉํ๋ฉด NaN๊ฐ์ด ๋ ์ ์๋์ ์ํจ.. ์๋ ๋ฌธ์ ์์๋๋ฐ ์ด์ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์.
- const hash = tag
- .split('')
- .reduce((acc, char) => acc + char.charCodeAt(0), 0)
- const colorIndex = hash % 4
+ const colorIndex = getColor(tag, bgColors.length)getColor ํจ์์ NaN ๋ฌธ์ ๋ฅผ ๋จผ์ ๋๋ฒ๊น ํ์ฌ ํด๊ฒฐํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| const backgroundColor = isDark | ||||||||||||||||
| ? bgColorsDark[colorIndex] | ||||||||||||||||
| : bgColors[colorIndex] | ||||||||||||||||
| const textColor = isDark ? bgColors[colorIndex] : textColors[colorIndex] | ||||||||||||||||
|
|
||||||||||||||||
| return ( | ||||||||||||||||
| <span | ||||||||||||||||
| key={tag} | ||||||||||||||||
| className="inline-block whitespace-nowrap rounded-4 px-9 pb-3 pt-5" | ||||||||||||||||
| style={{ | ||||||||||||||||
| backgroundColor: bgColors[colorIndex], | ||||||||||||||||
| color: textColors[colorIndex], | ||||||||||||||||
| backgroundColor: backgroundColor, | ||||||||||||||||
| color: textColor, | ||||||||||||||||
| }} | ||||||||||||||||
| > | ||||||||||||||||
| {tag} | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { useTheme } from 'next-themes' | ||
|
|
||
| import { getColor } from '@/app/shared/lib/getColor' | ||
|
|
||
| export default function TagsCanDelete({ | ||
| tags, | ||
| setTags, | ||
| }: { | ||
| tags: string[] | ||
| setTags: React.Dispatch<React.SetStateAction<string[]>> | ||
| }) { | ||
| //ํ๊ทธ ์ปฌ๋ฌ - ๋๋ค ๋ฐฐ์ | ||
| //์นด๋ ์์ฑ ์ - ๋์ผ ํ๊ทธ ์ ๋ ฅ ๋ถ๊ฐํ๋๋ก | ||
| const bgColors = ['#F9EEE3', '#E7F7DB', '#F7DBF0', '#DBE6F7'] | ||
| const textColors = ['#D58D49', '#86D549', '#D549B6', '#4981D5'] | ||
|
|
||
| const { resolvedTheme } = useTheme() | ||
| const isDark = resolvedTheme === 'dark' | ||
|
|
||
| return ( | ||
| <div className="flex flex-wrap gap-6"> | ||
| {tags.map((tag) => { | ||
| const hash = tag | ||
| .split('') | ||
| .reduce((acc, char) => acc + char.charCodeAt(0), 0) | ||
| const colorIndex = hash % 4 | ||
|
|
||
| const backgroundColor = isDark | ||
| ? textColors[colorIndex] | ||
| : bgColors[colorIndex] | ||
| const textColor = isDark ? bgColors[colorIndex] : textColors[colorIndex] | ||
|
|
||
| return ( | ||
| <span | ||
| key={tag} | ||
| className="inline-block whitespace-nowrap rounded-4 px-9 pb-3 pt-5" | ||
| style={{ | ||
| backgroundColor: backgroundColor, | ||
| color: textColor, | ||
| }} | ||
| onClick={() => setTags(tags.filter((t) => t !== tag))} | ||
| > | ||
| {tag} | ||
| </span> | ||
| ) | ||
| })} | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { ControllerRenderProps } from 'react-hook-form' | ||
|
|
||
| import { cn } from '@/app/shared/lib/cn' | ||
|
|
||
| import { SimpleColumn, useColumnsStore } from '../../store/useColumnsStore' | ||
| import { CardFormData } from '../../type/CardFormData.type' | ||
| import ColumnTitle from '../ColumnTitle' | ||
|
|
||
| interface ColumnListProps { | ||
| setColumn: (selectedColumn: SimpleColumn) => void | ||
| controlField: ControllerRenderProps<CardFormData, 'columnId'> | ||
| } | ||
|
|
||
| // โ ColumnList ์ปดํฌ๋ํธ: ์ปฌ๋ผ ๋ชฉ๋ก์ ๋ณด์ฌ์ฃผ๋ ๋๋กญ๋ค์ด ๋ฆฌ์คํธ | ||
| // 1. ์ปฌ๋ผ ๋ชฉ๋ก์ ํด๋ฆญํ๋ฉด: | ||
| // - setColumn(column) ์คํ โ ์ ํ๋ ๋ด๋น์ ๊ฐ์ฒด๋ฅผ ๋ถ๋ชจ ์ปดํฌ๋ํธ ํ์ ๊ด๋ฆฌ (ex. UI์์ ๋๋ค์ ํ์์ฉ) | ||
| // - controlField.onChange(column.columnId) ์คํ โ react-hook-form์ columnId ๊ฐ์ ์ ๋ฌ (form ์ ์ถ์๋ Id ๋ฐ์ดํฐ๋ง ์ ๋ฌํจ) | ||
|
|
||
| export default function ColumnList({ | ||
| setColumn, | ||
| controlField, | ||
| }: ColumnListProps) { | ||
| const { ColumnsInDashboard } = useColumnsStore() // ์ปฌ๋ผ ๋ชฉ๋ก ๋ฐ์ดํฐ๋ store์์ ๋ถ๋ฌ์ด | ||
|
|
||
| return ( | ||
| <div className="BG-white Border-btn absolute left-0 top-full z-10 mt-4 w-full rounded-6"> | ||
| {ColumnsInDashboard.map((column, index) => ( | ||
| <div | ||
| className={cn( | ||
| 'BG-Input-hovered w-full cursor-pointer px-16 py-11 pt-14 placeholder-gray-400 caret-transparent', | ||
| index !== 0 && 'border-t', | ||
| )} | ||
| key={column.columnId} | ||
| onClick={() => { | ||
| setColumn(column) // ๋ด๋น์ ์ ๋ฐ์ดํธ | ||
| controlField.onChange(column.columnId) // controlField: ํผ์ 'columnId' ํ๋์ ์ฐ๊ฒฐ๋์ด ์์. .columnId ๊ฐ์ผ๋ก ์ ๋ฐ์ดํธ | ||
| }} | ||
| > | ||
| <ColumnTitle title={column.columnTitle} /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ) | ||
| } |
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.
๐ ๏ธ Refactor suggestion
๋๋๊ทธ์ ํด๋ฆญ ์ด๋ฒคํธ ์ถฉ๋์ ๋ฐฉ์งํ์ธ์.
์นด๋์ ๋๋๊ทธ ๊ธฐ๋ฅ๊ณผ ํด๋ฆญ ์ด๋ฒคํธ๊ฐ ๋ชจ๋ ์์ด์ ์๋ํ์ง ์์ ๋ชจ๋ฌ ์ด๋ฆผ์ด ๋ฐ์ํ ์ ์์ต๋๋ค.
๋๋ ๋ ์ ๊ตํ ์ฒ๋ฆฌ๋ฅผ ์ํด ๋๋๊ทธ ์์/์ข ๋ฃ ์ํ๋ฅผ ์ถ์ ํ๋ ๋ก์ง์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
๐ค Prompt for AI Agents