Skip to content

Commit

Permalink
Merge pull request #130 from Weflo-A/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ymj07168 authored Mar 10, 2024
2 parents 69cefaf + aa4408f commit c993318
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 54 deletions.
70 changes: 33 additions & 37 deletions src/components/common/MenuTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,43 +234,39 @@ const MenuTab = ({ groups, drones, type }: MenuTabProps) => {
/* 대시보드 내 드론 리스트 탭 */
const renderDroneListTab = () => {
return (
<>
<TabWrapper>
<Typography
variant='body2'
fontWeight='bold'
sx={{ padding: '0rem 0.5rem', marginBottom: '0.5rem' }}
>
전체 드론
</Typography>
<Divider sx={{ margin: '0rem 0.5rem 0.5rem' }} />
<TabList>
{drones?.map((item) => (
<TabItem
className={
location.pathname.includes(`/drone/${item.id}`)
? 'active'
: ''
}
onClick={() =>
handleTabMenu(
isEstimatePage
? `/drone-group/drone/${item.id}/estimate`
: isTestDetailPage
? `/drone-group/drone/${item.id}/dashboard/test`
: `/drone-group/drone/${item.id}/dashboard`,
String(item.id)
)
}
>
<Typography fontSize='14px' fontWeight={400}>
{item.name}
</Typography>
</TabItem>
))}
</TabList>
</TabWrapper>
</>
<TabWrapper>
<Typography
variant='body2'
fontWeight='bold'
sx={{ padding: '0rem 0.5rem', marginBottom: '0.5rem' }}
>
전체 드론
</Typography>
<Divider sx={{ margin: '0rem 0.5rem 0.5rem' }} />
<TabList>
{drones?.map((item) => (
<TabItem
className={
location.pathname.includes(`/drone/${item.id}/`) ? 'active' : ''
}
onClick={() =>
handleTabMenu(
isEstimatePage
? `/drone-group/drone/${item.id}/estimate`
: isTestDetailPage
? `/drone-group/drone/${item.id}/dashboard/test`
: `/drone-group/drone/${item.id}/dashboard`,
String(item.id)
)
}
>
<Typography fontSize='14px' fontWeight={400}>
{item.name}
</Typography>
</TabItem>
))}
</TabList>
</TabWrapper>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/ResultRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function ResultRecord({ droneId, data }: ResultRecordProp) {
buttonType='accentLight'
onClick={(e) => {
e.stopPropagation();
goToDashboard(location.state); // data.id 필요
goToDashboard(droneId); // data.id 필요
}}
style={{ width: '95px', height: '32px', fontSize: '14px' }}
/>
Expand Down
30 changes: 14 additions & 16 deletions src/pages/TestDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,18 @@ const TestDetailPage = () => {
// 메뉴탭 이동시 id 변경
// 첫번째 날짜값으로 조회
React.useEffect(() => {
if (!testDate) {
getTestDateList(Number(id)).then((res) => {
setDateList(res.data.data);
if (res.data.data.length > 0) {
const { year, month, day } = res.data.data[0];
console.log('탭이동', year, month, day);
setSelectedDate(`${year}-${month}-${day}`);
getTestDetail(Number(id), year, month, day).then((res) => {
console.log(res.data.data);
setTestData(res.data.data);
});
}
});
}
getTestDateList(Number(id)).then((res) => {
setDateList(res.data.data);
if (res.data.data.length > 0) {
const { year, month, day } = res.data.data[0];
console.log('탭이동', year, month, day);
setSelectedDate(`${year}-${month}-${day}`);
getTestDetail(Number(id), year, month, day).then((res) => {
console.log(res.data.data);
setTestData(res.data.data);
});
}
});
}, [id]);

// id는 고정인채 날짜만 변경시
Expand Down Expand Up @@ -329,12 +327,12 @@ const TestDetailPage = () => {
</Typography>
</Stack>
<Stack direction='column' gap='0.25rem'>
{testData?.warningList.map((item) => (
{testData?.warningList.map((item, index) => (
<BrokenPartInfoBox
part={item.component}
location={item.part}
score={item.score}
warning={false}
warning={index < 2}
/>
))}
</Stack>
Expand Down

0 comments on commit c993318

Please sign in to comment.