[fix] negodata/front: 통계 카테고리별 절감 차트 -> 손해(음수)는 안보이게, 대시보드에서 일반관리자도 회사 통계 보이게 수정

This commit is contained in:
Mina Choi 2026-07-10 15:58:13 +09:00
parent b41f7c67f1
commit c0e6987c3c
2 changed files with 4 additions and 6 deletions

View File

@ -10,7 +10,8 @@ const config = {
} satisfies ChartConfig;
export function CategoryChart({ data }: { data: CategorySaving[] }) {
const rows = [...data].sort((a, b) => b.savings - a.savings);
// 절감 차트 — 순절감이 음수(손해)인 카테고리는 표시하지 않는다.
const rows = data.filter((r) => r.savings > 0).sort((a, b) => b.savings - a.savings);
return (
<ChartContainer config={config} className="aspect-auto h-56 w-full">

View File

@ -4,17 +4,14 @@ import { PageContainer } from '@/components/layout/PageContainer';
import { Typography } from '@/components/ui/typography';
import { DashboardHero, ScopeSection } from '@/features/dashboard';
import { OnboardingGuideModal } from '@/features/onboarding/OnboardingGuideModal';
import { useAuth } from '@/features/auth/useAuth';
import { useGetDashboardSummary } from '@/api/generated/dashboard/dashboard';
// 견적 생성~마감~선정을 한눈에 보는 대시보드.
// 회사 전체 스코프는 최고관리자만, 일반 사용자는 '내 견적'만 본다. 위젯 행은 클릭 시 견적 상세로 딥링크. 읽기 전용.
// 회사 전체·내 견적 두 스코프를 함께 보여준다(조회는 회사 공유). 위젯 행은 클릭 시 견적 상세로 딥링크. 읽기 전용.
const ONBOARDING_SEEN_KEY = 'negodata_onboarding_seen';
export default function DashboardPage() {
const navigate = useNavigate();
const { user } = useAuth();
const isOwner = user?.role === '최고관리자';
const { data, isLoading, isError } = useGetDashboardSummary();
const [guideOpen, setGuideOpen] = useState(false);
@ -38,7 +35,7 @@ export default function DashboardPage() {
<Typography variant="muted">대시보드를 불러오지 못했습니다.</Typography>
) : (
<>
{isOwner && <ScopeSection label="회사 전체 견적" scope={data.company} onOpen={openQuotation} />}
<ScopeSection label="회사 전체 견적" scope={data.company} onOpen={openQuotation} />
<ScopeSection label="내 견적" scope={data.mine} onOpen={openQuotation} />
</>
)}