Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/components/PieChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:options="options" />
<NoContent
v-else
content="데이터가 없습니다" />
content="집계된 데이터가 없습니다" />
</template>

<script setup lang="ts">
Expand Down
9 changes: 8 additions & 1 deletion src/components/TaskCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
@click="onTaskClick">
<div class="flex flex-col gap-1">
<div class="flex justify-between items-center gap-4">
<span class="text-black">{{ data.title }}</span>
<div class="flex items-center gap-2">
<TaskLabel
v-if="data.labelInfo"
:color="data.labelInfo.labelColor"
:content="data.labelInfo.labelName" />
<span class="text-black">{{ data.title }}</span>
</div>
<CommonIcons
v-if="draggable"
:name="bentoIcon" />
Expand Down Expand Up @@ -34,6 +40,7 @@ import { computed } from 'vue'
import type { TaskCardProps } from '@/types/manager'
import CommonIcons from './common/CommonIcons.vue'
import { statusAsColor } from '@/utils/statusAsColor'
import TaskLabel from './common/TaskLabel.vue'

const { data } = defineProps<{ data: TaskCardProps; draggable?: boolean }>()

Expand Down
17 changes: 17 additions & 0 deletions src/components/common/TaskLabel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<span
class="px-2 py-0.5 text-[10px] font-bold border-2 rounded-full whitespace-nowrap"
:style="{ borderColor, backgroundColor }">
{{ content }}
</span>
</template>

<script setup lang="ts">
import { COLOR_LIST } from '@/constants/common'

const { color, content } = defineProps<{ color: string; content: string }>()
const [borderColor, backgroundColor] = [
COLOR_LIST.find(el => el.colorEnum === color)?.borderColor,
COLOR_LIST.find(el => el.colorEnum === color)?.fillColor
]
</script>
5 changes: 1 addition & 4 deletions src/components/statistics/StatisticsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const changePeriod = (newPeriodType: PeriodType) => {

const fetchStatistics = async () => {
const response = await axiosInstance.get('/api/tasks/statistics', {
headers: {
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
},
params: {
periodType: periodType.value,
statisticsType
Expand All @@ -66,7 +63,7 @@ const fetchStatistics = async () => {
}

const { data } = useQuery<StatisticsData[]>({
queryKey: [statisticsType, periodType],
queryKey: computed(() => [statisticsType, periodType]),
Copy link
Contributor

Choose a reason for hiding this comment

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

기존의 경우엔 statisticsType, periodType이 바뀌어도 새로운 요청이 가지 않는건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

StatisticsCard의 경우 사실 기존의 코드도 정상적으로 작동했습니다.
statisticsType의 경우 애초에 변하지 않으며 periodType는 변해도 일단은 정상적으로 작동했지만,
StatisticsCategoryCard에서 해당 부분에서 변화를 감지하지 못 해 문제가 생겼다보니,
이후 혹시 모를 오작동에 대비해 동일하게 computed로 감싸주게 되었습니다.

비효율적일 수도 있지만, computed를 하나 사용하여 떨어지는 성능보다
혹시 모를 오작동을 사전에 방지하는 것이 더 큰 return 이라고 생각하여 함께 추가해두었습니다.

queryFn: fetchStatistics
})

Expand Down
10 changes: 2 additions & 8 deletions src/components/statistics/StatisticsCategoryCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ const changeMainCategory = (value: string) => (mainCategory.value = value)

const fetchMainStatistics = async () => {
const response = await axiosInstance.get('/api/tasks/statistics', {
headers: {
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
},
params: {
periodType: periodType.value,
statisticsType: 'REQUEST_BY_CATEGORY'
Expand All @@ -57,7 +54,7 @@ const fetchMainStatistics = async () => {
return response.data
}
const { data: mainData } = useQuery<StatisticsData[]>({
queryKey: ['REQUEST_BY_CATEGORY', periodType],
queryKey: computed(() => ['REQUEST_BY_CATEGORY', periodType]),
queryFn: fetchMainStatistics
})
const mainLabels = computed(() => {
Expand All @@ -69,9 +66,6 @@ const mainSeries = computed(() => {

const fetchSubStatistics = async () => {
const response = await axiosInstance.get('/api/tasks/statistics/subcategory', {
headers: {
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
},
params: {
periodType: periodType.value,
mainCategory: mainCategory.value
Expand All @@ -81,7 +75,7 @@ const fetchSubStatistics = async () => {
return response.data
}
const { data: subData } = useQuery<StatisticsData[]>({
queryKey: [mainCategory.value, periodType],
queryKey: computed(() => [mainCategory.value, periodType]),
queryFn: fetchSubStatistics,
enabled: computed(() => mainCategory.value !== '')
})
Expand Down
12 changes: 6 additions & 6 deletions src/components/task-board/TaskBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="flex flex-1 bg-primary2 rounded-t-lg">
<span class="text-xs font-bold text-body p-4">
검토 중 {{ data?.tasksPendingComplete.length }}
검토 중 {{ data?.tasksInProgress.length }}
</span>
</div>
<div class="flex flex-1 bg-primary2 rounded-t-lg">
Expand Down Expand Up @@ -47,7 +47,7 @@
<div class="flex-1 px-4 pb-4 bg-primary2 rounded-b-lg relative">
<div class="absolute top-0 left-0 px-4 w-full">
<div
v-if="data?.tasksPendingComplete.length === 0"
v-if="data?.tasksInProgress.length === 0"
class="w-full max-w-80 h-[130px] bg-white border border-dashed border-border-1 rounded-lg flex justify-center items-center">
<span class="whitespace-pre-wrap text-center text-sm font-bold text-disabled">
{{ '상태를 변경할 작업을\n끌어 놓으세요' }}
Expand All @@ -59,7 +59,7 @@
group="taskList"
item-key="task"
class="flex flex-col gap-4 h-full"
@change="event => onListChange(event, 'PENDING_COMPLETED')">
@change="event => onListChange(event, 'IN_REVIEWING')">
<template #item="{ element }">
<TaskCard
:key="element.taskId"
Expand Down Expand Up @@ -113,8 +113,8 @@ const queryClient = useQueryClient()
const statusToKey = (status: Status): keyof TaskCardList | undefined => {
if (status === 'IN_PROGRESS') {
return 'tasksInProgress'
} else if (status === 'PENDING_COMPLETED') {
return 'tasksPendingComplete'
} else if (status === 'IN_REVIEWING') {
return 'tasksInReviewing'
} else if (status === 'COMPLETED') {
return 'tasksCompleted'
}
Expand Down Expand Up @@ -172,6 +172,6 @@ const { data } = useQuery<TaskCardList>({
})

const tasksInProgress = computed(() => [...(data.value?.tasksInProgress || [])])
const tasksPendingComplete = computed(() => [...(data.value?.tasksPendingComplete || [])])
const tasksPendingComplete = computed(() => [...(data.value?.tasksInReviewing || [])])
const tasksCompleted = computed(() => [...(data.value?.tasksCompleted || [])])
</script>
2 changes: 1 addition & 1 deletion src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const TERM_LIST = [
]
export const TASK_STATUS_LIST: TaskStatusListTypes[] = [
{ value: 'IN_PROGRESS', content: '진행 중' },
{ value: 'PENDING_COMPLETED', content: '검토 중' },
{ value: 'IN_REVIEWING', content: '검토 중' },
{ value: 'COMPLETED', content: '완료' },
{ value: 'TERMINATED', content: '종료' }
]
Expand Down
2 changes: 1 addition & 1 deletion src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface ListBarTabProps {
justifyCenter?: boolean
}

export type Status = 'REQUESTED' | 'IN_PROGRESS' | 'PENDING_COMPLETED' | 'COMPLETED' | 'TERMINATED'
export type Status = 'REQUESTED' | 'IN_PROGRESS' | 'IN_REVIEWING' | 'COMPLETED' | 'TERMINATED'

export type SortDirection = 'DESC' | 'ASC'

Expand Down
2 changes: 1 addition & 1 deletion src/types/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface TaskCardProps {

export interface TaskCardList {
tasksInProgress: TaskCardProps[]
tasksPendingComplete: TaskCardProps[]
tasksInReviewing: TaskCardProps[]
tasksCompleted: TaskCardProps[]
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/statusAsColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Status } from '@/types/common'
const defaultColor = {
REQUESTED: 'gray',
IN_PROGRESS: 'blue',
PENDING_COMPLETED: 'orange',
IN_REVIEWING: 'orange',
COMPLETED: 'green',
TERMINATED: 'red'
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/statusAsText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Status } from '@/types/common'
const text = {
REQUESTED: '요청',
IN_PROGRESS: '진행 중',
PENDING_COMPLETED: '검토 중',
IN_REVIEWING: '검토 중',
COMPLETED: '완료',
TERMINATED: '종료'
}
Expand Down