diff --git a/dashboard/app/globals.css b/dashboard/app/globals.css index 06c79bc..edf045d 100644 --- a/dashboard/app/globals.css +++ b/dashboard/app/globals.css @@ -480,6 +480,19 @@ a { padding: 0 24px; } +.loading-inline { + display: flex; + align-items: center; + gap: 8px; + padding: 10px 0; + font-size: 13px; + color: var(--md-on-surface-variant); +} + +.loading-inline .material-symbols-outlined { + font-size: 18px; +} + /* ===== Login ===== */ .login-container { min-height: 100vh; diff --git a/dashboard/app/page.tsx b/dashboard/app/page.tsx index 12377b2..c556966 100644 --- a/dashboard/app/page.tsx +++ b/dashboard/app/page.tsx @@ -1,12 +1,18 @@ 'use client'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useAuth } from '@/lib/auth-context'; import { useTenants } from '@/lib/hooks'; import { Card } from '@/components/Card'; import { api } from '@/lib/api'; -import { Tenant } from '@/lib/types'; +import type { Tenant } from '@/lib/types'; + +interface DigitalTwinCompany { + companyId: string; + name: string; + industryType: string; +} export default function HomePage() { const { user, logout } = useAuth(); @@ -25,6 +31,17 @@ export default function HomePage() { companyId: '', }); const [isSaving, setIsSaving] = useState(false); + const [dtCompanies, setDtCompanies] = useState([]); + const [companiesLoading, setCompaniesLoading] = useState(false); + + useEffect(() => { + if (!mappingModal.open) return; + setCompaniesLoading(true); + api.get<{ companies: DigitalTwinCompany[] }>('/api/admin/digital-twin/companies') + .then((res) => setDtCompanies(res.companies)) + .catch(() => setDtCompanies([])) + .finally(() => setCompaniesLoading(false)); + }, [mappingModal.open]); const handleTenantSelect = (tenantId: string) => { router.push(`/${tenantId}`); @@ -136,30 +153,30 @@ export default function HomePage() {
- - setMappingModal((prev) => ({ ...prev, companyId: e.target.value }))} - placeholder="회사 UUID (예: 7f5c058c-...)" - autoFocus - /> + + {companiesLoading ? ( +
+ progress_activity + 회사 목록 로딩 중... +
+ ) : ( + + )}
- {mappingModal.companyId && ( - - )}