Skip to content

Commit

Permalink
Merge pull request #159 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 a99fb74 + ddf47de commit e637553
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
50 changes: 28 additions & 22 deletions src/components/common/MenuTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import ItemContainer from 'src/components/common/ItemContainer';
import Button from 'src/components/common/Button';
import { Plus } from 'src/assets';
import { useLocation, useNavigate } from 'react-router-dom';
import GroupPopup from '../onboarding/GroupPopup';
import React from 'react';

//
//
Expand Down Expand Up @@ -63,6 +65,7 @@ const MenuTab = ({ groups, drones, type }: MenuTabProps) => {
const location = useLocation();
const isTestDetailPage = location.pathname.includes('/test');
const isEstimatePage = location.pathname.includes('/estimate');
const [isPopupOpen, setIsPopupOpen] = React.useState(false);

const handleTabMenu = (url: string, id?: string) => {
navigate(url, { state: id });
Expand Down Expand Up @@ -268,28 +271,31 @@ const MenuTab = ({ groups, drones, type }: MenuTabProps) => {
};

return (
<ItemContainer
style={{ minWidth: '12.5rem', position: 'fixed', marginTop: '3.25rem' }}
>
<TabContainer>
{type === 'monitoring' ? renderDroneSearchTab() : null}
{type === 'monitoring' ? renderDroneGroupTab() : null}
{type === 'dashboard' ? renderDroneListTab() : null}
{type === 'parts' ? renderPartsTab() : null}
{type === 'trade' ? renderTradeTab() : null}
{type === 'monitoring' ? (
<Button
text={
<>
<Plus /> 그룹 생성하기
</>
}
buttonType='accentLight'
onClick={() => alert('클릭')}
/>
) : null}
</TabContainer>
</ItemContainer>
<>
<ItemContainer
style={{ minWidth: '12.5rem', position: 'fixed', marginTop: '3.25rem' }}
>
<TabContainer>
{type === 'monitoring' ? renderDroneSearchTab() : null}
{type === 'monitoring' ? renderDroneGroupTab() : null}
{type === 'dashboard' ? renderDroneListTab() : null}
{type === 'parts' ? renderPartsTab() : null}
{type === 'trade' ? renderTradeTab() : null}
{type === 'monitoring' ? (
<Button
text={
<>
<Plus /> 그룹 생성하기
</>
}
buttonType='accentLight'
onClick={() => setIsPopupOpen(true)}
/>
) : null}
</TabContainer>
</ItemContainer>
{isPopupOpen && <GroupPopup onClose={() => setIsPopupOpen(false)} />}
</>
);
};

Expand Down
3 changes: 2 additions & 1 deletion src/pages/EstimatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ const EstimatePage = () => {
const sortedRepairCompanies = [...repairCompanies];
if (repairFilter === 'recommend') {
sortedRepairCompanies.sort(
(a, b) => b.features.length - a.features.length
(a, b) =>
[...new Set(b.features)].length - [...new Set(a.features)].length
);
} else if (repairFilter === 'price') {
sortedRepairCompanies.sort((a, b) => a.minPrice - b.minPrice);
Expand Down

0 comments on commit e637553

Please sign in to comment.