Skip to content

Commit

Permalink
Merge pull request #64 from SUIN-BUNDANG-LINE/develop
Browse files Browse the repository at this point in the history
설문이용 v1.0.0 프론트엔드 배포 최종 수정본
  • Loading branch information
JeongHunHui authored Oct 2, 2024
2 parents cdf7f27 + bf8209c commit c2fd4f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/app/s/[surveyId]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function generateMetadata(
title,
openGraph: {
description,
images: [thumbnail, ...previousImages],
images: [thumbnail ?? '/path/to/default-image.png', ...previousImages], // thumbnail이 null인 경우 기본 이미지 사용
},
};
}
Expand Down
10 changes: 6 additions & 4 deletions src/components/management/result/PieChartComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ export default function PieChartComponent({ responses }: { responses: Response[]
callbacks: {
label: (context) => {
const value = context.parsed;
const total = context.chart.data.datasets[context.datasetIndex].data.reduce(
(acc: number, val: number) => acc + val,
0
);
const total = (context.chart.data.datasets[0].data as number[]).reduce((acc, val) => {
if (typeof val === 'number') {
return acc + val;
}
return acc;
}, 0);
const percentage = ((value / total) * 100).toFixed(1);
return ` ${value} (${percentage}%)`;
},
Expand Down
19 changes: 8 additions & 11 deletions src/components/mypage/SurveyCreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ export default function SurveyCreateButton() {
const mutation = useCreateSurvey();

async function createNewSurvey() {
mutation.mutate(
{},
{
onSuccess: (data) => {
nextRouter.push(`/workbench/${data.surveyId}`);
},
onError: (error) => {
showToast('error', (error.cause as ErrorCause).message);
},
}
);
mutation.mutate(undefined, {
onSuccess: (data) => {
nextRouter.push(`/workbench/${data.surveyId}`);
},
onError: (error) => {
showToast('error', (error.cause as ErrorCause).message);
},
});
}

return (
Expand Down

0 comments on commit c2fd4f8

Please sign in to comment.