Compare commits
250
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c580141b71 | ||
|
|
5cb0719297 | ||
|
|
1b6fb6f77d | ||
|
|
5e5678f005 | ||
|
|
bbca5ac6f2 | ||
|
|
b8ff15f187 | ||
|
|
049ea098d0 | ||
|
|
70b941c081 | ||
|
|
f528c0e893 | ||
|
|
f5f2a8f675 | ||
|
|
21878892dc | ||
|
|
112634a8e3 | ||
|
|
64d33bec6d | ||
|
|
4b1dd416b5 | ||
|
|
6d28936a35 | ||
|
|
aca6e249b4 | ||
|
|
1dee2c4200 | ||
|
|
f2be91986c | ||
|
|
fa64855574 | ||
|
|
df7a66b2c7 | ||
|
|
e7f4da2322 | ||
|
|
c551481c5b | ||
|
|
b0f71f2239 | ||
|
|
688ec0f88f | ||
|
|
3efac843d4 | ||
|
|
3ed8b4ed6c | ||
|
|
2042076597 | ||
|
|
7088540ccc | ||
|
|
c279124c41 | ||
|
|
fc03a19da1 | ||
|
|
e566bc087b | ||
|
|
90eb5f3b04 | ||
|
|
7b9db8d879 | ||
|
|
b1d556c6ee | ||
|
|
5e01305922 | ||
|
|
8015dc4b93 | ||
|
|
bb6274ef12 | ||
|
|
2805e382b3 | ||
|
|
df4f3b296b | ||
|
|
42632d96ad | ||
|
|
a73265eac6 | ||
|
|
1a82d549f5 | ||
|
|
28681969e2 | ||
|
|
f5f0f67798 | ||
|
|
cbee407911 | ||
|
|
cc291243b0 | ||
|
|
11ecd90d13 | ||
|
|
57904427cf | ||
|
|
5372ef9d9c | ||
|
|
214bd9db4d | ||
|
|
7423b778ee | ||
|
|
4bd67fcbb3 | ||
|
|
ce0e6e9d99 | ||
|
|
ca324251ad | ||
|
|
41504e6e0f | ||
|
|
b40a974ba3 | ||
|
|
5f11b39810 | ||
|
|
f706f07bc5 | ||
|
|
c987f6beed | ||
|
|
4bcda65c05 | ||
|
|
3f12cfd8c3 | ||
|
|
abfa231493 | ||
|
|
601e99fbd5 | ||
|
|
c7b22b3e95 | ||
|
|
a57c1a4a5c | ||
|
|
7cb1a9ab6f | ||
|
|
c86dd2bb9e | ||
|
|
dc8006899e | ||
|
|
6e50514096 | ||
|
|
863634ea6a | ||
|
|
fcd5f215e8 | ||
|
|
645a7db2e5 | ||
|
|
fe930d4773 | ||
|
|
b2d528dc78 | ||
|
|
a7c4d251a2 | ||
|
|
edf0d30b95 | ||
|
|
bb8e3e5456 | ||
|
|
2ee400c9bb | ||
|
|
a46b185c16 | ||
|
|
c9c8a7ff62 | ||
|
|
1728d1879c | ||
|
|
bdd3708fde | ||
|
|
6c76f9a810 | ||
|
|
36e7c6cfee | ||
|
|
c3b5c5d0cd | ||
|
|
ca7002f3bb | ||
|
|
9642680909 | ||
|
|
6eb8a3baac | ||
|
|
4e404abad3 | ||
|
|
5e56999c68 | ||
|
|
45fd44aa01 | ||
|
|
57b16653d4 | ||
|
|
4dcd422815 | ||
|
|
4a8c748095 | ||
|
|
01f1076a5d | ||
|
|
58fee673ce | ||
|
|
9567d7f7ce | ||
|
|
11cf1bf7c9 | ||
|
|
0818b63cdc | ||
|
|
14f2aab0be | ||
|
|
72f5fdd7a8 | ||
|
|
96db2b4ed4 | ||
|
|
f9a1af43f5 | ||
|
|
b711dae3ed | ||
|
|
512c39cd46 | ||
|
|
cb8743ea39 | ||
|
|
0b46ba36dc | ||
|
|
53356228a7 | ||
|
|
59e3dd0804 | ||
|
|
165c7bcbbf | ||
|
|
3d11a8be21 | ||
|
|
daaff4a4ca | ||
|
|
a3270acd29 | ||
|
|
3184ea4386 | ||
|
|
13fad0c692 | ||
|
|
9181ec192d | ||
|
|
f993a4a13e | ||
|
|
630c9492cd | ||
|
|
c57c7ce1f7 | ||
|
|
d320d96edf | ||
|
|
a32a1ac003 | ||
|
|
908ec81fb7 | ||
|
|
43bbc81616 | ||
|
|
80510adb8e | ||
|
|
ee2301470a | ||
|
|
bb778b6dc0 | ||
|
|
1bc03d99c6 | ||
|
|
dc64095e76 | ||
|
|
414a69c6ad | ||
|
|
4c86f7f3a5 | ||
|
|
685ba15baa | ||
|
|
80036ed876 | ||
|
|
2cf241236e | ||
|
|
f5320259b9 | ||
|
|
b5ecfdf3f8 | ||
|
|
57afe5dc5c | ||
|
|
5fb7a83de8 | ||
|
|
3fdc459b16 | ||
|
|
96bd0185b3 | ||
|
|
980c4f1c9f | ||
|
|
76bb48aacd | ||
|
|
af12aa0718 | ||
|
|
1970a8d632 | ||
|
|
8269b31b42 | ||
|
|
d8d0207891 | ||
|
|
f575e3b677 | ||
|
|
6b28c4e332 | ||
|
|
6ae792c3e2 | ||
|
|
5f42eb080e | ||
|
|
1d73da316c | ||
|
|
5446a8a656 | ||
|
|
7662e80eba | ||
|
|
e610b3b8e8 | ||
|
|
9d6902f521 | ||
|
|
b6e11b4be4 | ||
|
|
969d24736d | ||
|
|
bf577ddc81 | ||
|
|
d731a3fc5b | ||
|
|
dabdf5739a | ||
|
|
f09028a7ea | ||
|
|
57e8e4c8d6 | ||
|
|
8c384a51ce | ||
|
|
c8a66d2e53 | ||
|
|
42a99708a3 | ||
|
|
d8d704aec1 | ||
|
|
d225e9fcac | ||
|
|
de6bb04927 | ||
|
|
5f639a2fa9 | ||
|
|
d8c908b68e | ||
|
|
3a1b22b57b | ||
|
|
9ef58ef153 | ||
|
|
a8948fd1f3 | ||
|
|
56a9218210 | ||
|
|
38bbce9ea1 | ||
|
|
9d7ceb69b1 | ||
|
|
3fb1fe870b | ||
|
|
ff2b79aaa6 | ||
|
|
f3ba3d9b31 | ||
|
|
bffa8fbc11 | ||
|
|
3e8f55bee5 | ||
|
|
64e7a1f43f | ||
|
|
dd849958c0 | ||
|
|
dde92cf779 | ||
|
|
ec14773409 | ||
|
|
6b92d0630a | ||
|
|
6b4dd6aba7 | ||
|
|
97a67bfd55 | ||
|
|
0556245d62 | ||
|
|
0a52b6c507 | ||
|
|
ac24ebff40 | ||
|
|
45ad5eb5eb | ||
|
|
727d448dc5 | ||
|
|
90ebabd5bd | ||
|
|
0eeac7512b | ||
|
|
a5aa6bfdf4 | ||
|
|
0292353c24 | ||
|
|
9eb0cd428b | ||
|
|
3fed584ec4 | ||
|
|
451d25666a | ||
|
|
63afdfc726 | ||
|
|
cb442bfc13 | ||
|
|
64fcc423b5 | ||
|
|
c72b2c3f58 | ||
|
|
fe3e6de085 | ||
|
|
ff5b43e1d2 | ||
|
|
3772cd6edd | ||
|
|
fd6b008b80 | ||
|
|
c5fbd6e6f3 | ||
|
|
409e755e7d | ||
|
|
c957c2ff8d | ||
|
|
6dae2896d7 | ||
|
|
fa21387c55 | ||
|
|
ec59447db9 | ||
|
|
9cd3ce9f63 | ||
|
|
f0dcccaee9 | ||
|
|
cf825ef3ad | ||
|
|
a85fb848f7 | ||
|
|
d3bd1b5721 | ||
|
|
485b041f97 | ||
|
|
55aaee8983 | ||
|
|
c6cf6e90c3 | ||
|
|
b6ca669c2e | ||
|
|
5e1a5c68c8 | ||
|
|
690bca4c06 | ||
|
|
5600ce01bd | ||
|
|
93e652a557 | ||
|
|
cc3c5c5d68 | ||
|
|
2a473c85db | ||
|
|
1a5b000b02 | ||
|
|
2b76e21de5 | ||
|
|
f812e021b4 | ||
|
|
4cfe33bdc7 | ||
|
|
25a53f8162 | ||
|
|
4f0a8374e7 | ||
|
|
f402961de7 | ||
|
|
ec250bded1 | ||
|
|
8e7baee930 | ||
|
|
c30bbbd263 | ||
|
|
c2de582b76 | ||
|
|
8d0a79063e | ||
|
|
f51f6e58d8 | ||
|
|
103efe79d3 | ||
|
|
8fa00797c8 | ||
|
|
cb29ac6c4d | ||
|
|
b6a75f6ee0 | ||
|
|
842ec36c32 | ||
|
|
be21ea3e8a | ||
|
|
4b883a30c5 | ||
|
|
37e3b6ebdb | ||
|
|
ca83ac22aa |
+8
-4
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
node_modules/
|
node_modules/
|
||||||
|
.idea/
|
||||||
# build
|
|
||||||
.next/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# build
|
# build
|
||||||
.next
|
.next
|
||||||
@@ -22,7 +19,14 @@ apps/fo/.next/**/*
|
|||||||
#.env*
|
#.env*
|
||||||
.qodo
|
.qodo
|
||||||
|
|
||||||
|
# next-agents-md
|
||||||
|
.next-docs/
|
||||||
|
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
settings.json
|
settings.json
|
||||||
.npmrc
|
.npmrc
|
||||||
.cursor
|
.cursor
|
||||||
|
.agent
|
||||||
|
|
||||||
|
apps/**/tsconfig.tsbuildinfo
|
||||||
|
logs/
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
if [ "$BRANCH" != "main" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Branch: $BRANCH"
|
||||||
|
echo "Changed packages (dry-run):"
|
||||||
|
pnpm turbo run build --filter="...[origin/$BRANCH]" --dry-run
|
||||||
|
echo "Starting build..."
|
||||||
pnpm turbo run build --filter="...[origin/$BRANCH]"
|
pnpm turbo run build --filter="...[origin/$BRANCH]"
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# apps/as/shared/config/env.ts 참고
|
||||||
|
NEXT_PUBLIC_PORT=
|
||||||
|
NEXT_PUBLIC_PROXY_HOST=
|
||||||
|
NEXT_PUBLIC_SITE_ID=
|
||||||
|
NEXT_PUBLIC_SERVER_API_URL=
|
||||||
|
|
||||||
|
# 401 시 브라우저 리다이렉트 대상
|
||||||
|
NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL=/auth/login
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "next/core-web-vitals"
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
.yarn/install-state.gz
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# next.js
|
||||||
|
/.next/
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
next-env.d.ts
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"semi": true,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"singleQuote": false,
|
||||||
|
"printWidth": 100,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"plugins": ["prettier-plugin-tailwindcss"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
# AS Application
|
||||||
|
|
||||||
|
Next.js 애플리케이션 with FSD(Feature Sliced Design) 아키텍처
|
||||||
|
|
||||||
|
## 기술 스택
|
||||||
|
|
||||||
|
- **프레임워크**: Next.js 15 + TypeScript
|
||||||
|
- **스타일링**: Tailwind CSS
|
||||||
|
- **상태관리**: Zustand
|
||||||
|
- **데이터 페칭**: TanStack Query (React Query)
|
||||||
|
- **폼 관리**: React Hook Form + Zod
|
||||||
|
- **테이블**: TanStack Table
|
||||||
|
- **HTTP 클라이언트**: Axios
|
||||||
|
- **날짜 처리**: Day.js
|
||||||
|
|
||||||
|
## 프로젝트 구조 (FSD)
|
||||||
|
|
||||||
|
이 프로젝트는 **Feature-Sliced Design v2.1**을 따르며, 계층적 아키텍처로 구성되어 있습니다.
|
||||||
|
|
||||||
|
```
|
||||||
|
as/
|
||||||
|
├── app/ # App 레이어 (Next.js App Router)
|
||||||
|
│ ├── (routes)/ # 라우트 구조
|
||||||
|
│ ├── layout.tsx # 루트 레이아웃
|
||||||
|
│ ├── page.tsx # 홈 페이지
|
||||||
|
│ ├── globals.css # 글로벌 스타일
|
||||||
|
│ └── providers.tsx # 전역 providers
|
||||||
|
│
|
||||||
|
├── widgets/ # Widgets 레이어
|
||||||
|
│ └── [widget-name]/ # 큰 독립적 UI 블록 (여러 페이지에서 재사용)
|
||||||
|
│ ├── ui/
|
||||||
|
│ ├── model/
|
||||||
|
│ └── index.ts
|
||||||
|
│
|
||||||
|
├── features/ # Features 레이어
|
||||||
|
│ └── [feature-name]/ # 사용자 상호작용 기능 (여러 페이지에서 재사용)
|
||||||
|
│ ├── ui/
|
||||||
|
│ ├── api/
|
||||||
|
│ ├── model/
|
||||||
|
│ └── index.ts
|
||||||
|
│
|
||||||
|
├── entities/ # Entities 레이어
|
||||||
|
│ └── [entity-name]/ # 비즈니스 엔티티 (User, Product 등)
|
||||||
|
│ ├── model/
|
||||||
|
│ ├── api/
|
||||||
|
│ ├── ui/
|
||||||
|
│ └── index.ts
|
||||||
|
│
|
||||||
|
└── shared/ # Shared 레이어
|
||||||
|
├── ui/ # UI Kit (비즈니스 로직 없는 공통 컴포넌트)
|
||||||
|
├── api/ # API 클라이언트 설정
|
||||||
|
├── lib/ # 내부 라이브러리 (dates, colors 등)
|
||||||
|
├── config/ # 환경 설정, feature flags
|
||||||
|
├── types/ # 공통 타입 정의
|
||||||
|
└── routes/ # 라우트 상수
|
||||||
|
```
|
||||||
|
|
||||||
|
### 계층 구조 이해하기
|
||||||
|
|
||||||
|
FSD는 **3단계 계층**으로 구성됩니다:
|
||||||
|
|
||||||
|
1. **Layers (레이어)**: 책임과 의존성에 따른 수평적 분리 (app, pages, widgets, features, entities, shared)
|
||||||
|
2. **Slices (슬라이스)**: 비즈니스 도메인에 따른 수직적 분리 (user, product, auth-login 등)
|
||||||
|
3. **Segments (세그먼트)**: 기술적 목적에 따른 분리 (ui, api, model, lib 등)
|
||||||
|
|
||||||
|
> 📚 각 레이어의 자세한 설명은 해당 폴더의 README.md를 참고하세요.
|
||||||
|
|
||||||
|
## FSD 레이어 설명
|
||||||
|
|
||||||
|
FSD는 계층적 아키텍처로, 각 레이어는 책임의 범위와 의존성의 정도에 따라 구분됩니다. 7개의 표준화된 레이어가 있으며, 프로젝트에 필요한 레이어만 사용하면 됩니다.
|
||||||
|
|
||||||
|
### 레이어 계층 구조 (위에서 아래로)
|
||||||
|
|
||||||
|
```
|
||||||
|
app/ ↑ 가장 높은 책임, 가장 많은 의존성
|
||||||
|
pages/ |
|
||||||
|
widgets/ |
|
||||||
|
features/ |
|
||||||
|
entities/ |
|
||||||
|
shared/ ↓ 가장 낮은 책임, 의존성 없음
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1. App
|
||||||
|
- **목적**: 앱 전체에 영향을 주는 기술적/비즈니스적 사항
|
||||||
|
- **내용**: Context providers, 글로벌 스타일, 스토어 설정, 라우터 설정, 애널리틱스
|
||||||
|
- **특징**: 슬라이스가 없고 세그먼트로만 구성
|
||||||
|
- **의존성**: 모든 하위 레이어 사용 가능
|
||||||
|
|
||||||
|
### 2. Pages (app 디렉토리)
|
||||||
|
- **목적**: 웹사이트나 애플리케이션을 구성하는 페이지/화면
|
||||||
|
- **내용**: 페이지 UI, 로딩 상태, 에러 바운더리, 데이터 fetching
|
||||||
|
- **특징**: 한 페이지당 한 슬라이스 (유사한 페이지는 그룹화 가능)
|
||||||
|
- **의존성**: `widgets`, `features`, `entities`, `shared` 사용 가능
|
||||||
|
|
||||||
|
> 💡 **FSD v2.1 권장사항**: "pages-first" 접근 방식을 따라, 재사용되지 않는 큰 UI 블록과 비즈니스 로직은 페이지 슬라이스에 유지하세요.
|
||||||
|
|
||||||
|
### 3. Widgets
|
||||||
|
- **목적**: 큰 규모의 독립적인 UI 블록
|
||||||
|
- **내용**: 여러 features와 entities를 조합한 복합 UI
|
||||||
|
- **사용 시기**: 여러 페이지에서 재사용되거나, 페이지에 여러 개의 큰 독립적 블록이 있을 때
|
||||||
|
- **의존성**: `features`, `entities`, `shared` 사용 가능 (다른 `widgets` 불가)
|
||||||
|
|
||||||
|
### 4. Features
|
||||||
|
- **목적**: 사용자가 수행하는 주요 상호작용과 비즈니스 기능
|
||||||
|
- **내용**: 사용자 시나리오 (예: 로그인, 상품 검색, 댓글 작성)
|
||||||
|
- **사용 시기**: 여러 페이지에서 재사용되는 기능
|
||||||
|
- **의존성**: `entities`, `shared` 사용 가능 (다른 `features` 불가)
|
||||||
|
|
||||||
|
### 5. Entities
|
||||||
|
- **목적**: 비즈니스가 다루는 실제 개념 (User, Product, Order 등)
|
||||||
|
- **내용**: 데이터 모델, 타입, API 요청, 엔티티의 시각적 표현
|
||||||
|
- **특징**: 비즈니스 용어로 명명
|
||||||
|
- **의존성**: 다른 `entities`, `shared` 사용 가능
|
||||||
|
|
||||||
|
### 6. Shared
|
||||||
|
- **목적**: 애플리케이션의 기반 제공
|
||||||
|
- **내용**: API 클라이언트, UI Kit, 유틸리티 라이브러리, 글로벌 설정
|
||||||
|
- **특징**: 비즈니스 로직 없음, 슬라이스가 없고 세그먼트로만 구성
|
||||||
|
- **의존성**: 외부 라이브러리만 사용 가능 (다른 레이어 불가)
|
||||||
|
|
||||||
|
## 레이어 간 Import 규칙
|
||||||
|
|
||||||
|
> **핵심 규칙**: 슬라이스 내의 모듈(파일)은 **오직 하위 레이어**에 있는 다른 슬라이스만 import할 수 있습니다.
|
||||||
|
|
||||||
|
예시:
|
||||||
|
- `features/auth-login/ui/form.tsx`는 `entities/user`와 `shared/ui`를 import 가능
|
||||||
|
- 하지만 다른 `features/post-create`나 상위 레이어인 `widgets`는 import 불가
|
||||||
|
- 같은 슬라이스 내부(`features/auth-login/`)의 다른 파일들은 자유롭게 import 가능
|
||||||
|
|
||||||
|
## Public API 규칙
|
||||||
|
|
||||||
|
> **슬라이스 외부의 모듈은 슬라이스의 Public API만 참조할 수 있으며, 내부 파일 구조에 직접 접근할 수 없습니다.**
|
||||||
|
|
||||||
|
모든 슬라이스(및 슬라이스가 없는 레이어의 세그먼트)는 반드시 `index.ts`를 통해 Public API를 정의해야 합니다.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// ✅ 올바른 import
|
||||||
|
import { LoginForm } from 'features/auth-login';
|
||||||
|
|
||||||
|
// ❌ 잘못된 import (내부 구조 직접 접근)
|
||||||
|
import { LoginForm } from 'features/auth-login/ui/login-form';
|
||||||
|
```
|
||||||
|
|
||||||
|
## 시작하기
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 의존성 설치
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
# 개발 서버 실행
|
||||||
|
pnpm run dev
|
||||||
|
|
||||||
|
# 프로덕션 빌드
|
||||||
|
pnpm run build
|
||||||
|
|
||||||
|
# 프로덕션 서버 실행
|
||||||
|
pnpm start
|
||||||
|
```
|
||||||
|
|
||||||
|
## 환경 변수
|
||||||
|
|
||||||
|
`.env.local` 파일 생성:
|
||||||
|
|
||||||
|
```env
|
||||||
|
NEXT_PUBLIC_API_URL=http://localhost:3000/api
|
||||||
|
```
|
||||||
|
|
||||||
|
## FSD 핵심 규칙
|
||||||
|
|
||||||
|
### 1. Import 규칙
|
||||||
|
|
||||||
|
> **슬라이스 내의 모듈(파일)은 오직 하위 레이어에 있는 슬라이스만 import할 수 있습니다.**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// ✅ 올바른 import (하위 레이어)
|
||||||
|
// features/auth-login/ui/form.tsx
|
||||||
|
import { User } from 'entities/user';
|
||||||
|
import { Button } from 'shared/ui/button';
|
||||||
|
|
||||||
|
// ❌ 잘못된 import (같은 레이어)
|
||||||
|
// features/auth-login/ui/form.tsx
|
||||||
|
import { PostForm } from 'features/post-create'; // 금지!
|
||||||
|
|
||||||
|
// ❌ 잘못된 import (상위 레이어)
|
||||||
|
// features/auth-login/ui/form.tsx
|
||||||
|
import { Header } from 'widgets/header'; // 금지!
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Public API 규칙
|
||||||
|
|
||||||
|
> **슬라이스 외부에서는 Public API(index.ts)를 통해서만 접근해야 합니다.**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// ✅ 올바른 import (Public API 사용)
|
||||||
|
import { LoginForm } from 'features/auth-login';
|
||||||
|
|
||||||
|
// ❌ 잘못된 import (내부 구조 직접 접근)
|
||||||
|
import { LoginForm } from 'features/auth-login/ui/login-form';
|
||||||
|
```
|
||||||
|
|
||||||
|
**Public API 작성 시 주의사항**:
|
||||||
|
- 와일드카드 re-export(`export * from`) 사용 지양
|
||||||
|
- 필요한 것만 명시적으로 export
|
||||||
|
- 슬라이스의 인터페이스를 명확하게 표현
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// ❌ 나쁜 예시
|
||||||
|
export * from './ui/Comment';
|
||||||
|
export * from './model/comments';
|
||||||
|
|
||||||
|
// ✅ 좋은 예시
|
||||||
|
export { Comment } from './ui/comment';
|
||||||
|
export { CommentForm } from './ui/comment-form';
|
||||||
|
export { useComments } from './model/use-comments';
|
||||||
|
export type { Comment, CommentFormData } from './model/types';
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 슬라이스 독립성
|
||||||
|
|
||||||
|
- **Zero Coupling**: 같은 레이어의 슬라이스들은 서로 독립적이어야 합니다
|
||||||
|
- **High Cohesion**: 슬라이스는 주요 목표와 관련된 대부분의 코드를 포함해야 합니다
|
||||||
|
- 예외: Entities 레이어에서 필요한 경우 `@x` 표기법으로 cross-import 가능
|
||||||
|
|
||||||
|
### 4. 세그먼트 명명 규칙
|
||||||
|
|
||||||
|
세그먼트 이름은 **목적**을 설명해야 하며, **본질**을 설명하면 안 됩니다:
|
||||||
|
|
||||||
|
- ❌ **나쁜 이름**: `components`, `hooks`, `types` (무엇인지만 설명)
|
||||||
|
- ✅ **좋은 이름**: `ui`, `api`, `model`, `lib` (왜 있는지 설명)
|
||||||
|
|
||||||
|
## 코드 규칙
|
||||||
|
|
||||||
|
- TypeScript 사용 (strict mode)
|
||||||
|
- 함수형 컴포넌트 사용
|
||||||
|
- Named exports 선호
|
||||||
|
- Tailwind CSS 사용
|
||||||
|
- ESLint + Prettier 적용
|
||||||
|
- Public API는 명시적으로 정의 (와일드카드 export 지양)
|
||||||
|
|
||||||
|
## 아키텍처 린팅
|
||||||
|
|
||||||
|
코드베이스의 FSD 규칙 준수를 자동으로 검증하려면 [Steiger](https://github.com/feature-sliced/steiger)를 사용하세요.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Steiger 설치 및 실행
|
||||||
|
pnpm add -D @feature-sliced/steiger
|
||||||
|
npx steiger src
|
||||||
|
```
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback } from "react";
|
||||||
|
import { usePathname, useRouter } from "next/navigation";
|
||||||
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { BaseLayout } from "@common/components";
|
||||||
|
import type { MenuItem } from "@/entities/menu";
|
||||||
|
import { PageLayout } from "@/shared/ui/page-layout";
|
||||||
|
|
||||||
|
export default function WithBaseLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const pathname = usePathname();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const handleMenuClick = useCallback(
|
||||||
|
(item: MenuItem) => {
|
||||||
|
router.push(item.urlPath);
|
||||||
|
},
|
||||||
|
[router],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseLayout
|
||||||
|
queryClient={queryClient}
|
||||||
|
currentPath={pathname ?? ""}
|
||||||
|
handleMenuClick={handleMenuClick}
|
||||||
|
>
|
||||||
|
<PageLayout>{children}</PageLayout>
|
||||||
|
</BaseLayout>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
export default function MainPage() {
|
||||||
|
return (
|
||||||
|
<div className="flex h-full flex-col items-center justify-center py-10">
|
||||||
|
<h1 className="mb-4 text-3xl font-bold">Home</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
# App Layer
|
||||||
|
|
||||||
|
**App**은 애플리케이션 전체에 영향을 미치는 기술적, 비즈니스적 사항을 다루는 최상위 레이어입니다.
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
- 애플리케이션의 진입점(entrypoint) 제공
|
||||||
|
- 전역 Context Providers 설정
|
||||||
|
- 라우터 구성
|
||||||
|
- 글로벌 스타일 정의
|
||||||
|
- 전역 상태 저장소 설정
|
||||||
|
- 애널리틱스 및 모니터링 설정
|
||||||
|
|
||||||
|
## 특징
|
||||||
|
|
||||||
|
- **슬라이스 없음**: App 레이어는 Shared처럼 슬라이스가 없고 세그먼트로만 구성됩니다
|
||||||
|
- **전체 앱 관심사**: 특정 비즈니스 도메인이 아닌 앱 전체와 관련된 코드만 포함
|
||||||
|
- **최상위 레이어**: 모든 하위 레이어의 모듈을 자유롭게 import 가능
|
||||||
|
|
||||||
|
## 구조 (Next.js App Router)
|
||||||
|
|
||||||
|
Next.js를 사용하는 경우, App 레이어는 주로 `app/` 디렉토리로 표현됩니다:
|
||||||
|
|
||||||
|
```
|
||||||
|
app/
|
||||||
|
├── (routes)/ # 라우트 그룹 및 페이지
|
||||||
|
│ ├── (auth)/
|
||||||
|
│ │ ├── login/
|
||||||
|
│ │ │ └── page.tsx
|
||||||
|
│ │ └── register/
|
||||||
|
│ │ └── page.tsx
|
||||||
|
│ └── (main)/
|
||||||
|
│ ├── dashboard/
|
||||||
|
│ │ └── page.tsx
|
||||||
|
│ └── settings/
|
||||||
|
│ └── page.tsx
|
||||||
|
├── layout.tsx # 루트 레이아웃
|
||||||
|
├── page.tsx # 홈 페이지
|
||||||
|
├── globals.css # 글로벌 스타일
|
||||||
|
├── providers.tsx # 전역 Providers 설정
|
||||||
|
└── error.tsx # 글로벌 에러 핸들러
|
||||||
|
```
|
||||||
|
|
||||||
|
### 일반적인 FSD 세그먼트 구조
|
||||||
|
|
||||||
|
FSD 표준 세그먼트를 사용하는 경우:
|
||||||
|
|
||||||
|
```
|
||||||
|
app/
|
||||||
|
├── entrypoint/ # 애플리케이션 진입점 (프레임워크별)
|
||||||
|
│ └── index.tsx
|
||||||
|
├── providers/ # Context Providers
|
||||||
|
│ ├── query-provider.tsx
|
||||||
|
│ ├── theme-provider.tsx
|
||||||
|
│ └── index.tsx
|
||||||
|
├── styles/ # 글로벌 스타일
|
||||||
|
│ ├── globals.css
|
||||||
|
│ └── theme.css
|
||||||
|
├── store/ # 글로벌 상태 저장소 설정
|
||||||
|
│ └── index.ts
|
||||||
|
└── routes/ # 라우터 설정
|
||||||
|
└── index.tsx
|
||||||
|
```
|
||||||
|
|
||||||
|
## 예시
|
||||||
|
|
||||||
|
### Next.js Providers 설정
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// app/providers.tsx
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
|
import { ThemeProvider } from 'next-themes';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
export function Providers({ children }: { children: React.ReactNode }) {
|
||||||
|
const [queryClient] = useState(() => new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
|
||||||
|
{children}
|
||||||
|
</ThemeProvider>
|
||||||
|
</QueryClientProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// app/layout.tsx
|
||||||
|
import { Providers } from './providers';
|
||||||
|
import './globals.css';
|
||||||
|
|
||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<html lang="ko">
|
||||||
|
<body>
|
||||||
|
<Providers>
|
||||||
|
{children}
|
||||||
|
</Providers>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 글로벌 설정
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// app/config/analytics.ts
|
||||||
|
export function initAnalytics() {
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
// 애널리틱스 초기화
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// app/config/monitoring.ts
|
||||||
|
export function initMonitoring() {
|
||||||
|
// 에러 모니터링 설정
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next.js App Router와 FSD
|
||||||
|
|
||||||
|
Next.js의 `app/` 디렉토리는 FSD의 **App 레이어**와 **Pages 레이어**를 동시에 담당합니다:
|
||||||
|
|
||||||
|
- **루트 레벨 파일들** (`layout.tsx`, `providers.tsx`, `globals.css`): App 레이어
|
||||||
|
- **라우트 폴더들** (`dashboard/`, `login/` 등): Pages 레이어
|
||||||
|
|
||||||
|
각 페이지별 비즈니스 로직은:
|
||||||
|
- 재사용되지 않는 UI는 페이지 슬라이스(`app/dashboard/` 등) 안에 유지
|
||||||
|
- 재사용되는 기능은 `features/` 레이어로 분리
|
||||||
|
- 여러 페이지에서 재사용되는 큰 UI 블록은 `widgets/` 레이어로 분리
|
||||||
|
|
||||||
|
## 레이어 의존성 규칙
|
||||||
|
|
||||||
|
✅ **허용되는 의존성**:
|
||||||
|
- 모든 하위 레이어 (`pages`, `widgets`, `features`, `entities`, `shared`)
|
||||||
|
- 같은 `app` 레이어 내의 다른 세그먼트
|
||||||
|
- 외부 라이브러리
|
||||||
|
|
||||||
|
❌ **금지된 의존성**:
|
||||||
|
- 없음 (App은 최상위 레이어)
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **비대화 방지**: App 레이어가 너무 커지면 관리가 어려워집니다. 대부분의 로직은 하위 레이어에 배치하세요
|
||||||
|
2. **전역 관심사만**: 특정 페이지나 기능에만 관련된 코드는 해당 레이어로 이동
|
||||||
|
3. **라우터 레벨 로직**: 라우터 및 서버 레벨 로직은 이 레이어에 유지
|
||||||
|
4. **Processes 레이어 사용 지양**: Processes 레이어는 deprecated되었으므로 해당 로직은 `app`이나 `features`에 배치
|
||||||
|
|
||||||
|
## FSD v2.1 권장사항
|
||||||
|
|
||||||
|
최신 FSD 버전(v2.1)은 **"pages-first"** 접근 방식을 권장합니다:
|
||||||
|
|
||||||
|
- 더 많은 코드를 페이지 슬라이스에 유지
|
||||||
|
- 큰 UI 블록과 재사용되지 않는 비즈니스 로직은 즉시 추출하지 말고 페이지에 보관
|
||||||
|
- 실제로 재사용이 필요할 때만 `features`나 `widgets`로 분리
|
||||||
|
|
||||||
|
이 접근 방식은 과도한 추상화를 방지하고 코드를 더 쉽게 탐색할 수 있게 합니다.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
@import "@common/assets/styles/base.css";
|
||||||
|
@import "@common/assets/styles/diveicon.css";
|
||||||
|
@import "@common/components/index.css";
|
||||||
|
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
color: var(--foreground);
|
||||||
|
background: var(--background);
|
||||||
|
font-family: var(--font-noto-sans-kr), sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import type { Metadata } from "next";
|
||||||
|
import { Noto_Sans_KR } from "next/font/google";
|
||||||
|
import { Providers } from "./providers";
|
||||||
|
import "./globals.css";
|
||||||
|
|
||||||
|
const notoSansKR = Noto_Sans_KR({
|
||||||
|
subsets: ["latin"],
|
||||||
|
weight: ["100", "300", "400", "500", "700", "900"],
|
||||||
|
display: "swap",
|
||||||
|
variable: "--font-noto-sans-kr",
|
||||||
|
});
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "행정지원시스템",
|
||||||
|
description: "행정지원시스템",
|
||||||
|
};
|
||||||
|
|
||||||
|
interface RootLayoutProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function RootLayout({ children }: RootLayoutProps) {
|
||||||
|
return (
|
||||||
|
<html lang="ko" className={notoSansKR.variable}>
|
||||||
|
<body className={`${notoSansKR.className} antialiased`}>
|
||||||
|
<Providers>{children}</Providers>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
|
import { queryClient } from "@/shared/lib";
|
||||||
|
|
||||||
|
interface ProvidersProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Providers({ children }: ProvidersProps) {
|
||||||
|
return (
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
{children}
|
||||||
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
|
</QueryClientProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# Entities Layer
|
||||||
|
|
||||||
|
**Entities**는 프로젝트가 다루는 실제 비즈니스 개념을 나타내는 레이어입니다. 비즈니스에서 제품을 설명할 때 사용하는 용어들(예: User, Product, Order)이 주로 엔티티가 됩니다.
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
- 비즈니스 엔티티의 데이터 모델 및 타입 정의
|
||||||
|
- 엔티티 관련 API 요청 함수 관리
|
||||||
|
- 엔티티의 시각적 표현 제공 (재사용 가능한 UI)
|
||||||
|
- 여러 페이지에서 동일한 외관을 재사용할 수 있도록 지원
|
||||||
|
|
||||||
|
## 구조
|
||||||
|
|
||||||
|
각 엔티티 슬라이스는 다음 세그먼트로 구성됩니다:
|
||||||
|
|
||||||
|
```
|
||||||
|
entities/
|
||||||
|
└── [entity-name]/
|
||||||
|
├── model/ # 데이터 저장소, 검증 스키마, 상태 관리
|
||||||
|
├── api/ # 엔티티 관련 API 요청 함수
|
||||||
|
├── ui/ # 엔티티 시각적 표현 (선택적)
|
||||||
|
├── lib/ # 엔티티 관련 유틸리티 (선택적)
|
||||||
|
├── @x/ # 다른 엔티티로부터의 cross-import용 Public API (선택적)
|
||||||
|
└── index.ts # Public API
|
||||||
|
```
|
||||||
|
|
||||||
|
### 세그먼트 설명
|
||||||
|
|
||||||
|
- **model**: 데이터 모델, 타입 정의, 상태 저장소 (Zustand 등)
|
||||||
|
- **api**: 백엔드 API 호출 함수
|
||||||
|
- **ui**: 엔티티를 표시하는 UI 컴포넌트 (완전한 UI 블록이 아니라 재사용 가능한 표현)
|
||||||
|
- **lib**: 엔티티 관련 유틸리티 함수
|
||||||
|
- **@x**: 다른 엔티티가 이 엔티티를 import할 때 사용하는 명시적 cross-import API
|
||||||
|
- **index.ts**: 슬라이스의 Public API (외부에서 사용할 수 있는 것만 export)
|
||||||
|
|
||||||
|
## 예시
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// entities/user/model/user.ts
|
||||||
|
export interface User {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
role: 'admin' | 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
// entities/user/api/get-user.ts
|
||||||
|
import type { User } from '../model/user';
|
||||||
|
|
||||||
|
export async function getUser(id: string): Promise<User> {
|
||||||
|
const response = await fetch(`/api/users/${id}`);
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// entities/user/ui/user-card.tsx
|
||||||
|
import type { User } from '../model/user';
|
||||||
|
|
||||||
|
interface UserCardProps {
|
||||||
|
user: User;
|
||||||
|
onClick?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function UserCard({ user, onClick }: UserCardProps) {
|
||||||
|
return (
|
||||||
|
<div onClick={onClick}>
|
||||||
|
<h3>{user.name}</h3>
|
||||||
|
<p>{user.email}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// entities/user/index.ts
|
||||||
|
export { type User } from './model/user';
|
||||||
|
export { getUser } from './api/get-user';
|
||||||
|
export { UserCard } from './ui/user-card';
|
||||||
|
```
|
||||||
|
|
||||||
|
## 엔티티 간 관계
|
||||||
|
|
||||||
|
엔티티가 서로 연결되어 있을 때는 `@x` 표기법을 사용하여 명시적으로 cross-import를 관리하는 것이 권장됩니다:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// entities/artist/model/artist.ts
|
||||||
|
import type { Song } from 'entities/song/@x/artist';
|
||||||
|
|
||||||
|
export interface Artist {
|
||||||
|
name: string;
|
||||||
|
songs: Array<Song>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// entities/song/@x/artist.ts
|
||||||
|
export type { Song } from '../model/song';
|
||||||
|
```
|
||||||
|
|
||||||
|
> `@x` 폴더를 사용하면 엔티티 간 연결을 명확하게 만들어 함께 리팩터링이 필요한 코드를 쉽게 찾을 수 있습니다.
|
||||||
|
|
||||||
|
## 레이어 의존성 규칙
|
||||||
|
|
||||||
|
✅ **허용되는 의존성**:
|
||||||
|
- `shared` 레이어의 모듈
|
||||||
|
- 같은 엔티티 슬라이스 내의 다른 세그먼트
|
||||||
|
- 다른 엔티티 슬라이스 (필요한 경우, `@x` 표기법 권장)
|
||||||
|
|
||||||
|
❌ **금지된 의존성**:
|
||||||
|
- `features` 레이어
|
||||||
|
- `widgets` 레이어
|
||||||
|
- `pages` 레이어
|
||||||
|
- `app` 레이어
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **UI 컴포넌트는 완전한 비즈니스 로직을 포함하지 않음**: UI는 주로 props나 slots를 통해 다양한 비즈니스 로직을 연결할 수 있도록 설계
|
||||||
|
2. **엔티티 간 비즈니스 로직은 상위 레이어에**: 엔티티 간 상호작용의 비즈니스 로직은 Features나 Pages 레이어에서 처리
|
||||||
|
3. **데이터 관리에 집중**: 복잡한 비즈니스 로직보다는 데이터 모델, 검증, 저장에 집중
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { type MenuItem } from "./model/types";
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export interface MenuItem {
|
||||||
|
menuCd: number;
|
||||||
|
menuKornNm: string;
|
||||||
|
menuEngNm: string;
|
||||||
|
parentId: number | null;
|
||||||
|
sortSeq: number;
|
||||||
|
iconNm?: string;
|
||||||
|
children: MenuItem[] | null;
|
||||||
|
levelNo: number;
|
||||||
|
urlPath: string;
|
||||||
|
menuLnkgTypeCd: string;
|
||||||
|
menuLnkgSn: number;
|
||||||
|
menuPath: string;
|
||||||
|
qrcd: string;
|
||||||
|
useYn: string;
|
||||||
|
otptYn: string;
|
||||||
|
newWndwYn: string;
|
||||||
|
requiredUrlPath: boolean;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||||
|
import nextTs from "eslint-config-next/typescript";
|
||||||
|
|
||||||
|
const eslintConfig = defineConfig([
|
||||||
|
...nextVitals,
|
||||||
|
...nextTs,
|
||||||
|
// Override default ignores of eslint-config-next.
|
||||||
|
globalIgnores([
|
||||||
|
// Default ignores of eslint-config-next:
|
||||||
|
".next/**",
|
||||||
|
"out/**",
|
||||||
|
"build/**",
|
||||||
|
"next-env.d.ts",
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
# Features Layer
|
||||||
|
|
||||||
|
**Features**는 앱의 주요 사용자 상호작용과 기능을 구현하는 레이어입니다. 사용자가 실제로 수행하는 작업들로, 주로 비즈니스 엔티티와 관련이 있습니다.
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
- 사용자가 중요하게 생각하는 주요 상호작용 구현
|
||||||
|
- 재사용 가능한 비즈니스 기능 제공
|
||||||
|
- 여러 페이지에서 사용되는 기능의 중복 제거
|
||||||
|
|
||||||
|
## Feature로 만들어야 하는 경우
|
||||||
|
|
||||||
|
> ⚠️ **중요**: 모든 것을 feature로 만들 필요는 없습니다.
|
||||||
|
|
||||||
|
Feature로 만드는 것이 좋은 지표:
|
||||||
|
- **여러 페이지에서 재사용됨**: 예를 들어, 여러 에디터가 있고 모두 댓글 기능이 있다면, 댓글은 재사용 가능한 feature입니다
|
||||||
|
- **중요한 비즈니스 기능**: 신규 프로젝트 참여자가 Features 폴더를 보고 앱의 주요 기능을 빠르게 파악할 수 있어야 합니다
|
||||||
|
|
||||||
|
Feature가 너무 많으면 중요한 기능이 묻히므로, 신규 참여자의 경험을 최적화하여 결정하세요.
|
||||||
|
|
||||||
|
## 구조
|
||||||
|
|
||||||
|
각 feature 슬라이스는 다음 세그먼트로 구성됩니다:
|
||||||
|
|
||||||
|
```
|
||||||
|
features/
|
||||||
|
└── [feature-name]/
|
||||||
|
├── ui/ # 상호작용을 수행하는 UI (폼, 버튼 등)
|
||||||
|
├── api/ # 액션 수행에 필요한 API 호출 (선택적)
|
||||||
|
├── model/ # 검증 및 내부 상태 관리 (선택적)
|
||||||
|
├── lib/ # 유틸리티 함수 (선택적)
|
||||||
|
├── config/ # feature flags (선택적)
|
||||||
|
└── index.ts # Public API
|
||||||
|
```
|
||||||
|
|
||||||
|
### 세그먼트 설명
|
||||||
|
|
||||||
|
- **ui**: 사용자 상호작용을 위한 UI 컴포넌트 (폼, 모달, 버튼 등)
|
||||||
|
- **api**: feature 실행에 필요한 API 요청 함수
|
||||||
|
- **model**: 폼 검증, 내부 상태, 비즈니스 로직
|
||||||
|
- **lib**: feature 내부에서만 사용되는 유틸리티
|
||||||
|
- **config**: feature flags, feature별 설정값
|
||||||
|
- **index.ts**: 슬라이스의 Public API (외부에서 사용할 수 있는 것만 export)
|
||||||
|
|
||||||
|
## 예시
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// features/auth-login/ui/login-form.tsx
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { loginUser } from '../api/login-user';
|
||||||
|
import type { LoginCredentials } from '../model/types';
|
||||||
|
|
||||||
|
export function LoginForm() {
|
||||||
|
const [credentials, setCredentials] = useState<LoginCredentials>({
|
||||||
|
email: '',
|
||||||
|
password: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
await loginUser(credentials);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit}>
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
value={credentials.email}
|
||||||
|
onChange={(e) => setCredentials({ ...credentials, email: e.target.value })}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
value={credentials.password}
|
||||||
|
onChange={(e) => setCredentials({ ...credentials, password: e.target.value })}
|
||||||
|
/>
|
||||||
|
<button type="submit">로그인</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// features/auth-login/api/login-user.ts
|
||||||
|
import type { LoginCredentials } from '../model/types';
|
||||||
|
|
||||||
|
export async function loginUser(credentials: LoginCredentials) {
|
||||||
|
const response = await fetch('/api/auth/login', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(credentials),
|
||||||
|
});
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// features/auth-login/model/types.ts
|
||||||
|
export interface LoginCredentials {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// features/auth-login/index.ts
|
||||||
|
export { LoginForm } from './ui/login-form';
|
||||||
|
export { loginUser } from './api/login-user';
|
||||||
|
export type { LoginCredentials } from './model/types';
|
||||||
|
```
|
||||||
|
|
||||||
|
## 레이어 의존성 규칙
|
||||||
|
|
||||||
|
✅ **허용되는 의존성**:
|
||||||
|
- `shared` 레이어의 모듈
|
||||||
|
- `entities` 레이어의 모듈
|
||||||
|
- 같은 feature 슬라이스 내의 다른 세그먼트
|
||||||
|
|
||||||
|
❌ **금지된 의존성**:
|
||||||
|
- 다른 `features` 슬라이스 (feature 간 직접 의존 금지)
|
||||||
|
- `widgets` 레이어
|
||||||
|
- `pages` 레이어
|
||||||
|
- `app` 레이어
|
||||||
|
|
||||||
|
> 💡 **팁**: 여러 features가 공통 기능을 필요로 한다면, 그 기능을 `shared` 레이어로 이동시키거나 `entities` 레이어에서 관리하세요.
|
||||||
|
|
||||||
|
## 명명 규칙
|
||||||
|
|
||||||
|
- 소문자와 대시 사용: `auth-login`, `post-create`, `comment-edit`
|
||||||
|
- 동사 형태 권장: 사용자 액션을 나타내는 이름 사용
|
||||||
|
- 명확하고 구체적으로: 기능의 목적이 명확하게 드러나도록
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **하나의 기능에만 집중**: 각 feature는 단일 사용자 시나리오를 구현해야 합니다
|
||||||
|
2. **재사용성 고려**: 여러 페이지에서 사용될 수 있도록 설계
|
||||||
|
3. **독립성 유지**: 다른 features에 의존하지 않고 독립적으로 작동
|
||||||
|
4. **적절한 추상화**: 너무 많은 feature를 만들지 말고, 중요한 기능 위주로 구성
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
|
const nextConfig: NextConfig = {
|
||||||
|
reactStrictMode: true,
|
||||||
|
transpilePackages: ["@common/assets"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default nextConfig;
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"name": "as",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"start": "next start",
|
||||||
|
"lint": "next lint",
|
||||||
|
"lint:fsd": "steiger ."
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@common/assets": "workspace:*",
|
||||||
|
"@common/components": "workspace:*",
|
||||||
|
"@common/network": "workspace:*",
|
||||||
|
"@hookform/resolvers": "^4.1.3",
|
||||||
|
"@tanstack/react-query": "^5.75.5",
|
||||||
|
"@tanstack/react-query-devtools": "^5.75.5",
|
||||||
|
"@tanstack/react-table": "^8.21.2",
|
||||||
|
"axios": "^1.8.1",
|
||||||
|
"dayjs": "^1.11.13",
|
||||||
|
"next": "15.3.8",
|
||||||
|
"react-hook-form": "^7.54.2",
|
||||||
|
"zod": "^3.24.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^9.0.0",
|
||||||
|
"eslint-config-next": "15.3.8",
|
||||||
|
"postcss": "^8.4.49",
|
||||||
|
"prettier": "^3.4.2",
|
||||||
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
"steiger": "^0.5.11",
|
||||||
|
"tailwindcss": "^3.4.14",
|
||||||
|
"typescript": "^5.7.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/** @type {import('postcss-load-config').Config} */
|
||||||
|
const config = {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
# Shared Layer
|
||||||
|
|
||||||
|
**Shared**는 애플리케이션의 기반을 형성하는 레이어입니다. 외부 세계(백엔드, 서드파티 라이브러리, 환경)와의 연결을 생성하고, 높은 응집력을 가진 자체 라이브러리를 정의하는 곳입니다.
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
- 외부 시스템 및 라이브러리와의 통합
|
||||||
|
- 프로젝트 전체에서 사용되는 공통 코드 제공
|
||||||
|
- 비즈니스 로직이 없는 재사용 가능한 유틸리티 및 UI 제공
|
||||||
|
- 글로벌 설정 및 환경 변수 관리
|
||||||
|
|
||||||
|
## 특징
|
||||||
|
|
||||||
|
- **슬라이스 없음**: Shared 레이어는 비즈니스 도메인이 없으므로 슬라이스로 나뉘지 않습니다
|
||||||
|
- **세그먼트 구성**: 기술적 목적에 따라 세그먼트로 직접 구성됩니다
|
||||||
|
- **자유로운 import**: Shared 내의 모든 파일은 서로를 참조하고 import할 수 있습니다
|
||||||
|
|
||||||
|
## 구조
|
||||||
|
|
||||||
|
```
|
||||||
|
shared/
|
||||||
|
├── ui/ # 애플리케이션 UI Kit
|
||||||
|
│ ├── button/
|
||||||
|
│ ├── input/
|
||||||
|
│ ├── modal/
|
||||||
|
│ └── index.ts
|
||||||
|
├── api/ # API 클라이언트 및 백엔드 엔드포인트 함수
|
||||||
|
│ ├── client.ts
|
||||||
|
│ └── index.ts
|
||||||
|
├── lib/ # 내부 라이브러리 모음
|
||||||
|
│ ├── dates/ # 날짜 관련 유틸리티
|
||||||
|
│ ├── colors/ # 색상 관련 유틸리티
|
||||||
|
│ ├── text/ # 텍스트 처리 유틸리티
|
||||||
|
│ └── index.ts
|
||||||
|
├── config/ # 환경 변수, 글로벌 feature flags
|
||||||
|
│ ├── env.ts
|
||||||
|
│ └── index.ts
|
||||||
|
├── types/ # 공통 타입 정의
|
||||||
|
│ └── index.ts
|
||||||
|
├── i18n/ # 번역 설정, 글로벌 번역 문자열
|
||||||
|
│ └── index.ts
|
||||||
|
└── routes/ # 라우트 상수 또는 패턴
|
||||||
|
└── index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## 세그먼트 설명
|
||||||
|
|
||||||
|
### 📁 ui
|
||||||
|
애플리케이션의 UI Kit로, 비즈니스 로직을 포함하지 않는 재사용 가능한 UI 컴포넌트들입니다.
|
||||||
|
|
||||||
|
- Button, Input, Modal 같은 기본 컴포넌트
|
||||||
|
- 비즈니스 로직은 없지만 UI 로직은 포함 가능 (예: Autocomplete, SearchBar)
|
||||||
|
- 비즈니스 테마 컴포넌트도 허용 (예: 회사 로고, 페이지 레이아웃)
|
||||||
|
|
||||||
|
### 📁 api
|
||||||
|
API 클라이언트 및 특정 백엔드 엔드포인트 요청 함수입니다.
|
||||||
|
|
||||||
|
- HTTP 클라이언트 설정 (Axios, Fetch 등)
|
||||||
|
- 인증 인터셉터
|
||||||
|
- 공통 에러 핸들링
|
||||||
|
|
||||||
|
### 📁 lib
|
||||||
|
내부 라이브러리 모음으로, 각 라이브러리는 **하나의 관심사**에 집중해야 합니다.
|
||||||
|
|
||||||
|
> ⚠️ **중요**: `helpers`나 `utils` 폴더처럼 덤프 폴더로 만들지 마세요. 각 라이브러리는 명확한 초점 영역(예: dates, colors, text)을 가져야 하며, README로 문서화해야 합니다.
|
||||||
|
|
||||||
|
### 📁 config
|
||||||
|
환경 변수, 글로벌 feature flags 및 앱 전체 설정입니다.
|
||||||
|
|
||||||
|
### 📁 types
|
||||||
|
프로젝트 전체에서 사용되는 공통 타입 정의입니다.
|
||||||
|
|
||||||
|
### 📁 i18n
|
||||||
|
번역 설정 코드 및 글로벌 번역 문자열입니다.
|
||||||
|
|
||||||
|
### 📁 routes
|
||||||
|
라우트 상수 또는 라우트 매칭 패턴입니다.
|
||||||
|
|
||||||
|
## 예시
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// shared/ui/button/button.tsx
|
||||||
|
interface ButtonProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
variant?: 'primary' | 'secondary';
|
||||||
|
onClick?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Button({ children, variant = 'primary', onClick }: ButtonProps) {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={variant === 'primary' ? 'bg-blue-500' : 'bg-gray-500'}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// shared/api/client.ts
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export const apiClient = axios.create({
|
||||||
|
baseURL: process.env.NEXT_PUBLIC_API_URL,
|
||||||
|
timeout: 10000,
|
||||||
|
});
|
||||||
|
|
||||||
|
// shared/lib/dates/format-date.ts
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export function formatDate(date: Date, format: string = 'YYYY-MM-DD'): string {
|
||||||
|
return dayjs(date).format(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
// shared/config/env.ts
|
||||||
|
export const ENV = {
|
||||||
|
apiUrl: process.env.NEXT_PUBLIC_API_URL!,
|
||||||
|
isDev: process.env.NODE_ENV === 'development',
|
||||||
|
} as const;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 레이어 의존성 규칙
|
||||||
|
|
||||||
|
✅ **허용되는 의존성**:
|
||||||
|
- 같은 `shared` 레이어 내의 다른 세그먼트 (자유로운 cross-import)
|
||||||
|
- 외부 라이브러리 및 패키지
|
||||||
|
|
||||||
|
❌ **금지된 의존성**:
|
||||||
|
- `entities` 레이어
|
||||||
|
- `features` 레이어
|
||||||
|
- `widgets` 레이어
|
||||||
|
- `pages` 레이어
|
||||||
|
- `app` 레이어
|
||||||
|
|
||||||
|
> 💡 **원칙**: Shared는 가장 낮은 레이어이므로 상위 레이어에 의존하지 않습니다.
|
||||||
|
|
||||||
|
## 세그먼트 명명 규칙
|
||||||
|
|
||||||
|
세그먼트 이름은 **내용의 목적**을 설명해야 하며, **본질**을 설명하면 안 됩니다.
|
||||||
|
|
||||||
|
❌ **나쁜 예시**: `components`, `hooks`, `types` (본질을 설명)
|
||||||
|
✅ **좋은 예시**: `ui`, `api`, `lib/dates`, `config` (목적을 설명)
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **비즈니스 로직 없음**: Shared는 순수한 기술적 코드만 포함
|
||||||
|
2. **높은 재사용성**: 앱 전체에서 사용될 수 있어야 함
|
||||||
|
3. **명확한 라이브러리 구조**: `lib` 내부는 관심사별로 명확하게 분리
|
||||||
|
4. **문서화**: 각 라이브러리는 README로 사용법과 목적을 문서화
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Client } from "@common/network";
|
||||||
|
import { PROXY_HOST, SITE_ID } from "@/shared/config/env";
|
||||||
|
|
||||||
|
const BASE_URL = `${PROXY_HOST}/server`;
|
||||||
|
|
||||||
|
export const apiClient = Client.getInstance({
|
||||||
|
baseURL: BASE_URL,
|
||||||
|
siteId: SITE_ID,
|
||||||
|
});
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { apiClient } from "./client";
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const PORT = process.env.NEXT_PUBLIC_PORT || "3000";
|
||||||
|
export const PROXY_HOST =
|
||||||
|
process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||||
|
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL;
|
||||||
|
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "AS";
|
||||||
|
export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||||
|
export const ACCESS_TOKEN =
|
||||||
|
process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token";
|
||||||
|
export const REFRESH_TOKEN =
|
||||||
|
process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token";
|
||||||
|
export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./env";
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import dayjs from "dayjs";
|
||||||
|
import "dayjs/locale/ko";
|
||||||
|
import utc from "dayjs/plugin/utc";
|
||||||
|
import timezone from "dayjs/plugin/timezone";
|
||||||
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
|
|
||||||
|
dayjs.extend(utc);
|
||||||
|
dayjs.extend(timezone);
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
dayjs.locale("ko");
|
||||||
|
|
||||||
|
export { dayjs };
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export { queryClient } from "./query-client";
|
||||||
|
export { dayjs } from "./dayjs";
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { QueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
export const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
retry: 1,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
export interface BaseEntity {
|
||||||
|
id: string;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PaginationParams {
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PaginationResponse<T> {
|
||||||
|
data: T[];
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApiResponse<T> {
|
||||||
|
success: boolean;
|
||||||
|
data: T;
|
||||||
|
message?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApiError {
|
||||||
|
message: string;
|
||||||
|
code?: string;
|
||||||
|
status?: number;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { PageLayout } from "./page-layout";
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { PageTitle } from "@common/components";
|
||||||
|
|
||||||
|
const mockCurrentMenuInfo = {
|
||||||
|
menuCd: 0,
|
||||||
|
menuKornNm: "메인",
|
||||||
|
menuEngNm: "Main",
|
||||||
|
parentId: null,
|
||||||
|
sortSeq: 0,
|
||||||
|
children: null,
|
||||||
|
levelNo: 0,
|
||||||
|
urlPath: "/",
|
||||||
|
menuLnkgTypeCd: "",
|
||||||
|
menuLnkgSn: 0,
|
||||||
|
menuPath: "메인",
|
||||||
|
qrcd: "",
|
||||||
|
useYn: "Y",
|
||||||
|
otptYn: "Y",
|
||||||
|
newWndwYn: "N",
|
||||||
|
requiredUrlPath: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
function PageLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const menuPaths = mockCurrentMenuInfo.menuPath.split(">").map((path) => path.trim());
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-container h-auto min-h-full pb-2">
|
||||||
|
<PageTitle title={mockCurrentMenuInfo.menuKornNm} menuPaths={menuPaths} />
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { PageLayout };
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import type { Config } from "tailwindcss";
|
||||||
|
import presetConfig from "../../tailwind.config.preset";
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
presets: [presetConfig],
|
||||||
|
content: [
|
||||||
|
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./shared/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./entities/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./features/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./widgets/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"../../packages/common/components/dist/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
background: "var(--background)",
|
||||||
|
foreground: "var(--foreground)",
|
||||||
|
},
|
||||||
|
fontFamily: {
|
||||||
|
sans: ["var(--font-noto-sans-kr)", "Noto Sans KR", "sans-serif"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "next"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"],
|
||||||
|
"@/app/*": ["./app/*"],
|
||||||
|
"@/shared/*": ["./shared/*"],
|
||||||
|
"@/entities/*": ["./entities/*"],
|
||||||
|
"@/features/*": ["./features/*"],
|
||||||
|
"@/widgets/*": ["./widgets/*"],
|
||||||
|
"@/pages/*": ["./pages/*"],
|
||||||
|
"@common/components": ["../../packages/common/components/dist/"],
|
||||||
|
"@common/network": ["../../packages/common/network/"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# Widgets Layer
|
||||||
|
|
||||||
|
**Widgets**는 큰 규모의 독립적인 UI 블록을 위한 레이어입니다. 여러 features와 entities를 조합하여 완전한 기능을 제공하는 복합 컴포넌트를 담습니다.
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
- 큰 규모의 독립적인 UI 블록 구성
|
||||||
|
- 여러 features와 entities를 하나의 응집력 있는 UI로 결합
|
||||||
|
- 여러 페이지에서 재사용되는 복잡한 UI 제공
|
||||||
|
- 페이지 레벨 레이아웃 및 섹션 관리
|
||||||
|
|
||||||
|
## Widget으로 만들어야 하는 경우
|
||||||
|
|
||||||
|
Widget은 다음 조건에 해당할 때 사용하세요:
|
||||||
|
|
||||||
|
✅ **Widget으로 만들기 좋은 경우**:
|
||||||
|
- 여러 페이지에서 재사용되는 큰 UI 블록
|
||||||
|
- 페이지에 여러 개의 큰 독립적 블록이 있고, 이것이 그 중 하나인 경우
|
||||||
|
- 페이지 레벨 레이아웃 컴포넌트 (nested routing 시스템 사용 시)
|
||||||
|
|
||||||
|
❌ **Widget으로 만들지 말아야 하는 경우**:
|
||||||
|
- UI 블록이 페이지의 대부분을 차지하고 재사용되지 않는 경우 → 페이지 슬라이스 내부에 직접 배치
|
||||||
|
- 작은 재사용 컴포넌트 → `shared/ui`에 배치
|
||||||
|
|
||||||
|
## 구조
|
||||||
|
|
||||||
|
각 widget 슬라이스는 다음 세그먼트로 구성됩니다:
|
||||||
|
|
||||||
|
```
|
||||||
|
widgets/
|
||||||
|
└── [widget-name]/
|
||||||
|
├── ui/ # 위젯의 메인 UI 컴포넌트
|
||||||
|
├── model/ # 위젯 내부 상태 관리 (선택적)
|
||||||
|
├── api/ # 위젯 전용 API 호출 (선택적)
|
||||||
|
├── lib/ # 위젯 내부 유틸리티 (선택적)
|
||||||
|
└── index.ts # Public API
|
||||||
|
```
|
||||||
|
|
||||||
|
### 세그먼트 설명
|
||||||
|
|
||||||
|
- **ui**: 여러 features와 entities를 조합한 위젯 UI
|
||||||
|
- **model**: 위젯 내부 상태 및 로직 (선택적)
|
||||||
|
- **api**: 위젯이 필요로 하는 데이터 fetching (선택적)
|
||||||
|
- **lib**: 위젯 내부에서만 사용되는 헬퍼 함수 (선택적)
|
||||||
|
- **index.ts**: 슬라이스의 Public API (외부에서 사용할 수 있는 것만 export)
|
||||||
|
|
||||||
|
## 예시
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// widgets/header/ui/header.tsx
|
||||||
|
import { Logo } from 'shared/ui/logo';
|
||||||
|
import { Navigation } from 'shared/ui/navigation';
|
||||||
|
import { UserMenu } from 'features/user-menu';
|
||||||
|
import { NotificationBell } from 'features/notifications';
|
||||||
|
|
||||||
|
export function Header() {
|
||||||
|
return (
|
||||||
|
<header>
|
||||||
|
<Logo />
|
||||||
|
<Navigation />
|
||||||
|
<NotificationBell />
|
||||||
|
<UserMenu />
|
||||||
|
</header>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// widgets/product-list/ui/product-list.tsx
|
||||||
|
import { useProducts } from '../api/use-products';
|
||||||
|
import { ProductCard } from 'entities/product';
|
||||||
|
import { AddToCartButton } from 'features/cart-add-item';
|
||||||
|
|
||||||
|
export function ProductList() {
|
||||||
|
const { data: products, isLoading } = useProducts();
|
||||||
|
|
||||||
|
if (isLoading) return <div>로딩 중...</div>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{products.map((product) => (
|
||||||
|
<div key={product.id}>
|
||||||
|
<ProductCard product={product} />
|
||||||
|
<AddToCartButton productId={product.id} />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// widgets/product-list/api/use-products.ts
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { getProducts } from 'entities/product';
|
||||||
|
|
||||||
|
export function useProducts() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ['products'],
|
||||||
|
queryFn: getProducts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// widgets/product-list/index.ts
|
||||||
|
export { ProductList } from './ui/product-list';
|
||||||
|
```
|
||||||
|
|
||||||
|
## 레이어 의존성 규칙
|
||||||
|
|
||||||
|
✅ **허용되는 의존성**:
|
||||||
|
- `shared` 레이어의 모듈
|
||||||
|
- `entities` 레이어의 모듈
|
||||||
|
- `features` 레이어의 모듈
|
||||||
|
- 같은 widget 슬라이스 내의 다른 세그먼트
|
||||||
|
|
||||||
|
❌ **금지된 의존성**:
|
||||||
|
- 다른 `widgets` 슬라이스 (widget 간 직접 의존 금지)
|
||||||
|
- `pages` 레이어
|
||||||
|
- `app` 레이어
|
||||||
|
|
||||||
|
## 명명 규칙
|
||||||
|
|
||||||
|
- 소문자와 대시 사용: `header`, `sidebar`, `product-list`
|
||||||
|
- 명사 형태 권장: UI 블록의 성격을 나타내는 이름 사용
|
||||||
|
- 구체적으로: 위젯의 역할이 명확하게 드러나도록
|
||||||
|
|
||||||
|
## Nested Routing 사용 시
|
||||||
|
|
||||||
|
Remix 같은 nested routing 시스템을 사용한다면:
|
||||||
|
- Widgets 레이어를 flat routing의 Pages 레이어처럼 사용 가능
|
||||||
|
- 완전한 라우터 블록 생성 (데이터 fetching, loading states, error boundaries 포함)
|
||||||
|
- 페이지 레이아웃을 이 레이어에 저장 가능
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **독립성 유지**: 각 위젯은 독립적으로 작동 가능해야 합니다
|
||||||
|
2. **적절한 크기**: 너무 작은 컴포넌트는 `shared/ui`에, 재사용되지 않으면 `pages`에 배치
|
||||||
|
3. **응집력**: 관련된 features와 entities를 의미 있게 조합
|
||||||
|
4. **재사용 최적화**: 여러 페이지에서 동일한 방식으로 사용될 수 있도록 설계
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
"@types/node": "^22.13.1",
|
"@types/node": "^22.13.1",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
"eslint": "^9.0.0",
|
"eslint": "^9.0.0",
|
||||||
"eslint-config-next": "15.4.0",
|
"eslint-config-next": "15.3.8",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ import { useRouter } from "next/navigation";
|
|||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import type { IUserInfo } from "@/shared/store";
|
import type { IUserInfo } from "@/shared/store";
|
||||||
import { getCookie, useUserStore } from "@/shared/lib";
|
import { getCookie, useUserStore } from "@/shared/lib";
|
||||||
|
import { isAtLoginRedirectUrl } from "@common/network";
|
||||||
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
||||||
import { LoginApi } from "../api/login-service";
|
|
||||||
|
|
||||||
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
||||||
|
|
||||||
async function authCheck() {
|
async function authCheck() {
|
||||||
// 로그인 페이지에서는 인증 체크를 건너뜀
|
if (isAtLoginRedirectUrl("/auth/login")) {
|
||||||
if (window.location.pathname === '/auth/login') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,13 +34,8 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
await authCheck();
|
await authCheck();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
setUserInfo(null);
|
||||||
try {
|
if (!isAtLoginRedirectUrl("/auth/login")) {
|
||||||
await LoginApi.silentRefresh();
|
|
||||||
await authCheck();
|
|
||||||
} catch (refreshError) {
|
|
||||||
console.error("Token refresh failed:", refreshError);
|
|
||||||
setUserInfo(null);
|
|
||||||
router.push("/auth/login");
|
router.push("/auth/login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,11 +145,11 @@ function LoginPage() {
|
|||||||
<div className="left_box fx">
|
<div className="left_box fx">
|
||||||
<div className="text">
|
<div className="text">
|
||||||
<h1>
|
<h1>
|
||||||
유역하수도 통합플랫폼
|
유역하수도통합플랫폼
|
||||||
<br />
|
<br />
|
||||||
<span>통합관리시스템</span>
|
<span>하수도 포탈</span>
|
||||||
</h1>
|
</h1>
|
||||||
<p>유역하수도 통합플랫폼에 오신 것을 환영합니다.</p>
|
<p>유역하수도통합플랫폼 하수도 포탈에 오신 것을 환영합니다.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="img">
|
<div className="img">
|
||||||
<Image src={images.logo} width={229} height={46} alt="logo" />
|
<Image src={images.logo} width={229} height={46} alt="logo" />
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
output: "standalone",
|
||||||
|
experimental: {
|
||||||
|
proxyTimeout: 600000,
|
||||||
|
},
|
||||||
|
eslint: {
|
||||||
|
ignoreDuringBuilds: true,
|
||||||
|
},
|
||||||
|
typescript: {
|
||||||
|
ignoreBuildErrors: true,
|
||||||
|
},
|
||||||
|
logging: {
|
||||||
|
fetches: {
|
||||||
|
fullUrl: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
return {
|
return {
|
||||||
afterFiles: [
|
afterFiles: [
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
"@types/node": "^22.13.1",
|
"@types/node": "^22.13.1",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.1.7",
|
"eslint-config-next": "15.3.8",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
@@ -4,13 +4,17 @@ import { useEffect } from "react";
|
|||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import type { IUserInfo } from "@/shared/store";
|
import type { IUserInfo } from "@/shared/store";
|
||||||
import { getCookie, useUserStore } from "@/shared/lib";
|
import { getCookie, useUserStore } from "@/shared/lib";
|
||||||
|
import { getAuthLoginRedirectUrl, isAtLoginRedirectUrl } from "@common/network";
|
||||||
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
||||||
import { LoginApi } from "../api/login-service";
|
|
||||||
|
|
||||||
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
||||||
|
|
||||||
async function authCheck() {
|
async function authCheck() {
|
||||||
|
if (isAtLoginRedirectUrl(getAuthLoginRedirectUrl())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const userId = getCookie(AUTH_USER_ID);
|
const userId = getCookie(AUTH_USER_ID);
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("Missing required authentication tokens");
|
throw new Error("Missing required authentication tokens");
|
||||||
@@ -28,8 +32,6 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
await authCheck();
|
await authCheck();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await LoginApi.silentRefresh();
|
|
||||||
await authCheck();
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
+2
-1
@@ -38,4 +38,5 @@ yarn-error.log*
|
|||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
.env*
|
.env*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
/start_cs.log
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
"@types/node": "^22.13.1",
|
"@types/node": "^22.13.1",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
"eslint": "^9.0.0",
|
"eslint": "^9.0.0",
|
||||||
"eslint-config-next": "15.4.0",
|
"eslint-config-next": "15.3.8",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import type { IUserInfo } from "@/shared/store";
|
import type { IUserInfo } from "@/shared/store";
|
||||||
import { getCookie, useUserStore } from "@/shared/lib";
|
import { getCookie, useUserStore } from "@/shared/lib";
|
||||||
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
import { isAtLoginRedirectUrl } from "@common/network";
|
||||||
import { LoginApi } from "../api/login-service";
|
import {
|
||||||
|
ENDPOINT,
|
||||||
|
AUTH_USER_ID,
|
||||||
|
AUTH_LOGIN_REDIRECT_URL,
|
||||||
|
} from "@/shared/config";
|
||||||
|
|
||||||
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||||
const router = useRouter();
|
|
||||||
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
||||||
|
|
||||||
async function authCheck() {
|
async function authCheck() {
|
||||||
|
if (isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const userId = getCookie(AUTH_USER_ID);
|
const userId = getCookie(AUTH_USER_ID);
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("Missing required authentication tokens");
|
throw new Error("Missing required authentication tokens");
|
||||||
@@ -30,14 +36,9 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
await authCheck();
|
await authCheck();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
setUserInfo(null);
|
||||||
try {
|
if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
await LoginApi.silentRefresh();
|
window.location.assign(AUTH_LOGIN_REDIRECT_URL);
|
||||||
await authCheck();
|
|
||||||
} catch (refreshError) {
|
|
||||||
console.error("Token refresh failed:", refreshError);
|
|
||||||
setUserInfo(null);
|
|
||||||
router.push("/auth/login");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ function LoginlogPage() {
|
|||||||
const [presetDateRange, setPresetDateRange] = useState("");
|
const [presetDateRange, setPresetDateRange] = useState("");
|
||||||
const [dateRange, setDateRange] = useState<DateRange>(defaultDateRange);
|
const [dateRange, setDateRange] = useState<DateRange>(defaultDateRange);
|
||||||
const [userId, setUserId] = useState("");
|
const [userId, setUserId] = useState("");
|
||||||
const [errOcrnYn, setErrOcrnYn] = useState("N");
|
const [errOcrnYn, setErrOcrnYn] = useState("ALL");
|
||||||
const [searchParams, setSearchParams] = useState<LoginlogParams>({
|
const [searchParams, setSearchParams] = useState<LoginlogParams>({
|
||||||
userId: "",
|
userId: "",
|
||||||
errOcrnYn: "N",
|
errOcrnYn: "",
|
||||||
searchDateFrom: dayjs().subtract(7, "day").format("YYYY-MM-DD"),
|
searchDateFrom: dayjs().subtract(7, "day").format("YYYY-MM-DD"),
|
||||||
searchDateTo: dayjs().format("YYYY-MM-DD"),
|
searchDateTo: dayjs().format("YYYY-MM-DD"),
|
||||||
sort: "lgnDt,desc",
|
sort: "lgnDt,desc",
|
||||||
@@ -87,7 +87,7 @@ function LoginlogPage() {
|
|||||||
setSearchParams({
|
setSearchParams({
|
||||||
...searchParams,
|
...searchParams,
|
||||||
userId,
|
userId,
|
||||||
errOcrnYn,
|
errOcrnYn: errOcrnYn === "ALL" ? "" : errOcrnYn,
|
||||||
searchDateFrom: dateRange.from
|
searchDateFrom: dateRange.from
|
||||||
? dayjs(dateRange.from).format("YYYY-MM-DD")
|
? dayjs(dateRange.from).format("YYYY-MM-DD")
|
||||||
: "",
|
: "",
|
||||||
@@ -102,12 +102,12 @@ function LoginlogPage() {
|
|||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setUserId("");
|
setUserId("");
|
||||||
setErrOcrnYn("N");
|
setErrOcrnYn("ALL");
|
||||||
setDateRange(defaultDateRange);
|
setDateRange(defaultDateRange);
|
||||||
setSearchParams({
|
setSearchParams({
|
||||||
...searchParams,
|
...searchParams,
|
||||||
userId: "",
|
userId: "",
|
||||||
errOcrnYn: "N",
|
errOcrnYn: "",
|
||||||
searchDateFrom: dayjs().subtract(7, "day").format("YYYY-MM-DD"),
|
searchDateFrom: dayjs().subtract(7, "day").format("YYYY-MM-DD"),
|
||||||
searchDateTo: dayjs().format("YYYY-MM-DD"),
|
searchDateTo: dayjs().format("YYYY-MM-DD"),
|
||||||
});
|
});
|
||||||
@@ -180,6 +180,7 @@ function LoginlogPage() {
|
|||||||
<SelectValue placeholder="선택" />
|
<SelectValue placeholder="선택" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
<SelectItem value="ALL">전체</SelectItem>
|
||||||
<SelectItem value="N">정상</SelectItem>
|
<SelectItem value="N">정상</SelectItem>
|
||||||
<SelectItem value="Y">오류</SelectItem>
|
<SelectItem value="Y">오류</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ export const PORT = process.env.NEXT_PUBLIC_PORT || "3000";
|
|||||||
export const PROXY_HOST =
|
export const PROXY_HOST =
|
||||||
process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL;
|
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL;
|
||||||
|
export const AUTH_LOGIN_REDIRECT_URL =
|
||||||
|
process.env.NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL || "/auth/login";
|
||||||
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "CS";
|
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "CS";
|
||||||
export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||||
export const ACCESS_TOKEN =
|
export const ACCESS_TOKEN =
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"@types/node": "^22.17.0",
|
"@types/node": "^22.17.0",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
"eslint": "^9.0.0",
|
"eslint": "^9.0.0",
|
||||||
"eslint-config-next": "15.4.0",
|
"eslint-config-next": "15.3.8",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import type { IUserInfo } from "@/shared/store";
|
import type { IUserInfo } from "@/shared/store";
|
||||||
import { getCookie, useUserStore } from "@/shared/lib";
|
import { getCookie, useUserStore } from "@/shared/lib";
|
||||||
import { ENDPOINT, AUTH_USER_ID } from "@/shared/config";
|
import { isAtLoginRedirectUrl } from "@common/network";
|
||||||
import { LoginApi } from "../api/login-service";
|
import {
|
||||||
|
ENDPOINT,
|
||||||
const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
AUTH_USER_ID,
|
||||||
|
AUTH_LOGIN_REDIRECT_URL,
|
||||||
|
} from "@/shared/config";
|
||||||
|
|
||||||
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||||
const router = useRouter();
|
|
||||||
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
||||||
|
|
||||||
async function authCheck() {
|
async function authCheck() {
|
||||||
|
if (isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const userId = getCookie(AUTH_USER_ID);
|
const userId = getCookie(AUTH_USER_ID);
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("Missing required authentication tokens");
|
throw new Error("Missing required authentication tokens");
|
||||||
@@ -32,14 +36,9 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
await authCheck();
|
await authCheck();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
setUserInfo(null);
|
||||||
try {
|
if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
await LoginApi.silentRefresh();
|
window.location.assign(AUTH_LOGIN_REDIRECT_URL);
|
||||||
await authCheck();
|
|
||||||
} catch (refreshError) {
|
|
||||||
console.error("Token refresh failed:", refreshError);
|
|
||||||
setUserInfo(null);
|
|
||||||
router.push("/auth/login");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ export const PROXY_HOST =
|
|||||||
process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||||
|
|
||||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL;
|
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL;
|
||||||
export const NEXT_PUBLIC_DC_SERVICE_API_URL = process.env.NEXT_PUBLIC_DC_SERVICE_API_URL || `http://localhost:${PORT}`;
|
export const NEXT_PUBLIC_DC_SERVICE_API_URL =
|
||||||
|
process.env.NEXT_PUBLIC_DC_SERVICE_API_URL || `http://localhost:${PORT}`;
|
||||||
|
export const AUTH_LOGIN_REDIRECT_URL =
|
||||||
|
process.env.NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL || "/auth/login";
|
||||||
|
|
||||||
// Flask API URL
|
// Flask API URL
|
||||||
export const FLASK_API_URL = process.env.NEXT_PUBLIC_FLASK_API_URL || "http://localhost:5000";
|
export const FLASK_API_URL =
|
||||||
|
process.env.NEXT_PUBLIC_FLASK_API_URL || "http://localhost:5000";
|
||||||
|
|
||||||
//export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DC";
|
//export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DC";
|
||||||
export const SITE_ID = "DC";
|
export const SITE_ID = "DC";
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&ver
|
|||||||
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||||
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = /
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service
|
|||||||
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
||||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||||
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = /
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
## Project
|
||||||
|
This repository contains a Next.js web application.
|
||||||
|
|
||||||
|
Main technologies:
|
||||||
|
- Next.js
|
||||||
|
- TypeScript
|
||||||
|
- pnpm workspace
|
||||||
|
- turborepo
|
||||||
|
|
||||||
|
이 저장소는 pnpm workspace + Turborepo 기반 monorepo이다.
|
||||||
|
|
||||||
|
- 워크스페이스 범위는 `apps/*`, `apps/common/*`, `packages/*`, `packages/common/*`
|
||||||
|
- 루트 스크립트는 `turbo run build`, `turbo run dev` 를 사용한다
|
||||||
|
- `build` 작업은 의존 패키지의 `build` 를 먼저 수행한다 (`dependsOn: ["^build"]`)
|
||||||
|
- `dev` 는 캐시하지 않는 지속 실행 작업이다
|
||||||
|
- 변경 범위만 선택 실행할 수 있으므로, 전체 빌드보다 `--filter` 사용을 우선한다
|
||||||
|
|
||||||
|
## Encoding
|
||||||
|
- UTF-8
|
||||||
|
- 한글이 깨지지 않도록 주의할 것
|
||||||
|
|
||||||
|
## 주석 comment
|
||||||
|
- 한글 주석을 삭제하지 말 것
|
||||||
|
|
||||||
|
## Monorepo structure
|
||||||
|
apps/
|
||||||
|
_template
|
||||||
|
as
|
||||||
|
cm
|
||||||
|
cs
|
||||||
|
dc
|
||||||
|
dm
|
||||||
|
dm_new
|
||||||
|
fo
|
||||||
|
sn
|
||||||
|
st
|
||||||
|
wr
|
||||||
|
|
||||||
@@ -235,6 +235,7 @@ const Map = () => {
|
|||||||
<>
|
<>
|
||||||
<div className="bg-container">
|
<div className="bg-container">
|
||||||
<Gis
|
<Gis
|
||||||
|
showZoomLevel={true}
|
||||||
height='h-screen'
|
height='h-screen'
|
||||||
treeData={treeData}
|
treeData={treeData}
|
||||||
isSearch={false}
|
isSearch={false}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"@eslint/eslintrc": "^3",
|
"@eslint/eslintrc": "^3",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.1.7",
|
"eslint-config-next": "15.3.8",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^3.4.1",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,12 +1,13 @@
|
|||||||
NEXT_PUBLIC_SITE_ID = DN
|
NEXT_PUBLIC_SITE_ID = DN
|
||||||
|
NEXT_PUBLIC_PORT = 3015
|
||||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||||
NEXT_PUBLIC_PORT = 3005
|
|
||||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3005
|
NEXT_PUBLIC_PROXY_HOST = http://localhost:3005
|
||||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
||||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
|
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
||||||
# NEXT_PUBLIC_FO_SERVER_API_URL = http://192.168.1.222:8883/operation-service/api/v1
|
# NEXT_PUBLIC_FO_SERVER_API_URL = http://192.168.1.222:8883/operation-service/api/v1
|
||||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1
|
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1
|
||||||
@@ -19,7 +20,6 @@ NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&ver
|
|||||||
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||||
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||||
|
|||||||
@@ -1,23 +1,25 @@
|
|||||||
NEXT_PUBLIC_SITE_ID = DM
|
NEXT_PUBLIC_SITE_ID = DN
|
||||||
NEXT_PUBLIC_PORT = 11035
|
NEXT_PUBLIC_PORT = 11315
|
||||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
|
||||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
|
||||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
|
||||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1
|
|
||||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
|
||||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
|
||||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||||
|
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11315
|
||||||
|
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
||||||
|
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
|
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
|
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
||||||
|
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1
|
||||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
|
||||||
|
#NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||||
|
#NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||||
|
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
|
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
|
||||||
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
|
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
|
||||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API
|
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API
|
||||||
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API
|
||||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||||
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
|
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# 공단 운영
|
# 공단 운영
|
||||||
NEXT_PUBLIC_SITE_ID = DM
|
NEXT_PUBLIC_SITE_ID = DN
|
||||||
NEXT_PUBLIC_PORT = 3000
|
NEXT_PUBLIC_PORT = 3000
|
||||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||||
@@ -8,16 +8,16 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
|||||||
#NEXT_PUBLIC_PROXY_HOST = https://devreuse.hasuon.or.kr
|
#NEXT_PUBLIC_PROXY_HOST = https://devreuse.hasuon.or.kr
|
||||||
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login
|
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login
|
||||||
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1
|
|
||||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1
|
||||||
|
NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1
|
||||||
NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
||||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1
|
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service
|
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service
|
||||||
NEXT_PUBLIC_GATEWAY_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
|
||||||
NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact
|
NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact
|
||||||
NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x}
|
NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x}
|
||||||
|
NEXT_PUBLIC_GATEWAY_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
## Project
|
||||||
|
This repository contains a Next.js web application.
|
||||||
|
|
||||||
|
Main technologies:
|
||||||
|
- Next.js
|
||||||
|
- TypeScript
|
||||||
|
- pnpm workspace
|
||||||
|
- turborepo
|
||||||
|
|
||||||
|
이 저장소는 pnpm workspace + Turborepo 기반 monorepo이다.
|
||||||
|
|
||||||
|
- 워크스페이스 범위는 `apps/*`, `apps/common/*`, `packages/*`, `packages/common/*`
|
||||||
|
- 루트 스크립트는 `turbo run build`, `turbo run dev` 를 사용한다
|
||||||
|
- `build` 작업은 의존 패키지의 `build` 를 먼저 수행한다 (`dependsOn: ["^build"]`)
|
||||||
|
- `dev` 는 캐시하지 않는 지속 실행 작업이다
|
||||||
|
- 변경 범위만 선택 실행할 수 있으므로, 전체 빌드보다 `--filter` 사용을 우선한다
|
||||||
|
|
||||||
|
## Encoding
|
||||||
|
- UTF-8
|
||||||
|
- 한글이 깨지지 않도록 주의할 것
|
||||||
|
|
||||||
|
## 주석 comment
|
||||||
|
- 한글 주석을 삭제하지 말 것
|
||||||
|
|
||||||
|
## Monorepo structure
|
||||||
|
apps/
|
||||||
|
_template
|
||||||
|
as
|
||||||
|
cm
|
||||||
|
cs
|
||||||
|
dc
|
||||||
|
dm
|
||||||
|
dm_new
|
||||||
|
fo
|
||||||
|
sn
|
||||||
|
st
|
||||||
|
wr
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
import Image from "next/image";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CaseTabsCarousel.tsx (FINAL OPTIMIZED)
|
* CaseTabsCarousel.tsx (FINAL OPTIMIZED)
|
||||||
@@ -459,10 +460,12 @@ export default function CaseTabsCarousel() {
|
|||||||
].join(" ")}
|
].join(" ")}
|
||||||
aria-label="이전"
|
aria-label="이전"
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/icon_left_arrow.png"
|
src="/images/landing/icon_left_arrow.png"
|
||||||
alt="이전"
|
alt="이전"
|
||||||
className="w-6 h-6 object-contain"
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className="w-6 h-6 object-contain"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -480,10 +483,12 @@ export default function CaseTabsCarousel() {
|
|||||||
].join(" ")}
|
].join(" ")}
|
||||||
aria-label="다음"
|
aria-label="다음"
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/icon_right_arrow.png"
|
src="/images/landing/icon_right_arrow.png"
|
||||||
alt="다음"
|
alt="다음"
|
||||||
className="w-6 h-6 object-contain"
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className="w-6 h-6 object-contain"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -513,10 +518,13 @@ export default function CaseTabsCarousel() {
|
|||||||
className="overflow-hidden rounded-[22px] border-2 border-sky-400 bg-white"
|
className="overflow-hidden rounded-[22px] border-2 border-sky-400 bg-white"
|
||||||
>
|
>
|
||||||
<div className="h-[241px] w-full bg-slate-100 border-b border-b-blue-300">
|
<div className="h-[241px] w-full bg-slate-100 border-b border-b-blue-300">
|
||||||
<img
|
<Image
|
||||||
src={c.imageSrc}
|
src={c.imageSrc}
|
||||||
alt={c.title}
|
alt={c.title}
|
||||||
|
width={640}
|
||||||
|
height={241}
|
||||||
className="h-full w-full object-cover"
|
className="h-full w-full object-cover"
|
||||||
|
style={{ width: "100%", height: "100%" }}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_components/ImageSlider.tsx
|
// apps/dm/app/(landing)/reuse/_components/ImageSlider.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
type Slide = { src: string; alt?: string };
|
type Slide = { src: string; alt?: string };
|
||||||
@@ -86,10 +87,12 @@ export default function CaseImageSlider({
|
|||||||
w-[80px] h-[80px] rounded-full border border-black/20 bg-white
|
w-[80px] h-[80px] rounded-full border border-black/20 bg-white
|
||||||
grid place-items-center shadow-sm hover:bg-black/[0.03]"
|
grid place-items-center shadow-sm hover:bg-black/[0.03]"
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/icon_left_arrow.png"
|
src="/images/landing/icon_left_arrow.png"
|
||||||
alt="이전"
|
alt="이전"
|
||||||
className="w-[12px] h-[22px]"
|
width={12}
|
||||||
|
height={22}
|
||||||
|
className="w-[12px] h-[22px]"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -102,10 +105,12 @@ export default function CaseImageSlider({
|
|||||||
w-[80px] h-[80px] rounded-full border border-black/20 bg-white
|
w-[80px] h-[80px] rounded-full border border-black/20 bg-white
|
||||||
grid place-items-center shadow-sm hover:bg-black/[0.03]"
|
grid place-items-center shadow-sm hover:bg-black/[0.03]"
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/icon_right_arrow.png"
|
src="/images/landing/icon_right_arrow.png"
|
||||||
alt="다음"
|
alt="다음"
|
||||||
className="w-[12px] h-[22px]"
|
width={12}
|
||||||
|
height={22}
|
||||||
|
className="w-[12px] h-[22px]"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -129,10 +134,13 @@ export default function CaseImageSlider({
|
|||||||
>
|
>
|
||||||
{safeSlides.map((s, i) => (
|
{safeSlides.map((s, i) => (
|
||||||
<div key={`${s.src}-${i}`} className="min-w-full">
|
<div key={`${s.src}-${i}`} className="min-w-full">
|
||||||
<img
|
<Image
|
||||||
src={s.src}
|
src={s.src}
|
||||||
alt={s.alt ?? `slide-${i + 1}`}
|
alt={s.alt ?? `slide-${i + 1}`}
|
||||||
|
width={583}
|
||||||
|
height={400}
|
||||||
className="w-full h-full object-contain"
|
className="w-full h-full object-contain"
|
||||||
|
style={{ width: "100%", height: "100%" }}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_components/Lnb.tsx
|
// apps/dm/app/(landing)/reuse/_components/Lnb.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
@@ -29,7 +30,15 @@ export default function Lnb({ title, items }: { title: string; items: LnbItem[]
|
|||||||
const [openLabel, setOpenLabel] = useState<string | null>(defaultOpenLabel);
|
const [openLabel, setOpenLabel] = useState<string | null>(defaultOpenLabel);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="w-[260px] min-w-[260px] shrink-0">
|
<aside
|
||||||
|
className={[
|
||||||
|
"fixed left-0 top-[83px]", // ✅ 화면 고정 + TopNav 아래로
|
||||||
|
"w-[260px] min-w-[260px] shrink-0",
|
||||||
|
"h-[calc(100vh-83px)]", // ✅ 남은 높이만큼
|
||||||
|
"overflow-y-auto", // ✅ LNB 내부 스크롤
|
||||||
|
"bg-white z-50", // ✅ 겹침 방지
|
||||||
|
].join(" ")}
|
||||||
|
>
|
||||||
{/* 타이틀 */}
|
{/* 타이틀 */}
|
||||||
<div
|
<div
|
||||||
className="h-[120px] flex items-center justify-center
|
className="h-[120px] flex items-center justify-center
|
||||||
@@ -81,10 +90,12 @@ export default function Lnb({ title, items }: { title: string; items: LnbItem[]
|
|||||||
isOpen ? "rotate-180" : "rotate-0",
|
isOpen ? "rotate-180" : "rotate-0",
|
||||||
].join(" ")}
|
].join(" ")}
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/drop_arrow.svg"
|
src="/images/landing/drop_arrow.svg"
|
||||||
alt="드롭다운 화살표 아이콘"
|
alt="드롭다운 화살표 아이콘"
|
||||||
className="w-7 h-7"
|
width={28}
|
||||||
|
height={28}
|
||||||
|
className="w-7 h-7"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -0,0 +1,298 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
|
export type AddrItem = {
|
||||||
|
zipNo: string; // 우편번호
|
||||||
|
roadAddr: string; // 도로명주소(전체 문장)
|
||||||
|
jibunAddr: string; // 지번주소
|
||||||
|
};
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
onSelect: (item: AddrItem) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PostcodeApiResponse = {
|
||||||
|
totalCount?: number;
|
||||||
|
items?: AddrItem[];
|
||||||
|
};
|
||||||
|
|
||||||
|
function useDebouncedValue<T>(value: T, delay = 250) {
|
||||||
|
const [v, setV] = useState(value);
|
||||||
|
useEffect(() => {
|
||||||
|
const t = setTimeout(() => setV(value), delay);
|
||||||
|
return () => clearTimeout(t);
|
||||||
|
}, [value, delay]);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A: 추천은 roadAddr 전체 문장
|
||||||
|
const normalize = (s: string) => s.replace(/\s+/g, " ").trim();
|
||||||
|
|
||||||
|
const makeSuggestionsA = (list: AddrItem[], keyword: string, limit = 7) => {
|
||||||
|
const key = normalize(keyword);
|
||||||
|
|
||||||
|
const roadAddrs = list
|
||||||
|
.map((x) => x.roadAddr)
|
||||||
|
.filter((v): v is string => typeof v === "string" && v.trim().length > 0)
|
||||||
|
.map(normalize);
|
||||||
|
|
||||||
|
const uniq = Array.from(new Set(roadAddrs));
|
||||||
|
|
||||||
|
// 입력어 포함 우선 + 짧은 주소 우선
|
||||||
|
uniq.sort((a, b) => {
|
||||||
|
const ai = a.includes(key) ? 0 : 1;
|
||||||
|
const bi = b.includes(key) ? 0 : 1;
|
||||||
|
if (ai !== bi) return ai - bi;
|
||||||
|
return a.length - b.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
return uniq.slice(0, limit);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function PostcodeModal({ open, onClose, onSelect }: Props) {
|
||||||
|
const [mounted, setMounted] = useState(false);
|
||||||
|
|
||||||
|
const [q, setQ] = useState("");
|
||||||
|
const dq = useDebouncedValue(q, 250);
|
||||||
|
|
||||||
|
const [suggestions, setSuggestions] = useState<string[]>([]);
|
||||||
|
const [items, setItems] = useState<AddrItem[]>([]);
|
||||||
|
const [total, setTotal] = useState(0);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => setMounted(true), []);
|
||||||
|
|
||||||
|
// open 시: body scroll lock + focus + ESC
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
|
||||||
|
const prevOverflow = document.body.style.overflow;
|
||||||
|
document.body.style.overflow = "hidden";
|
||||||
|
|
||||||
|
setTimeout(() => inputRef.current?.focus(), 50);
|
||||||
|
|
||||||
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") onClose();
|
||||||
|
};
|
||||||
|
window.addEventListener("keydown", onKeyDown);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = prevOverflow;
|
||||||
|
window.removeEventListener("keydown", onKeyDown);
|
||||||
|
};
|
||||||
|
}, [open, onClose]);
|
||||||
|
|
||||||
|
// 검색/추천/리스트 갱신
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
|
||||||
|
const keyword = dq.trim();
|
||||||
|
|
||||||
|
if (!keyword) {
|
||||||
|
setSuggestions([]);
|
||||||
|
setItems([]);
|
||||||
|
setTotal(0);
|
||||||
|
setLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let alive = true;
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await fetch(`/api/postcode?query=${encodeURIComponent(keyword)}&page=1`, {
|
||||||
|
cache: "no-store",
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = (await res.json()) as PostcodeApiResponse;
|
||||||
|
|
||||||
|
if (!alive) return;
|
||||||
|
|
||||||
|
const list: AddrItem[] = data.items ?? [];
|
||||||
|
const totalCount: number = data.totalCount ?? 0;
|
||||||
|
|
||||||
|
setItems(list);
|
||||||
|
setTotal(totalCount);
|
||||||
|
|
||||||
|
// ✅ A: roadAddr 전체 문장 추천
|
||||||
|
const sug = makeSuggestionsA(list, keyword, 7);
|
||||||
|
setSuggestions(sug);
|
||||||
|
} catch {
|
||||||
|
if (!alive) return;
|
||||||
|
setItems([]);
|
||||||
|
setTotal(0);
|
||||||
|
setSuggestions([]);
|
||||||
|
} finally {
|
||||||
|
if (alive) setLoading(false);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
alive = false;
|
||||||
|
};
|
||||||
|
}, [dq, open]);
|
||||||
|
|
||||||
|
const showSuggest = open && q.trim().length > 0 && suggestions.length > 0;
|
||||||
|
|
||||||
|
if (!mounted || !open) return null;
|
||||||
|
|
||||||
|
return createPortal(
|
||||||
|
<div className="fixed inset-0 z-[9999]">
|
||||||
|
{/* overlay */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="absolute inset-0 bg-black/40"
|
||||||
|
aria-label="닫기"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* panel wrapper */}
|
||||||
|
<div className="absolute inset-0 flex items-center justify-center p-6">
|
||||||
|
<div
|
||||||
|
className="relative w-full max-w-[520px] rounded-2xl bg-white shadow-[0_20px_60px_rgba(0,0,0,0.18)]"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-label="우편번호 검색"
|
||||||
|
>
|
||||||
|
{/* header */}
|
||||||
|
<div className="flex items-center justify-between px-7 pt-6 pb-4">
|
||||||
|
<h2 className="text-[22px] font-extrabold tracking-tight text-slate-900">
|
||||||
|
우편번호 검색
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onClose}
|
||||||
|
className="grid h-9 w-9 place-items-center rounded-full hover:bg-slate-100"
|
||||||
|
aria-label="닫기"
|
||||||
|
>
|
||||||
|
<span className="text-[18px] leading-none">✕</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* search input */}
|
||||||
|
<div className="px-7 pb-4">
|
||||||
|
<div className="relative">
|
||||||
|
<input
|
||||||
|
ref={inputRef}
|
||||||
|
value={q}
|
||||||
|
onChange={(e) => setQ(e.target.value)}
|
||||||
|
placeholder="주소검색"
|
||||||
|
className={[
|
||||||
|
"w-full rounded-md border px-4 py-3 pr-12 text-[14px] outline-none",
|
||||||
|
"border-slate-300 focus:border-sky-500 focus:ring-2 focus:ring-sky-200",
|
||||||
|
].join(" ")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="absolute right-3 top-1/2 -translate-y-1/2 grid h-9 w-9 place-items-center rounded-full hover:bg-slate-100 text-[#01ACE5]"
|
||||||
|
aria-label="검색"
|
||||||
|
onClick={() => setQ((v) => v.trim())}
|
||||||
|
>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path
|
||||||
|
d="M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M21 21l-4.3-4.3"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{/* suggestions dropdown */}
|
||||||
|
{showSuggest && (
|
||||||
|
<div className="absolute left-0 right-0 top-[calc(100%+6px)] z-10 overflow-hidden rounded-md border border-slate-200 bg-white shadow-lg">
|
||||||
|
{suggestions.map((s) => (
|
||||||
|
<button
|
||||||
|
key={s}
|
||||||
|
type="button"
|
||||||
|
className="flex w-full items-center justify-between px-4 py-3 text-left text-[14px] hover:bg-slate-50"
|
||||||
|
onClick={() => {
|
||||||
|
// ✅ 추천 클릭 → 입력값 채우고 드롭다운 닫기 + 포커스 유지
|
||||||
|
setQ(s);
|
||||||
|
setSuggestions([]);
|
||||||
|
requestAnimationFrame(() => inputRef.current?.focus());
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="truncate text-slate-800">{s}</span>
|
||||||
|
<span className="ml-4 text-slate-400">↵</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* results */}
|
||||||
|
<div className="px-7 pb-7">
|
||||||
|
<div className="mb-3 text-[13px] text-slate-500">
|
||||||
|
{q.trim()
|
||||||
|
? loading
|
||||||
|
? "검색 중…"
|
||||||
|
: `총 ${total.toLocaleString()}개의 검색결과`
|
||||||
|
: "주소를 입력하면 검색결과가 표시됩니다."}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="max-h-[420px] overflow-y-auto pr-1">
|
||||||
|
{!loading && q.trim() && items.length === 0 && (
|
||||||
|
<div className="rounded-lg border border-slate-200 p-4 text-[14px] text-slate-600">
|
||||||
|
검색 결과가 없습니다.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="space-y-3">
|
||||||
|
{items.map((it) => (
|
||||||
|
<button
|
||||||
|
key={`${it.zipNo}-${it.roadAddr}`}
|
||||||
|
type="button"
|
||||||
|
onClick={() => onSelect(it)}
|
||||||
|
className={[
|
||||||
|
"w-full rounded-lg border p-4 text-left transition",
|
||||||
|
"border-slate-200 hover:border-sky-300 hover:bg-sky-50/30",
|
||||||
|
].join(" ")}
|
||||||
|
>
|
||||||
|
<div className="text-[20px] font-extrabold tracking-tight text-slate-900">
|
||||||
|
{it.zipNo}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-2 flex items-start gap-2">
|
||||||
|
<span className="w-[52px] shrink-0 mt-[2px] inline-flex items-center justify-center rounded-full border border-sky-400 px-2 py-[2px] text-[12px] font-semibold text-sky-600">
|
||||||
|
도로명
|
||||||
|
</span>
|
||||||
|
<p className="text-[14px] leading-6 text-slate-700">
|
||||||
|
{it.roadAddr}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-1 flex items-start gap-2">
|
||||||
|
<span className="w-[52px] shrink-0 mt-[2px] inline-flex items-center justify-center rounded-full border border-[#6DBB4F] px-2 py-[2px] text-[12px] font-semibold text-[#6DBB4F]">
|
||||||
|
지번
|
||||||
|
</span>
|
||||||
|
<p className="text-[14px] leading-6 text-slate-700">
|
||||||
|
{it.jibunAddr}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>,
|
||||||
|
document.body
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,10 +19,10 @@ export default function SubPageHeader({
|
|||||||
title,
|
title,
|
||||||
crumbs,
|
crumbs,
|
||||||
note = "* 는 필수 값입니다.",
|
note = "* 는 필수 값입니다.",
|
||||||
underlineWidthClass = "w-40",
|
// underlineWidthClass = "w-40",
|
||||||
className = "",
|
className = "",
|
||||||
wrapClassName = "",
|
wrapClassName = "",
|
||||||
hideFooterLine = false,
|
// hideFooterLine = false,
|
||||||
hideGuideText = false,
|
hideGuideText = false,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_components/TopNav.tsx
|
// apps/dm/app/(landing)/reuse/_components/TopNav.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useEffect, useId, useState } from "react";
|
import { useEffect, useId, useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -80,7 +81,8 @@ function DemandLoginModal({ open, onClose, onSuccess }: LoginModalProps) {
|
|||||||
if (noWorker) {
|
if (noWorker) {
|
||||||
setWorkerNo("");
|
setWorkerNo("");
|
||||||
setErrors((p) => {
|
setErrors((p) => {
|
||||||
const { workerNo: _w, ...rest } = p;
|
const { ...rest } = p;
|
||||||
|
delete rest.workerNo;
|
||||||
return rest;
|
return rest;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -366,10 +368,13 @@ export default function TopNav() {
|
|||||||
{/* 좌측: 로고 */}
|
{/* 좌측: 로고 */}
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Link href="/reuse" className="flex items-center">
|
<Link href="/reuse" className="flex items-center">
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/logo.png"
|
src="/images/landing/logo.png"
|
||||||
alt="HASUON"
|
alt="HASUON"
|
||||||
|
width={229}
|
||||||
|
height={46}
|
||||||
className="h-9 w-auto"
|
className="h-9 w-auto"
|
||||||
|
priority
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -422,7 +427,13 @@ export default function TopNav() {
|
|||||||
>
|
>
|
||||||
로그인
|
로그인
|
||||||
<span aria-hidden>
|
<span aria-hidden>
|
||||||
<img src="/images/landing/icon_login.png" alt="로그인 아이콘" className="h-6 w-6 object-contain ml-1"/>
|
<Image
|
||||||
|
src="/images/landing/icon_login.png"
|
||||||
|
alt="로그인 아이콘"
|
||||||
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className="h-6 w-6 object-contain ml-1"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
@@ -437,7 +448,13 @@ export default function TopNav() {
|
|||||||
>
|
>
|
||||||
로그아웃
|
로그아웃
|
||||||
<span aria-hidden>
|
<span aria-hidden>
|
||||||
<img src="/images/landing/icon_logout.png" alt="로그아웃 아이콘" className="h-6 w-6 object-contain"/>
|
<Image
|
||||||
|
src="/images/landing/icon_logout.png"
|
||||||
|
alt="로그아웃 아이콘"
|
||||||
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className="h-6 w-6 object-contain"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import type { LnbItem } from "../_components/Lnb";
|
import type { LnbItem } from "../_components/Lnb";
|
||||||
|
|
||||||
export const LNB_DEMAND: LnbItem[] = [
|
export const LNB_DEMAND: LnbItem[] = [
|
||||||
{ href: "/reuse/apply/place", label: "수요처등록" },
|
{ href: "/reuse/apply/place", label: "수요처" },
|
||||||
{ href: "/reuse/apply/register", label: "수요정보등록" },
|
{ href: "/reuse/apply/register", label: "수요정보등록" },
|
||||||
{ href: "/reuse/apply/status", label: "수요신청현황" },
|
{ href: "/reuse/apply/status", label: "수요신청현황" },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* IntersectionObserver로 각 section의 화면 노출 비율을 계산해서 가장 많이 보이는 section을 activeId로 만든다
|
||||||
|
*/
|
||||||
"use client";
|
"use client";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
|
const DEFAULT_THRESHOLD = [0, 0.01, 0.1, 0.25, 0.5, 0.75];
|
||||||
|
|
||||||
export function useScrollSpy(sectionIds: string[], options?: IntersectionObserverInit) {
|
export function useScrollSpy(sectionIds: string[], options?: IntersectionObserverInit) {
|
||||||
const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
|
const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
|
||||||
const ratiosRef = useRef<Map<string, number>>(new Map());
|
const ratiosRef = useRef<Map<string, number>>(new Map());
|
||||||
|
const activeIdRef = useRef(activeId);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
activeIdRef.current = activeId;
|
||||||
|
}, [activeId]);
|
||||||
|
|
||||||
|
const threshold = options?.threshold ?? DEFAULT_THRESHOLD;
|
||||||
|
const thresholdKey = Array.isArray(threshold) ? threshold.join("|") : String(threshold);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const els = sectionIds
|
const els = sectionIds
|
||||||
@@ -26,7 +39,7 @@ export function useScrollSpy(sectionIds: string[], options?: IntersectionObserve
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ✅ 전체 섹션 중 가장 ratio 큰 항목을 active로
|
// ✅ 전체 섹션 중 가장 ratio 큰 항목을 active로
|
||||||
let bestId = activeId;
|
let bestId = activeIdRef.current;
|
||||||
let bestRatio = -1;
|
let bestRatio = -1;
|
||||||
|
|
||||||
for (const [id, ratio] of ratiosRef.current.entries()) {
|
for (const [id, ratio] of ratiosRef.current.entries()) {
|
||||||
@@ -39,17 +52,15 @@ export function useScrollSpy(sectionIds: string[], options?: IntersectionObserve
|
|||||||
if (bestId) setActiveId(bestId);
|
if (bestId) setActiveId(bestId);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: null,
|
root: options?.root ?? null,
|
||||||
threshold: [0, 0.01, 0.1, 0.25, 0.5, 0.75],
|
threshold,
|
||||||
rootMargin: DEFAULT_ROOT_MARGIN,
|
rootMargin: options?.rootMargin ?? DEFAULT_ROOT_MARGIN,
|
||||||
...options,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
els.forEach((el) => io.observe(el));
|
els.forEach((el) => io.observe(el));
|
||||||
return () => io.disconnect();
|
return () => io.disconnect();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [sectionIds, options?.root, options?.rootMargin, threshold, thresholdKey]);
|
||||||
}, [sectionIds.join("|"), options?.rootMargin, JSON.stringify(options?.threshold)]);
|
|
||||||
|
|
||||||
return activeId;
|
return activeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_sections/Cases.tsx
|
// apps/dm/app/(landing)/reuse/_sections/Cases.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
|
import section03 from "@/public/images/landing/section_03.png";
|
||||||
|
|
||||||
export default function Cases() {
|
export default function Cases() {
|
||||||
return (
|
return (
|
||||||
<section id="cases" className="bg-[#EAF6F6]">
|
<section id="cases" className="bg-[#EAF6F6]">
|
||||||
@@ -50,10 +53,11 @@ export default function Cases() {
|
|||||||
w-full max-w-[720px]
|
w-full max-w-[720px]
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<img
|
<Image
|
||||||
src="/images/landing/section_03.png"
|
src={section03}
|
||||||
alt="물 재이용 현황 데이터 테이블"
|
alt="물 재이용 현황 데이터 테이블"
|
||||||
className="w-full h-auto object-cover"
|
className="w-full h-auto object-cover"
|
||||||
|
style={{ width: "100%", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,4 +66,4 @@ export default function Cases() {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_sections/Hero.tsx
|
// apps/dm/app/(landing)/reuse/_sections/Hero.tsx
|
||||||
|
import Image from "next/image";
|
||||||
import styles from "../reuse.module.css";
|
import styles from "../reuse.module.css";
|
||||||
|
|
||||||
export default function Hero() {
|
export default function Hero() {
|
||||||
@@ -21,9 +22,15 @@ export default function Hero() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="absolute inset-x-0 bottom-[120px] flex flex-col items-center justify-items-center gap-2 mt-10">
|
<div className="absolute inset-x-0 bottom-[120px] flex flex-col items-center justify-items-center gap-2 mt-10">
|
||||||
<img src="/images/landing/scroll_down.svg" alt="" className="w-[26px] h-[40px]" />
|
<Image
|
||||||
|
src="/images/landing/scroll_down.svg"
|
||||||
|
alt=""
|
||||||
|
width={26}
|
||||||
|
height={40}
|
||||||
|
className="w-[26px] h-[40px]"
|
||||||
|
/>
|
||||||
<span className="text-white/80 text-base tracking-[.25em]">scroll down</span>
|
<span className="text-white/80 text-base tracking-[.25em]">scroll down</span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
// apps/dm/app/(landing)/reuse/_sections/IntroCards.tsx
|
// apps/dm/app/(landing)/reuse/_sections/IntroCards.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import card01 from "@/public/images/landing/card_01.jpg";
|
||||||
|
import card02 from "@/public/images/landing/card_02.jpg";
|
||||||
|
import card03 from "@/public/images/landing/card_03.jpg";
|
||||||
|
import card04 from "@/public/images/landing/card_04.jpg";
|
||||||
|
|
||||||
type IntroCardItem = {
|
type IntroCardItem = {
|
||||||
title: string;
|
title: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
image: string;
|
image: StaticImageData;
|
||||||
href: string;
|
href: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -14,25 +19,25 @@ const INTRO_CARDS: IntroCardItem[] = [
|
|||||||
{
|
{
|
||||||
title: "물 재이용 법",
|
title: "물 재이용 법",
|
||||||
desc: "물의 재이용 촉진 및 지원에 관한 법률을 시행하고, 일부 법률은 개정되었습니다.",
|
desc: "물의 재이용 촉진 및 지원에 관한 법률을 시행하고, 일부 법률은 개정되었습니다.",
|
||||||
image: "/images/landing/card_01.jpg",
|
image: card01,
|
||||||
href: "/reuse/intro/law",
|
href: "/reuse/intro/law",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "친환경 수자원 빗물",
|
title: "친환경 수자원 빗물",
|
||||||
desc: "가뭄을 극복하고 홍수를 예방하기 위해 비가 내릴 때 빗물을 모아두었다가 사용합니다.",
|
desc: "가뭄을 극복하고 홍수를 예방하기 위해 비가 내릴 때 빗물을 모아두었다가 사용합니다.",
|
||||||
image: "/images/landing/card_02.jpg",
|
image: card02,
|
||||||
href: "/reuse/intro/rain",
|
href: "/reuse/intro/rain",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "알뜰하게 재이용되는 중수",
|
title: "알뜰하게 재이용되는 중수",
|
||||||
desc: "한번 사용한 물을 중수도 시설을 통해 재생하여 개별적 또는 지역적으로 재이용할 수 있습니다.",
|
desc: "한번 사용한 물을 중수도 시설을 통해 재생하여 개별적 또는 지역적으로 재이용할 수 있습니다.",
|
||||||
image: "/images/landing/card_03.jpg",
|
image: card03,
|
||||||
href: "/reuse/intro/greywater",
|
href: "/reuse/intro/greywater",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "하수처리수 재이용",
|
title: "하수처리수 재이용",
|
||||||
desc: "사용하고 버려진 공공하수처리장으로 모여진 물을 용도에 맞는 처리 후 재이용 할 수 있습니다.",
|
desc: "사용하고 버려진 공공하수처리장으로 모여진 물을 용도에 맞는 처리 후 재이용 할 수 있습니다.",
|
||||||
image: "/images/landing/card_04.jpg",
|
image: card04,
|
||||||
href: "/reuse/intro/treated",
|
href: "/reuse/intro/treated",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -61,10 +66,12 @@ export default function IntroCards() {
|
|||||||
className="group relative h-[280px] md:h-[320px] lg:h-[500px] overflow-hidden rounded-2xl cursor-pointer focus:outline-none focus:ring-2 focus:ring-sky-400/60"
|
className="group relative h-[280px] md:h-[320px] lg:h-[500px] overflow-hidden rounded-2xl cursor-pointer focus:outline-none focus:ring-2 focus:ring-sky-400/60"
|
||||||
>
|
>
|
||||||
{/* 배경 이미지 (이미 그라디언트 포함) */}
|
{/* 배경 이미지 (이미 그라디언트 포함) */}
|
||||||
<img
|
<Image
|
||||||
src={card.image}
|
src={card.image}
|
||||||
alt={card.title}
|
alt={card.title}
|
||||||
className="absolute inset-0 h-full w-full object-cover transition-transform duration-500 hover:scale-105"
|
fill
|
||||||
|
sizes="(min-width: 1024px) 25vw, (min-width: 768px) 50vw, 100vw"
|
||||||
|
className="absolute inset-0 h-full w-full object-cover transition-transform duration-500 hover:scale-105"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 텍스트 영역 */}
|
{/* 텍스트 영역 */}
|
||||||
@@ -83,4 +90,4 @@ export default function IntroCards() {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,327 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
|
export type CandidateSite = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
sewageM3d: number; // 하수처리량
|
||||||
|
reuseM3d: number; // 재이용량
|
||||||
|
// 지도 연동 시 사용(현재는 UI/구조용)
|
||||||
|
lat?: number;
|
||||||
|
lng?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
onApply: (selected: CandidateSite[]) => void;
|
||||||
|
initialSelected?: CandidateSite[];
|
||||||
|
maxSelect?: number; // 기본 3개
|
||||||
|
};
|
||||||
|
|
||||||
|
const MOCK_SITES: CandidateSite[] = [
|
||||||
|
{ id: "1", name: "서호생태 수자원 재이용1", sewageM3d: 1300, reuseM3d: 1300, lat: 35.0, lng: 128.0 },
|
||||||
|
{ id: "2", name: "서호생태 수자원 재이용2", sewageM3d: 1300, reuseM3d: 1300, lat: 35.01, lng: 128.01 },
|
||||||
|
{ id: "3", name: "서호생태 수자원 재이용3", sewageM3d: 1300, reuseM3d: 1300, lat: 35.02, lng: 128.02 },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function CandidateSiteModal({
|
||||||
|
open,
|
||||||
|
onClose,
|
||||||
|
onApply,
|
||||||
|
initialSelected = [],
|
||||||
|
maxSelect = 3,
|
||||||
|
}: Props) {
|
||||||
|
const [q, setQ] = useState("");
|
||||||
|
const [selected, setSelected] = useState<CandidateSite[]>(initialSelected);
|
||||||
|
|
||||||
|
// 지도 마커 컴포넌트
|
||||||
|
function MapMarker({ label }: { label?: string }) {
|
||||||
|
return (
|
||||||
|
<div className="relative -translate-x-1/2 -translate-y-full">
|
||||||
|
<svg width="72" height="66" viewBox="0 0 72 92">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="pinGrad" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0%" stopColor="#2EDAA0" />
|
||||||
|
<stop offset="100%" stopColor="#02A7D8" />
|
||||||
|
</linearGradient>
|
||||||
|
|
||||||
|
<filter id="pinShadow" x="-50%" y="-50%" width="200%" height="200%">
|
||||||
|
<feDropShadow dx="0" dy="2" stdDeviation="2" floodColor="#000" floodOpacity="0.18" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
{/* pin body */}
|
||||||
|
<path
|
||||||
|
filter="url(#pinShadow)"
|
||||||
|
d="M36 2C21 2 9 14 9 29c0 22 24 50 26.4 52.7a2 2 0 0 0 3.2 0C40.9 79 63 51 63 29 63 14 51 2 36 2z"
|
||||||
|
fill="url(#pinGrad)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 내부 흰 원 */}
|
||||||
|
<circle cx="36" cy="29" r="20" fill="#FFFFFF" />
|
||||||
|
|
||||||
|
{label && (
|
||||||
|
<text
|
||||||
|
x="36"
|
||||||
|
y="36"
|
||||||
|
textAnchor="middle"
|
||||||
|
fontSize="18"
|
||||||
|
fontWeight="700"
|
||||||
|
fill="#1F2937"
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</text>
|
||||||
|
)}
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 모달 열릴 때마다 초기 선택값 동기화
|
||||||
|
useEffect(() => {
|
||||||
|
if (open) setSelected(initialSelected);
|
||||||
|
if (open) setQ("");
|
||||||
|
}, [open, initialSelected]);
|
||||||
|
|
||||||
|
// ESC 닫기
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") onClose();
|
||||||
|
};
|
||||||
|
window.addEventListener("keydown", onKeyDown);
|
||||||
|
return () => window.removeEventListener("keydown", onKeyDown);
|
||||||
|
}, [open, onClose]);
|
||||||
|
|
||||||
|
const filtered = useMemo(() => {
|
||||||
|
const keyword = q.trim();
|
||||||
|
if (!keyword) return MOCK_SITES;
|
||||||
|
return MOCK_SITES.filter((s) => s.name.includes(keyword));
|
||||||
|
}, [q]);
|
||||||
|
|
||||||
|
const isSelected = (id: string) => selected.some((s) => s.id === id);
|
||||||
|
|
||||||
|
const toggleSelect = (item: CandidateSite) => {
|
||||||
|
setSelected((prev) => {
|
||||||
|
const exists = prev.some((p) => p.id === item.id);
|
||||||
|
if (exists) return prev.filter((p) => p.id !== item.id);
|
||||||
|
|
||||||
|
if (prev.length >= maxSelect) return prev; // 최대 개수 초과 방지
|
||||||
|
return [...prev, item];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeChip = (id: string) => setSelected((prev) => prev.filter((p) => p.id !== id));
|
||||||
|
|
||||||
|
if (!open) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="fixed inset-0 z-[1000] flex items-center justify-center"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-label="후보지 조회"
|
||||||
|
>
|
||||||
|
{/* overlay */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="absolute inset-0 bg-black/30"
|
||||||
|
aria-label="모달 닫기"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* panel */}
|
||||||
|
<div className="relative w-[94vw] max-w-[1700px] rounded-xl bg-white shadow-xl">
|
||||||
|
{/* header */}
|
||||||
|
<div className="flex items-center justify-between px-8 py-6">
|
||||||
|
<h2 className="text-2xl font-extrabold text-neutral-900">후보지 조회</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label="닫기"
|
||||||
|
onClick={onClose}
|
||||||
|
className="grid h-10 w-10 place-items-center rounded-sm hover:bg-neutral-100"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="h-px w-full bg-neutral-200" />
|
||||||
|
|
||||||
|
{/* body */}
|
||||||
|
<div className="px-8 py-6">
|
||||||
|
<div className="grid grid-cols-12 gap-6">
|
||||||
|
{/* left: search + table */}
|
||||||
|
<div className="col-span-12 lg:col-span-5">
|
||||||
|
<div className="mb-3 text-lg font-semibold text-neutral-900">후보지 검색</div>
|
||||||
|
|
||||||
|
<div className="relative">
|
||||||
|
<input
|
||||||
|
value={q}
|
||||||
|
onChange={(e) => setQ(e.target.value)}
|
||||||
|
placeholder="주소검색"
|
||||||
|
className="h-12 w-full rounded-sm border border-neutral-300 bg-white px-4 pr-12 text-sm outline-none focus:border-sky-500"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label="검색"
|
||||||
|
onClick={() => setQ((v) => v.trim())}
|
||||||
|
className="absolute right-2 top-1/2 -translate-y-1/2 grid h-9 w-9 place-items-center rounded-full text-[#01ACE5] hover:bg-slate-100"
|
||||||
|
>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path
|
||||||
|
d="M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M21 21l-4.3-4.3"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* table header */}
|
||||||
|
<div className="mt-4 overflow-hidden rounded-sm border border-neutral-200">
|
||||||
|
<div className="grid grid-cols-12 bg-emerald-50/70 px-4 py-3 text-sm font-semibold text-neutral-800">
|
||||||
|
<div className="col-span-6 flex items-center justify-center">시설명</div>
|
||||||
|
<div className="col-span-2 text-center">
|
||||||
|
하수처리량<br />(m³/일)
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2 text-center">
|
||||||
|
재이용량<br />(m³/일)
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2 text-center">선택</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* rows */}
|
||||||
|
<div className="max-h-[420px] overflow-auto">
|
||||||
|
{filtered.length === 0 ? (
|
||||||
|
<div className="px-4 py-10 text-center text-sm text-neutral-500">
|
||||||
|
검색 결과가 없습니다.
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
filtered.map((s, idx) => {
|
||||||
|
const picked = isSelected(s.id);
|
||||||
|
const disabled = !picked && selected.length >= maxSelect;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={s.id}
|
||||||
|
className="grid grid-cols-12 items-center gap-2 border-t border-neutral-200 px-4 py-3 text-sm"
|
||||||
|
>
|
||||||
|
<div className="col-span-6 truncate">
|
||||||
|
<span className="mr-2 text-neutral-500">{idx + 1}</span>
|
||||||
|
{s.name}
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2 text-center">{s.sewageM3d.toLocaleString()}</div>
|
||||||
|
<div className="col-span-2 text-center">{s.reuseM3d.toLocaleString()}</div>
|
||||||
|
<div className="col-span-2 flex justify-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={() => toggleSelect(s)}
|
||||||
|
className={[
|
||||||
|
"h-8 rounded-sm px-3 text-xs",
|
||||||
|
picked ? "bg-gray-600 text-white" : "bg-sky-500 text-white hover:bg-sky-600",
|
||||||
|
disabled ? "cursor-not-allowed opacity-40" : "",
|
||||||
|
].join(" ")}
|
||||||
|
>
|
||||||
|
{picked ? "해제" : "선택"}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="mt-2 text-xs text-neutral-500">
|
||||||
|
최대 {maxSelect}개까지 선택 가능합니다.
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* right: map */}
|
||||||
|
<div className="col-span-12 lg:col-span-7">
|
||||||
|
<div className="h-[520px] w-full overflow-hidden rounded-sm border border-neutral-200 bg-neutral-50 relative">
|
||||||
|
{/* TODO: 실제 지도 SDK 연동 시 이 영역 교체 */}
|
||||||
|
<div className="absolute inset-0 grid place-items-center text-sm text-neutral-500">
|
||||||
|
지도 영역(추후 지도 SDK 연동)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 선택된 항목의 "가짜 마커" */}
|
||||||
|
{selected.map((s, i) => {
|
||||||
|
const POS = [
|
||||||
|
{ top: "40%", left: "45%" },
|
||||||
|
{ top: "25%", left: "75%" },
|
||||||
|
{ top: "70%", left: "80%" },
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
const pos = POS[i % POS.length] ?? POS[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={s.id}
|
||||||
|
className="absolute"
|
||||||
|
style={{ top: pos.top, left: pos.left }}
|
||||||
|
>
|
||||||
|
<MapMarker label={String(i + 1)} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* selected chips */}
|
||||||
|
<div className="mt-6">
|
||||||
|
<div className="mb-2 text-lg font-semibold text-neutral-900">
|
||||||
|
선택된 시설 <span className="text-sm font-normal text-neutral-500">(시설명/하수처리량(m³/일)/재이용량(m³/일))</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="min-h-[52px] rounded-sm border border-neutral-200 bg-white px-4 py-3">
|
||||||
|
{selected.length === 0 ? (
|
||||||
|
<div className="text-sm text-neutral-500">선택된 시설이 없습니다.</div>
|
||||||
|
) : (
|
||||||
|
<div className="flex flex-wrap gap-3">
|
||||||
|
{selected.map((s) => (
|
||||||
|
<div
|
||||||
|
key={s.id}
|
||||||
|
className="inline-flex items-center gap-3 rounded-sm bg-[#EAF5F5] px-4 py-3 text-sm text-[#01ACE5]"
|
||||||
|
>
|
||||||
|
<span className="font-medium">
|
||||||
|
{s.name} / {s.sewageM3d.toLocaleString()}(m³/일) / {s.reuseM3d.toLocaleString()}(m³/일)
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label="삭제"
|
||||||
|
onClick={() => removeChip(s.id)}
|
||||||
|
className="grid h-7 w-7 place-items-center rounded-sm hover:bg-sky-100 text-neutral-700 font-semibold"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* footer button */}
|
||||||
|
<div className="mt-6 flex justify-center pb-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => onApply(selected)}
|
||||||
|
className="h-11 rounded-sm bg-[#0B4EA2] px-10 text-base text-white hover:opacity-90"
|
||||||
|
>
|
||||||
|
후보지 확인 및 적용
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,544 @@
|
|||||||
|
// apps/dm/app/(landing)/reuse/apply/modal/SimilarCaseModal.tsx (유사사례 모달)
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useMemo, useState, useId } from "react";
|
||||||
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
|
type Criterion = "" | "supplyAmt" | "treatment" | "usePurpose";
|
||||||
|
|
||||||
|
export type SimilarCaseRow = {
|
||||||
|
caseId: string;
|
||||||
|
projectName: string;
|
||||||
|
period: string;
|
||||||
|
|
||||||
|
supplyFacilityType?: string;
|
||||||
|
supplyName?: string;
|
||||||
|
supplyCapacity?: number;
|
||||||
|
|
||||||
|
demandName?: string;
|
||||||
|
demandAddress?: string;
|
||||||
|
|
||||||
|
facilityCapacity?: number;
|
||||||
|
pipeKm?: number;
|
||||||
|
purpose?: string;
|
||||||
|
|
||||||
|
// 유사기준용
|
||||||
|
supplyAmt?: number; // 공급량(m3/일)
|
||||||
|
treatment?: string; // 처리공법
|
||||||
|
usePurpose?: string; // 이용용도
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SimilarCaseDetail = {
|
||||||
|
// 보증수질
|
||||||
|
coliform?: string;
|
||||||
|
residualCl?: string;
|
||||||
|
turbidity?: string;
|
||||||
|
bod?: string;
|
||||||
|
odor?: string;
|
||||||
|
color?: string;
|
||||||
|
tn?: string;
|
||||||
|
tp?: string;
|
||||||
|
ph?: string;
|
||||||
|
chloride?: string;
|
||||||
|
ec?: string;
|
||||||
|
note?: string;
|
||||||
|
|
||||||
|
// 소요사업비(백만원) - 현재 타입에 있는 항목만 매핑
|
||||||
|
costTotal?: number;
|
||||||
|
costFacility?: number;
|
||||||
|
costPipe?: number;
|
||||||
|
costDesign?: number;
|
||||||
|
costSupervision?: number;
|
||||||
|
costOther?: number;
|
||||||
|
|
||||||
|
// 재원조달계획(백만원)
|
||||||
|
fundingTotal?: number;
|
||||||
|
fundingNational?: number;
|
||||||
|
fundingLocal?: number;
|
||||||
|
fundingSelf?: number;
|
||||||
|
fundingRate?: number; // %
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatNumber(v: any) {
|
||||||
|
if (v === null || v === undefined || v === "" || Number.isNaN(Number(v))) return "-";
|
||||||
|
const n = typeof v === "number" ? v : Number(String(v).replaceAll(",", ""));
|
||||||
|
if (!Number.isFinite(n)) return "-";
|
||||||
|
return n.toLocaleString("ko-KR");
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SimilarCaseModal({
|
||||||
|
open,
|
||||||
|
onClose,
|
||||||
|
rows,
|
||||||
|
detailsByCaseId,
|
||||||
|
onSearch
|
||||||
|
}: {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
rows: SimilarCaseRow[];
|
||||||
|
detailsByCaseId: Record<string, SimilarCaseDetail | undefined>;
|
||||||
|
onSearch :(criterion: Criterion) => void;
|
||||||
|
}) {
|
||||||
|
const titleId = useId();
|
||||||
|
|
||||||
|
const [mounted, setMounted] = useState(false);
|
||||||
|
const [criterion, setCriterion] = useState<Criterion>("supplyAmt");
|
||||||
|
const [selectedCaseId, setSelectedCaseId] = useState<string>("");
|
||||||
|
|
||||||
|
useEffect(() => setMounted(true), []);
|
||||||
|
|
||||||
|
// 모달 열릴 때 초기화
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
setCriterion("supplyAmt");
|
||||||
|
onSearch("supplyAmt");
|
||||||
|
setSelectedCaseId("");
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
|
// ESC 닫기 + 배경 스크롤 잠금
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
|
||||||
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") onClose();
|
||||||
|
};
|
||||||
|
window.addEventListener("keydown", onKeyDown);
|
||||||
|
|
||||||
|
const prevOverflow = document.body.style.overflow;
|
||||||
|
document.body.style.overflow = "hidden";
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("keydown", onKeyDown);
|
||||||
|
document.body.style.overflow = prevOverflow;
|
||||||
|
};
|
||||||
|
}, [open, onClose]);
|
||||||
|
|
||||||
|
const groupInfo = useMemo(() => {
|
||||||
|
const counts = new Map<string, number>();
|
||||||
|
rows.forEach((r) => counts.set(r.caseId, (counts.get(r.caseId) ?? 0) + 1));
|
||||||
|
|
||||||
|
const firstIndex = new Map<string, number>();
|
||||||
|
rows.forEach((r, idx) => {
|
||||||
|
if (!firstIndex.has(r.caseId)) firstIndex.set(r.caseId, idx);
|
||||||
|
});
|
||||||
|
|
||||||
|
return { counts, firstIndex };
|
||||||
|
}, [rows]);
|
||||||
|
|
||||||
|
const selectedDetail = selectedCaseId ? detailsByCaseId[selectedCaseId] : undefined;
|
||||||
|
|
||||||
|
// open 타입 방어
|
||||||
|
if (typeof open !== "boolean") {
|
||||||
|
console.error("SimilarCaseModal: open prop is not boolean:", open);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!open || !mounted) return null;
|
||||||
|
|
||||||
|
const tdBase =
|
||||||
|
"border border-[#C9C9C9] px-2 py-2 text-sm text-neutral-800 align-middle";
|
||||||
|
const thBase =
|
||||||
|
"border border-[#C9C9C9] bg-[#E7F4E2] px-2 py-2 text-sm font-semibold text-neutral-800 text-center align-middle";
|
||||||
|
|
||||||
|
const highlightTd = "bg-neutral-200";
|
||||||
|
|
||||||
|
const showList = criterion !== "";
|
||||||
|
const hasRows = rows.length > 0;
|
||||||
|
|
||||||
|
const ui = (
|
||||||
|
<div className="fixed inset-0 z-[1000] flex items-center justify-center">
|
||||||
|
{/* overlay */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="absolute inset-0 bg-black/30"
|
||||||
|
aria-label="모달 닫기"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* panel */}
|
||||||
|
<div
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby={titleId}
|
||||||
|
className="relative w-[94vw] max-w-[1700px] rounded-xl bg-white shadow-xl"
|
||||||
|
>
|
||||||
|
{/* header */}
|
||||||
|
<div className="flex items-center justify-between px-8 py-6">
|
||||||
|
<h2 id={titleId} className="text-2xl font-extrabold text-neutral-900">
|
||||||
|
유사사례 조회
|
||||||
|
</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label="닫기"
|
||||||
|
onClick={onClose}
|
||||||
|
className="grid h-10 w-10 place-items-center rounded-sm hover:bg-neutral-100 focus:outline-none focus:ring-2 focus:ring-neutral-300"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="h-px w-full bg-neutral-200" />
|
||||||
|
|
||||||
|
{/* body */}
|
||||||
|
<div className="px-8 py-6">
|
||||||
|
{/* 상단 타이틀 + 유사기준 */}
|
||||||
|
<div className="mb-4 flex items-center justify-between">
|
||||||
|
<div className="text-lg font-semibold text-neutral-900">
|
||||||
|
물 재이용 사업 유사 사례
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<span className="text-sm font-semibold text-neutral-800">유사기준</span>
|
||||||
|
<select
|
||||||
|
value={criterion}
|
||||||
|
onChange={(e) => {
|
||||||
|
const v = e.target.value as Criterion;
|
||||||
|
setCriterion(v);
|
||||||
|
setSelectedCaseId("");
|
||||||
|
|
||||||
|
if(v){
|
||||||
|
onSearch(v);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="h-10 w-[180px] rounded-md border border-neutral-300 bg-white px-3 text-sm outline-none focus:border-neutral-500"
|
||||||
|
>
|
||||||
|
<option value="supplyAmt">공급량</option>
|
||||||
|
<option value="usePurpose">이용용도</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 리스트 영역 */}
|
||||||
|
<div className="border border-[#C9C9C9] bg-white">
|
||||||
|
{!showList ? (
|
||||||
|
<div className="grid min-h-[260px] place-items-center bg-emerald-50/30">
|
||||||
|
<div className="text-neutral-500">유사기준을 선택해주세요.</div>
|
||||||
|
</div>
|
||||||
|
) : !hasRows ? (
|
||||||
|
<div className="grid min-h-[260px] place-items-center bg-emerald-50/30">
|
||||||
|
<div className="text-neutral-500">조회 결과가 없습니다.</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
// 여기만 스크롤: rows가 4개/더 많아져서 높이를 넘으면 자동 스크롤 생성
|
||||||
|
<div className="max-h-[300px] overflow-y-auto overflow-x-auto">
|
||||||
|
<table className="w-full border-collapse">
|
||||||
|
{/* thead sticky: bg + shadow + z-index로 겹침/투명 방지 */}
|
||||||
|
<thead className="sticky top-0 z-20 bg-[#EAF5F5] shadow-sm">
|
||||||
|
<tr>
|
||||||
|
<th rowSpan={2} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
선택
|
||||||
|
</th>
|
||||||
|
<th rowSpan={2} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
사업명
|
||||||
|
</th>
|
||||||
|
<th rowSpan={2} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
사업기간
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th colSpan={3} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
공급처
|
||||||
|
</th>
|
||||||
|
<th colSpan={2} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
수요처
|
||||||
|
</th>
|
||||||
|
<th colSpan={6} className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
재이용시설
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>시설<br/>종류</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>공급처명</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
시설용량
|
||||||
|
<br />
|
||||||
|
(m³/일)
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>수요처명</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>주소</th>
|
||||||
|
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
시설용량
|
||||||
|
<br />
|
||||||
|
(m³/일)
|
||||||
|
</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
관로
|
||||||
|
<br />
|
||||||
|
(km)
|
||||||
|
</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>용도</th>
|
||||||
|
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>
|
||||||
|
공급량
|
||||||
|
<br />
|
||||||
|
(m³/일)
|
||||||
|
</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>처리공법</th>
|
||||||
|
<th className={`${thBase} bg-[#EAF5F5]`}>이용용도</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{rows.map((r, idx) => {
|
||||||
|
const isFirst = groupInfo.firstIndex.get(r.caseId) === idx;
|
||||||
|
const rowSpan = groupInfo.counts.get(r.caseId) ?? 1;
|
||||||
|
const selected = selectedCaseId === r.caseId;
|
||||||
|
|
||||||
|
const supplyAmtCls = criterion === "supplyAmt" ? highlightTd : "";
|
||||||
|
const treatmentCls = criterion === "treatment" ? highlightTd : "";
|
||||||
|
const usePurposeCls = criterion === "usePurpose" ? highlightTd : "";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={`${r.caseId}-${idx}`}
|
||||||
|
className={[
|
||||||
|
"cursor-pointer hover:bg-neutral-50",
|
||||||
|
selected ? "bg-sky-50" : "",
|
||||||
|
].join(" ")}
|
||||||
|
onClick={() => setSelectedCaseId(r.caseId)}
|
||||||
|
>
|
||||||
|
{isFirst ? (
|
||||||
|
<>
|
||||||
|
<td className={`${tdBase} text-center`} rowSpan={rowSpan}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={selected}
|
||||||
|
readOnly
|
||||||
|
className="h-4 w-4"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`} rowSpan={rowSpan}>
|
||||||
|
{r.projectName ?? "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`} rowSpan={rowSpan}>
|
||||||
|
{r.period ?? "-"}
|
||||||
|
</td>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center`}>{r.supplyFacilityType ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{r.supplyName ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{formatNumber(r.supplyCapacity)}</td>
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center`}>{r.demandName ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{r.demandAddress ?? "-"}</td>
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center`}>{formatNumber(r.facilityCapacity)}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{formatNumber(r.pipeKm)}</td>
|
||||||
|
<td className={tdBase}>{r.purpose ?? "-"}</td>
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center ${supplyAmtCls}`}>
|
||||||
|
{formatNumber(r.supplyAmt)}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center ${treatmentCls}`}>
|
||||||
|
{r.treatment ?? "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center ${usePurposeCls}`}>
|
||||||
|
{r.usePurpose ?? "-"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr className="my-6 border-y-[1px] border-[#C9C9C9]" />
|
||||||
|
|
||||||
|
{/* 상세정보 */}
|
||||||
|
<div className="mt-0">
|
||||||
|
<div className="mb-2 text-lg font-semibold text-neutral-900">상세정보</div>
|
||||||
|
|
||||||
|
{/* 1) 보증수질 */}
|
||||||
|
<div className="overflow-hidden border border-[#C9C9C9]">
|
||||||
|
<table className="w-full border-collapse">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colSpan={13} className={thBase}>
|
||||||
|
보증수질
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th rowSpan={2} className={thBase}>
|
||||||
|
총대장균군수<br />(개/100ml)
|
||||||
|
</th>
|
||||||
|
<th rowSpan={2} className={thBase}>
|
||||||
|
용도별 결합 잔류염소<br />(mg/L)
|
||||||
|
</th>
|
||||||
|
<th rowSpan={2} className={thBase}>
|
||||||
|
탁도<br />(NTU)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th className={thBase}>
|
||||||
|
생물학적<br />산소요구량(BOD)(mg/L)
|
||||||
|
</th>
|
||||||
|
<th className={thBase}>냄새</th>
|
||||||
|
<th className={thBase}>색도(도)</th>
|
||||||
|
<th className={thBase}>총질소<br />(T-N)(mg/L)</th>
|
||||||
|
<th className={thBase}>총인<br />(T-P)(mg/L)</th>
|
||||||
|
<th className={thBase}>수소이온<br />농도(pH)</th>
|
||||||
|
<th className={thBase}>염화물<br />(mgCL/L)</th>
|
||||||
|
<th className={thBase}>전기전도도<br />(μs/cm)</th>
|
||||||
|
<th className={thBase}>비고</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.coliform ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.residualCl ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.turbidity ?? "-"}</td>
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.bod ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.odor ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.color ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.tn ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.tp ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.ph ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.chloride ?? "-"}</td>
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.ec ?? "-"}</td>
|
||||||
|
|
||||||
|
<td className={`${tdBase} text-center`}>{selectedDetail?.note ?? "-"}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 2) 사업비 */}
|
||||||
|
<div className="mt-4 overflow-hidden border border-[#C9C9C9]">
|
||||||
|
<table className="w-full border-collapse">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colSpan={14} className={thBase}>
|
||||||
|
소요사업비(백만원)
|
||||||
|
</th>
|
||||||
|
<th colSpan={5} className={thBase}>
|
||||||
|
재원조달계획(백만원)
|
||||||
|
</th>
|
||||||
|
<th colSpan={5} className={thBase}>
|
||||||
|
사업비 정산(백만원)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
{/* 소요사업비 */}
|
||||||
|
<th rowSpan={2} className={thBase}>총</th>
|
||||||
|
<th colSpan={2} className={thBase}>토목</th>
|
||||||
|
<th rowSpan={2} className={thBase}>건축</th>
|
||||||
|
<th rowSpan={2} className={thBase}>기계</th>
|
||||||
|
<th rowSpan={2} className={thBase}>전기<br />·계측</th>
|
||||||
|
<th rowSpan={2} className={thBase}>GIS<br />DB</th>
|
||||||
|
<th rowSpan={2} className={thBase}>CCTV</th>
|
||||||
|
<th rowSpan={2} className={thBase}>시공 및 준공</th>
|
||||||
|
<th rowSpan={2} className={thBase}>폐기물</th>
|
||||||
|
<th rowSpan={2} className={thBase}>설계비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>감리비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>시설부대</th>
|
||||||
|
<th rowSpan={2} className={thBase}>기타</th>
|
||||||
|
|
||||||
|
{/* 재원조달 */}
|
||||||
|
<th rowSpan={2} className={thBase}>총</th>
|
||||||
|
<th rowSpan={2} className={thBase}>국비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>지방비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>원인자부담</th>
|
||||||
|
<th rowSpan={2} className={thBase}>국고비율</th>
|
||||||
|
|
||||||
|
{/* 정산 */}
|
||||||
|
<th rowSpan={2} className={thBase}>총</th>
|
||||||
|
<th rowSpan={2} className={thBase}>국비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>지방비</th>
|
||||||
|
<th rowSpan={2} className={thBase}>원인자부담</th>
|
||||||
|
<th rowSpan={2} className={thBase}>국고비율</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th className={thBase}>재이용<br />시설</th>
|
||||||
|
<th className={thBase}>관로</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{/* 소요사업비 */}
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costTotal != null ? formatNumber(selectedDetail.costTotal) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costFacility != null ? formatNumber(selectedDetail.costFacility) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costPipe != null ? formatNumber(selectedDetail.costPipe) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costDesign != null ? formatNumber(selectedDetail.costDesign) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costSupervision != null ? formatNumber(selectedDetail.costSupervision) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`}>-</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.costOther != null ? formatNumber(selectedDetail.costOther) : "-"}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* 재원조달 */}
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingTotal != null ? formatNumber(selectedDetail.fundingTotal) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingNational != null ? formatNumber(selectedDetail.fundingNational) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingLocal != null ? formatNumber(selectedDetail.fundingLocal) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingSelf != null ? formatNumber(selectedDetail.fundingSelf) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`}>
|
||||||
|
{typeof selectedDetail?.fundingRate === "number" ? `${selectedDetail.fundingRate}%` : "-"}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* 정산(필드 없으면 동일 값 표시) */}
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingTotal != null ? formatNumber(selectedDetail.fundingTotal) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingNational != null ? formatNumber(selectedDetail.fundingNational) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingLocal != null ? formatNumber(selectedDetail.fundingLocal) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-right`}>
|
||||||
|
{selectedDetail?.fundingSelf != null ? formatNumber(selectedDetail.fundingSelf) : "-"}
|
||||||
|
</td>
|
||||||
|
<td className={`${tdBase} text-center`}>
|
||||||
|
{typeof selectedDetail?.fundingRate === "number" ? `${selectedDetail.fundingRate}%` : "-"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!selectedCaseId && showList ? (
|
||||||
|
<div className="mt-3 text-sm text-neutral-500">
|
||||||
|
리스트에서 사업을 선택하면 상세정보가 표시됩니다.
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return createPortal(ui, document.body);
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
// apps/dm/app/(landing)/reuse/apply/place/page.tsx
|
// apps/dm/app/(landing)/reuse/apply/place/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import PostcodeModal from "../../_components/PostcodeModal";
|
||||||
|
import type { AddrItem } from "../../_components/PostcodeModal";
|
||||||
|
|
||||||
type Option = { value: string; label: string };
|
type Option = { value: string; label: string };
|
||||||
type SidoValue = "" | "seoul" | "busan" | "daegu" | "incheon" | "gyeonggi";
|
type SidoValue = "" | "seoul" | "busan" | "daegu" | "incheon" | "gyeonggi";
|
||||||
@@ -75,9 +78,7 @@ function FormRow({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 입력(우측) */}
|
{/* 입력(우측) */}
|
||||||
<div className="col-span-12 lg:col-span-10 px-6 py-6">
|
<div className="col-span-12 lg:col-span-10 px-6 py-6">{children}</div>
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -145,6 +146,25 @@ function SelectBox<T extends string>({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DemandPlaceRegisterPage() {
|
export default function DemandPlaceRegisterPage() {
|
||||||
|
/** ✅ 모달 + 주소 상태 (반드시 컴포넌트 내부!) */
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
// 모달에서 선택한 값은 이 3개에 반영 (기존 UI zip/addr1/addr2와 맞춤)
|
||||||
|
const [zip, setZip] = useState("");
|
||||||
|
const [addr1, setAddr1] = useState(""); // 도로명 주소 넣을 곳
|
||||||
|
const [addr2, setAddr2] = useState(""); // 상세주소(사용자 입력)
|
||||||
|
|
||||||
|
// (필요하면 유지) 지번도 따로 보관하고 싶을 때
|
||||||
|
// const [jibun, setJibun] = useState("");
|
||||||
|
|
||||||
|
const handleSelect = (it: AddrItem) => {
|
||||||
|
setZip(it.zipNo);
|
||||||
|
setAddr1(it.roadAddr); // ✅ 주소칸에 도로명 자동 입력
|
||||||
|
// setJibun(it.jibunAddr); // ✅ 지번도 상태로 보관(원하면 UI에 표시)
|
||||||
|
setOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 기존 폼 상태들 */
|
||||||
const [sido, setSido] = useState<SidoValue>("");
|
const [sido, setSido] = useState<SidoValue>("");
|
||||||
const [sigungu, setSigungu] = useState<string>("");
|
const [sigungu, setSigungu] = useState<string>("");
|
||||||
|
|
||||||
@@ -153,10 +173,6 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
const [workerNo, setWorkerNo] = useState("");
|
const [workerNo, setWorkerNo] = useState("");
|
||||||
const [noWorkerNo, setNoWorkerNo] = useState(false);
|
const [noWorkerNo, setNoWorkerNo] = useState(false);
|
||||||
|
|
||||||
const [zip, setZip] = useState("");
|
|
||||||
const [addr1, setAddr1] = useState("");
|
|
||||||
const [addr2, setAddr2] = useState("");
|
|
||||||
|
|
||||||
const [tel, setTel] = useState("");
|
const [tel, setTel] = useState("");
|
||||||
const [pw, setPw] = useState("");
|
const [pw, setPw] = useState("");
|
||||||
const [pw2, setPw2] = useState("");
|
const [pw2, setPw2] = useState("");
|
||||||
@@ -222,11 +238,7 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
|
|
||||||
<FormRow label="회사명" required>
|
<FormRow label="회사명" required>
|
||||||
<div className="max-w-[420px]">
|
<div className="max-w-[420px]">
|
||||||
<TextInput
|
<TextInput value={company} onChange={setCompany} placeholder="회사명을 입력해주세요." />
|
||||||
value={company}
|
|
||||||
onChange={setCompany}
|
|
||||||
placeholder="회사명을 입력해주세요."
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
@@ -234,11 +246,7 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
|
|
||||||
<FormRow label="사업자등록번호" required>
|
<FormRow label="사업자등록번호" required>
|
||||||
<div className="max-w-[420px]">
|
<div className="max-w-[420px]">
|
||||||
<TextInput
|
<TextInput value={bizNo} onChange={setBizNo} placeholder="사업자 등록번호를 입력해주세요." />
|
||||||
value={bizNo}
|
|
||||||
onChange={setBizNo}
|
|
||||||
placeholder="사업자 등록번호를 입력해주세요."
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
@@ -278,21 +286,24 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
<div className="w-[180px]">
|
<div className="w-[180px]">
|
||||||
<TextInput value={zip} onChange={setZip} placeholder="우편번호" />
|
<TextInput value={zip} onChange={setZip} placeholder="우편번호" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => alert("우편번호 검색(샘플)")}
|
onClick={() => setOpen(true)}
|
||||||
className="h-11 rounded bg-[#888] px-4 text-base text-white hover:bg-neutral-700"
|
className="h-11 rounded-md bg-[#888] px-4 text-sm text-white hover:brightness-95"
|
||||||
>
|
>
|
||||||
우편번호 검색
|
우편번호 검색
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ✅ 선택된 도로명주소가 자동으로 들어감 */}
|
||||||
<TextInput value={addr1} onChange={setAddr1} placeholder="주소" />
|
<TextInput value={addr1} onChange={setAddr1} placeholder="주소" />
|
||||||
<TextInput
|
|
||||||
value={addr2}
|
{/* ✅ 상세주소는 사용자 입력 */}
|
||||||
onChange={setAddr2}
|
<TextInput value={addr2} onChange={setAddr2} placeholder="상세 주소를 입력하세요." />
|
||||||
placeholder="상세 주소를 입력하세요."
|
|
||||||
/>
|
{/* (선택) 지번주소도 보여주고 싶으면 */}
|
||||||
|
{/* {jibun ? <p className="text-xs text-neutral-500">지번: {jibun}</p> : null} */}
|
||||||
</div>
|
</div>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
@@ -300,11 +311,7 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
|
|
||||||
<FormRow label="전화번호" required>
|
<FormRow label="전화번호" required>
|
||||||
<div className="max-w-[420px]">
|
<div className="max-w-[420px]">
|
||||||
<TextInput
|
<TextInput value={tel} onChange={setTel} placeholder="전화번호를 입력하세요." />
|
||||||
value={tel}
|
|
||||||
onChange={setTel}
|
|
||||||
placeholder="전화번호를 입력하세요."
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
@@ -312,12 +319,7 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
|
|
||||||
<FormRow label="비밀번호" required>
|
<FormRow label="비밀번호" required>
|
||||||
<div className="max-w-[420px]">
|
<div className="max-w-[420px]">
|
||||||
<TextInput
|
<TextInput value={pw} onChange={setPw} placeholder="비밀번호를 입력하세요." type="password" />
|
||||||
value={pw}
|
|
||||||
onChange={setPw}
|
|
||||||
placeholder="비밀번호를 입력하세요."
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
@@ -345,6 +347,9 @@ export default function DemandPlaceRegisterPage() {
|
|||||||
수요처 등록
|
수요처 등록
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ✅ 모달 */}
|
||||||
|
<PostcodeModal open={open} onClose={() => setOpen(false)} onSelect={handleSelect} />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
// apps/dm/app/(landing)/reuse/apply/register/page.tsx
|
// apps/dm/app/(landing)/reuse/apply/register/page.tsx (수요정보등록 페이지)
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMemo, useState, useRef } from "react";
|
import { useMemo, useState, useRef } from "react";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
import WaterQualityRefModal from "../modal/WaterQualityRefModal";
|
import WaterQualityRefModal from "../modal/WaterQualityRefModal";
|
||||||
|
import CandidateSiteModal, { type CandidateSite } from "../modal/CandidateSiteModal";
|
||||||
|
import SimilarCaseModal, { type SimilarCaseRow, type SimilarCaseDetail } from "../modal/SimilarCaseModal";
|
||||||
|
|
||||||
type PHRange = { min: string; max: string };
|
type PHRange = { min: string; max: string };
|
||||||
|
|
||||||
@@ -18,6 +20,144 @@ export default function DemandRegisterPage() {
|
|||||||
|
|
||||||
const [openRef, setOpenRef] = useState(false);
|
const [openRef, setOpenRef] = useState(false);
|
||||||
|
|
||||||
|
const [openCand, setOpenCand] = useState(false);
|
||||||
|
const [selectedCands, setSelectedCands] = useState<CandidateSite[]>([]);
|
||||||
|
|
||||||
|
// 유사사례 모달
|
||||||
|
const [openSimilar, setOpenSimilar] = useState(false);
|
||||||
|
|
||||||
|
// 유사사례 rows (목업) - API 연동 시 여기만 교체
|
||||||
|
// const rows: SimilarCaseRow[] = useMemo(
|
||||||
|
// () => [
|
||||||
|
// {
|
||||||
|
// caseId: "C-001",
|
||||||
|
// projectName: "OO시 물 재이용(빗물, 중수도) 시설 설치사업",
|
||||||
|
// period: "2020.01. ~ 2025.05.",
|
||||||
|
// supplyFacilityType: "중수도",
|
||||||
|
// supplyName: "OO새교복지타운",
|
||||||
|
// supplyCapacity: 0,
|
||||||
|
// demandName: "OO새교복지타운",
|
||||||
|
// demandAddress: "OO시 수청로 192",
|
||||||
|
// facilityCapacity: 50,
|
||||||
|
// pipeKm: 0,
|
||||||
|
// purpose: "청소, 화장실, 조경",
|
||||||
|
// supplyAmt: 50,
|
||||||
|
// treatment: "MBLM",
|
||||||
|
// usePurpose: "청소,화장실",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// caseId: "C-001",
|
||||||
|
// projectName: "OO시 물 재이용(빗물, 중수도) 시설 설치사업",
|
||||||
|
// period: "2020.01. ~ 2025.05.",
|
||||||
|
// supplyFacilityType: "중수도",
|
||||||
|
// supplyName: "OO스포츠센터",
|
||||||
|
// supplyCapacity: 0,
|
||||||
|
// demandName: "OO스포츠센터",
|
||||||
|
// demandAddress: "OO시 경기동로 33",
|
||||||
|
// facilityCapacity: 50,
|
||||||
|
// pipeKm: 0,
|
||||||
|
// purpose: "청소, 화장실, 조경",
|
||||||
|
// supplyAmt: 50,
|
||||||
|
// treatment: "MBLM",
|
||||||
|
// usePurpose: "청소,화장실",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// caseId: "C-002",
|
||||||
|
// projectName: "OO 엄성저수지 하수처리수 재이용사업",
|
||||||
|
// period: "2019.12 ~ 2026.01",
|
||||||
|
// supplyFacilityType: "하수",
|
||||||
|
// supplyName: "OO 3,4단계 공공하수처리시설",
|
||||||
|
// supplyCapacity: 70000,
|
||||||
|
// demandName: "OO천",
|
||||||
|
// demandAddress: "-",
|
||||||
|
// facilityCapacity: 0,
|
||||||
|
// pipeKm: 3,
|
||||||
|
// purpose: "하천 등 유지용수",
|
||||||
|
// supplyAmt: 2300,
|
||||||
|
// treatment: "탈황,총인, 생물산화과,소독",
|
||||||
|
// usePurpose: "하천 등 유지용수",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// caseId: "C-002",
|
||||||
|
// projectName: "OO 엄성저수지 하수처리수 재이용사업",
|
||||||
|
// period: "2019.12 ~ 2026.01",
|
||||||
|
// supplyFacilityType: "하수",
|
||||||
|
// supplyName: "OO 3,4단계 공공하수처리시설",
|
||||||
|
// supplyCapacity: 70000,
|
||||||
|
// demandName: "OO저수지",
|
||||||
|
// demandAddress: "-",
|
||||||
|
// facilityCapacity: 0,
|
||||||
|
// pipeKm: 5,
|
||||||
|
// purpose: "하천 등 유지용수",
|
||||||
|
// supplyAmt: 7700,
|
||||||
|
// treatment: "탈황,총인, 생물산화과,소독",
|
||||||
|
// usePurpose: "하천 등 유지용수",
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// []
|
||||||
|
// );
|
||||||
|
|
||||||
|
// 유사사례 상세(목업) - caseId로 매핑
|
||||||
|
// const detailsByCaseId: Record<string, SimilarCaseDetail> = useMemo(
|
||||||
|
// () => ({
|
||||||
|
// "C-001": {
|
||||||
|
// coliform: "불검출",
|
||||||
|
// residualCl: "0.2이상",
|
||||||
|
// turbidity: "1.5이하",
|
||||||
|
// bod: "4.0이하",
|
||||||
|
// odor: "불쾌하지않을것",
|
||||||
|
// color: "10이하",
|
||||||
|
// tn: "-",
|
||||||
|
// tp: "-",
|
||||||
|
// ph: "5.8~8.5",
|
||||||
|
// chloride: "-",
|
||||||
|
// ec: "-",
|
||||||
|
// note: "-",
|
||||||
|
|
||||||
|
// costTotal: 4305,
|
||||||
|
// costFacility: 3518,
|
||||||
|
// costPipe: undefined,
|
||||||
|
// costDesign: 350,
|
||||||
|
// costSupervision: 417,
|
||||||
|
// costOther: 12,
|
||||||
|
|
||||||
|
// fundingTotal: 4305,
|
||||||
|
// fundingNational: 3104,
|
||||||
|
// fundingLocal: 1291,
|
||||||
|
// fundingSelf: undefined,
|
||||||
|
// fundingRate: 70.0,
|
||||||
|
// },
|
||||||
|
// "C-002": {
|
||||||
|
// coliform: "불검출",
|
||||||
|
// residualCl: "0.15이상",
|
||||||
|
// turbidity: "2.0이하",
|
||||||
|
// bod: "5.0이하",
|
||||||
|
// odor: "무",
|
||||||
|
// color: "10이하",
|
||||||
|
// tn: "-",
|
||||||
|
// tp: "-",
|
||||||
|
// ph: "6.0~8.5",
|
||||||
|
// chloride: "-",
|
||||||
|
// ec: "-",
|
||||||
|
// note: "-",
|
||||||
|
|
||||||
|
// costTotal: 9800,
|
||||||
|
// costFacility: 2100,
|
||||||
|
// costPipe: 1800,
|
||||||
|
// costDesign: 300,
|
||||||
|
// costSupervision: 280,
|
||||||
|
// costOther: 1200,
|
||||||
|
|
||||||
|
// fundingTotal: 9800,
|
||||||
|
// fundingNational: 4900,
|
||||||
|
// fundingLocal: 3000,
|
||||||
|
// fundingSelf: 1900,
|
||||||
|
// fundingRate: 50,
|
||||||
|
// },
|
||||||
|
// }),
|
||||||
|
// []
|
||||||
|
// );
|
||||||
|
|
||||||
// 기본정보
|
// 기본정보
|
||||||
const [reqDate, setReqDate] = useState<string>(today);
|
const [reqDate, setReqDate] = useState<string>(today);
|
||||||
const [reqQty, setReqQty] = useState<string>("");
|
const [reqQty, setReqQty] = useState<string>("");
|
||||||
@@ -45,251 +185,458 @@ export default function DemandRegisterPage() {
|
|||||||
const [cand2, setCand2] = useState("");
|
const [cand2, setCand2] = useState("");
|
||||||
const [cand3, setCand3] = useState("");
|
const [cand3, setCand3] = useState("");
|
||||||
|
|
||||||
|
// 샘플 데이터
|
||||||
|
const similarRows: SimilarCaseRow[] = [
|
||||||
|
// ---------------- A (2행) ----------------
|
||||||
|
{
|
||||||
|
caseId: "A",
|
||||||
|
projectName: "OO시 물 재이용(빗물, 중수도) 시설 설치사업",
|
||||||
|
period: "2020.01.~2025.05.",
|
||||||
|
supplyFacilityType: "중수도",
|
||||||
|
supplyName: "OO폐수재이용",
|
||||||
|
supplyCapacity: 50,
|
||||||
|
|
||||||
|
demandName: "OO시체육센터",
|
||||||
|
demandAddress: "OO시 수성로 192",
|
||||||
|
|
||||||
|
facilityCapacity: 50,
|
||||||
|
pipeKm: 3,
|
||||||
|
purpose: "조경",
|
||||||
|
supplyAmt: 50,
|
||||||
|
treatment: "MBLM",
|
||||||
|
usePurpose: "청소, 화장실",
|
||||||
|
},
|
||||||
|
// A의 공급처 row 추가(=표 1행 추가) → 나머지 컬럼도 같이 채움
|
||||||
|
{
|
||||||
|
caseId: "A",
|
||||||
|
projectName: "OO시 물 재이용(빗물, 중수도) 시설 설치사업",
|
||||||
|
period: "2020.01.~2025.05.",
|
||||||
|
supplyFacilityType: "중수도",
|
||||||
|
supplyName: "OO스포츠센터",
|
||||||
|
supplyCapacity: 30,
|
||||||
|
|
||||||
|
demandName: "OO시체육센터",
|
||||||
|
demandAddress: "OO시 수성로 192",
|
||||||
|
|
||||||
|
facilityCapacity: 50,
|
||||||
|
pipeKm: 3,
|
||||||
|
purpose: "조경",
|
||||||
|
supplyAmt: 50,
|
||||||
|
treatment: "MBLM",
|
||||||
|
usePurpose: "청소, 화장실",
|
||||||
|
},
|
||||||
|
|
||||||
|
// ---------------- B (2행) ----------------
|
||||||
|
{
|
||||||
|
caseId: "B",
|
||||||
|
projectName: "OO 염성저수지 하수처리수 재이용사업",
|
||||||
|
period: "2019.12~2026.1",
|
||||||
|
supplyFacilityType: "하수",
|
||||||
|
supplyName: "OO3.4단계 공공하수처리시설",
|
||||||
|
supplyCapacity: 70000,
|
||||||
|
|
||||||
|
demandName: "OO천",
|
||||||
|
demandAddress: "-",
|
||||||
|
|
||||||
|
facilityCapacity: 0,
|
||||||
|
pipeKm: 3,
|
||||||
|
purpose: "하천 등 유지용수",
|
||||||
|
supplyAmt: 2300,
|
||||||
|
treatment: "탈황, 총인, 생물산화, 소독",
|
||||||
|
usePurpose: "하천 등 유지용수",
|
||||||
|
},
|
||||||
|
// B의 공급처 row 추가(=표 1행 추가)
|
||||||
|
{
|
||||||
|
caseId: "B",
|
||||||
|
projectName: "OO 염성저수지 하수처리수 재이용사업",
|
||||||
|
period: "2019.12~2026.1",
|
||||||
|
supplyFacilityType: "하수",
|
||||||
|
supplyName: "OO3.4단계 공공하수처리시설(2라인)",
|
||||||
|
supplyCapacity: 70000,
|
||||||
|
|
||||||
|
demandName: "OO저수지",
|
||||||
|
demandAddress: "-",
|
||||||
|
|
||||||
|
facilityCapacity: 0,
|
||||||
|
pipeKm: 5,
|
||||||
|
purpose: "하천 등 유지용수",
|
||||||
|
supplyAmt: 7700,
|
||||||
|
treatment: "탈황, 총인, 생물산화, 소독",
|
||||||
|
usePurpose: "하천 등 유지용수",
|
||||||
|
},
|
||||||
|
|
||||||
|
// ---------------- C (1행) ----------------
|
||||||
|
{
|
||||||
|
caseId: "C",
|
||||||
|
projectName: "OO 산업단지 공업용수 재이용사업",
|
||||||
|
period: "2021.03~2024.12",
|
||||||
|
supplyFacilityType: "하수",
|
||||||
|
supplyName: "OO공공하수처리장",
|
||||||
|
supplyCapacity: 15000,
|
||||||
|
|
||||||
|
demandName: "OO산업단지",
|
||||||
|
demandAddress: "OO시 산업로 25",
|
||||||
|
|
||||||
|
facilityCapacity: 5000,
|
||||||
|
pipeKm: 4,
|
||||||
|
purpose: "공업용수",
|
||||||
|
supplyAmt: 5000,
|
||||||
|
treatment: "UF + RO",
|
||||||
|
usePurpose: "공업용수",
|
||||||
|
},
|
||||||
|
|
||||||
|
// ---------------- D (1행) ----------------
|
||||||
|
{
|
||||||
|
caseId: "D",
|
||||||
|
projectName: "OO 공원 조경용수 재이용사업",
|
||||||
|
period: "2018.05~2022.11",
|
||||||
|
supplyFacilityType: "중수도",
|
||||||
|
supplyName: "OO정수장",
|
||||||
|
supplyCapacity: 8000,
|
||||||
|
|
||||||
|
demandName: "OO중앙공원",
|
||||||
|
demandAddress: "OO시 공원로 88",
|
||||||
|
|
||||||
|
facilityCapacity: 1200,
|
||||||
|
pipeKm: 2,
|
||||||
|
purpose: "조경용수",
|
||||||
|
supplyAmt: 1200,
|
||||||
|
treatment: "모래여과",
|
||||||
|
usePurpose: "조경",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const similarDetailsByCaseId: Record<string, SimilarCaseDetail> = {
|
||||||
|
A: {
|
||||||
|
coliform: "불검출",
|
||||||
|
residualCl: "0.2이상",
|
||||||
|
turbidity: "1.5이하",
|
||||||
|
bod: "4.0이하",
|
||||||
|
odor: "불쾌하지않을것",
|
||||||
|
color: "10이하",
|
||||||
|
tn: "-",
|
||||||
|
tp: "-",
|
||||||
|
ph: "5.8~8.5",
|
||||||
|
chloride: "-",
|
||||||
|
ec: "-",
|
||||||
|
note: "-",
|
||||||
|
costTotal: 4305,
|
||||||
|
costFacility: 3518,
|
||||||
|
costPipe: 0,
|
||||||
|
costDesign: 350,
|
||||||
|
costSupervision: 417,
|
||||||
|
costOther: 12,
|
||||||
|
fundingTotal: 4305,
|
||||||
|
fundingNational: 3104,
|
||||||
|
fundingLocal: 1291,
|
||||||
|
fundingSelf: 0,
|
||||||
|
fundingRate: 70.0,
|
||||||
|
},
|
||||||
|
B: {
|
||||||
|
coliform: "-",
|
||||||
|
residualCl: "-",
|
||||||
|
turbidity: "-",
|
||||||
|
bod: "-",
|
||||||
|
odor: "-",
|
||||||
|
color: "-",
|
||||||
|
tn: "-",
|
||||||
|
tp: "-",
|
||||||
|
ph: "-",
|
||||||
|
chloride: "-",
|
||||||
|
ec: "-",
|
||||||
|
note: "-",
|
||||||
|
costTotal: 0,
|
||||||
|
costFacility: 0,
|
||||||
|
costPipe: 0,
|
||||||
|
costDesign: 0,
|
||||||
|
costSupervision: 0,
|
||||||
|
costOther: 0,
|
||||||
|
fundingTotal: 0,
|
||||||
|
fundingNational: 0,
|
||||||
|
fundingLocal: 0,
|
||||||
|
fundingSelf: 0,
|
||||||
|
fundingRate: 0,
|
||||||
|
},
|
||||||
|
C: {
|
||||||
|
coliform: "불검출",
|
||||||
|
residualCl: "0.2이상",
|
||||||
|
turbidity: "1.5이하",
|
||||||
|
bod: "4.0이하",
|
||||||
|
odor: "불쾌하지않을것",
|
||||||
|
color: "10이하",
|
||||||
|
tn: "-",
|
||||||
|
tp: "-",
|
||||||
|
ph: "5.8~8.5",
|
||||||
|
chloride: "-",
|
||||||
|
ec: "-",
|
||||||
|
note: "-",
|
||||||
|
costTotal: 4305,
|
||||||
|
costFacility: 3518,
|
||||||
|
costPipe: 0,
|
||||||
|
costDesign: 350,
|
||||||
|
costSupervision: 417,
|
||||||
|
costOther: 12,
|
||||||
|
fundingTotal: 4305,
|
||||||
|
fundingNational: 3104,
|
||||||
|
fundingLocal: 1291,
|
||||||
|
fundingSelf: 0,
|
||||||
|
fundingRate: 70.0,
|
||||||
|
},
|
||||||
|
D: {
|
||||||
|
coliform: "-",
|
||||||
|
residualCl: "-",
|
||||||
|
turbidity: "-",
|
||||||
|
bod: "-",
|
||||||
|
odor: "-",
|
||||||
|
color: "-",
|
||||||
|
tn: "-",
|
||||||
|
tp: "-",
|
||||||
|
ph: "-",
|
||||||
|
chloride: "-",
|
||||||
|
ec: "-",
|
||||||
|
note: "-",
|
||||||
|
costTotal: 0,
|
||||||
|
costFacility: 0,
|
||||||
|
costPipe: 0,
|
||||||
|
costDesign: 0,
|
||||||
|
costSupervision: 0,
|
||||||
|
costOther: 0,
|
||||||
|
fundingTotal: 0,
|
||||||
|
fundingNational: 0,
|
||||||
|
fundingLocal: 0,
|
||||||
|
fundingSelf: 0,
|
||||||
|
fundingRate: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<main className="bg-white">
|
||||||
<main className="bg-white">
|
<SubPageHeader
|
||||||
|
title="수요정보등록"
|
||||||
|
crumbs={[
|
||||||
|
{ label: "Home", href: "/reuse" },
|
||||||
|
{ label: "수요신청", href: "/reuse/apply" },
|
||||||
|
{ label: "수요정보등록" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* 서브 타이틀 + 브레드크럼 */}
|
<div>
|
||||||
<SubPageHeader
|
<div className="border border-neutral-200 bg-white">
|
||||||
title="수요정보등록"
|
<FormRow label="요구시기" required>
|
||||||
crumbs={[
|
<DateInput value={reqDate} onChange={setReqDate} />
|
||||||
{ label: "Home", href: "/reuse" },
|
</FormRow>
|
||||||
{ label: "수요신청", href: "/reuse/apply" },
|
<Divider />
|
||||||
{ label: "수요정보등록" },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* 컨텐츠 영역 */}
|
<FormRow label="요구수량(m²/d)" required>
|
||||||
<div>
|
<TextInput value={reqQty} onChange={setReqQty} />
|
||||||
|
</FormRow>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
{/* 기본정보 테이블 */}
|
<FormRow label="사용용도" required>
|
||||||
<div className="border border-neutral-200 bg-white">
|
<TextInput value={usePurpose} onChange={setUsePurpose} />
|
||||||
<FormRow label="요구시기" required>
|
</FormRow>
|
||||||
<DateInput value={reqDate} onChange={setReqDate} />
|
<Divider />
|
||||||
</FormRow>
|
|
||||||
|
|
||||||
<Divider />
|
<FormRow label="희망단가(원)" required>
|
||||||
|
<TextInput value={hopePrice} onChange={setHopePrice} />
|
||||||
|
</FormRow>
|
||||||
|
</div>
|
||||||
|
|
||||||
<FormRow label="요구수량(m²/d)" required>
|
<div className="grid grid-cols-12">
|
||||||
<TextInput value={reqQty} onChange={setReqQty} placeholder="" />
|
<div className="col-span-12 lg:col-span-2 inline-flex items-center justify-center gap-3 px-6 py-6 text-center">
|
||||||
</FormRow>
|
<span className="text-lg font-semibold text-neutral-800">요구수질</span>
|
||||||
|
<button
|
||||||
<Divider />
|
type="button"
|
||||||
|
onClick={() => setOpenRef(true)}
|
||||||
<FormRow label="사용용도" required>
|
className="rounded border-[2px] border-[#DE3412] px-2 py-3 text-[15px] font-medium text-[#4F4F4F] hover:bg-orange-50"
|
||||||
<TextInput value={usePurpose} onChange={setUsePurpose} />
|
>
|
||||||
</FormRow>
|
수질기준 참고
|
||||||
|
</button>
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<FormRow label="희망단가(원)" required>
|
|
||||||
<TextInput value={hopePrice} onChange={setHopePrice} />
|
|
||||||
</FormRow>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 요구수질 섹션 타이틀 바 */}
|
|
||||||
<div className="grid grid-cols-12">
|
|
||||||
<div className="col-span-12 lg:col-span-2 inline-flex justify-center items-center gap-3 px-6 py-6 text-center">
|
|
||||||
<span className="text-lg font-semibold text-neutral-800">요구수질</span>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setOpenRef(true)}
|
|
||||||
className="rounded border-[2px] border-[#DE3412] px-2 py-3 text-[15px] font-medium text-[#4F4F4F] hover:bg-orange-50"
|
|
||||||
>
|
|
||||||
수질기준 참고
|
|
||||||
</button>
|
|
||||||
{/* 수질기준참고 모달 */}
|
|
||||||
<WaterQualityRefModal
|
|
||||||
open={openRef}
|
|
||||||
onClose={() => setOpenRef(false)}
|
|
||||||
imageSrc="/images/landing/water_quality_ref_1.png"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 요구수질 테이블 */}
|
|
||||||
<div className="border border-neutral-200 bg-white">
|
|
||||||
{/* 1행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel="총대장균군수(개/mg)"
|
|
||||||
leftRequired
|
|
||||||
leftControl={
|
|
||||||
<div className="flex items-center gap-4">
|
|
||||||
<TextInput
|
|
||||||
value={coliform}
|
|
||||||
onChange={setColiform}
|
|
||||||
disabled={noDetect}
|
|
||||||
className={noDetect ? "bg-neutral-100 text-neutral-400" : ""}
|
|
||||||
/>
|
|
||||||
<label className="flex items-center gap-2 text-sm text-neutral-700">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={noDetect}
|
|
||||||
onChange={(e) => {
|
|
||||||
setNoDetect(e.target.checked);
|
|
||||||
if (e.target.checked) setColiform("");
|
|
||||||
}}
|
|
||||||
className="h-4 w-4 rounded border-neutral-300"
|
|
||||||
/>
|
|
||||||
불검출
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
rightLabel="총질소(T-N)(mg/L)"
|
|
||||||
rightControl={
|
|
||||||
<InlineSuffixInput value={tn} onChange={setTn} suffix="이하" />
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 2행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel="결합잔류염소(mg/L)"
|
|
||||||
leftRequired
|
|
||||||
leftControl={<TextInput value={residualCl} onChange={setResidualCl} />}
|
|
||||||
rightLabel="총인(T-P)(mg/L)"
|
|
||||||
rightControl={
|
|
||||||
<InlineSuffixInput value={tp} onChange={setTp} suffix="이하" />
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 3행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel="탁도(NTU)"
|
|
||||||
leftRequired
|
|
||||||
leftControl={
|
|
||||||
<InlineSuffixInput value={turbidity} onChange={setTurbidity} suffix="이하" />
|
|
||||||
}
|
|
||||||
rightLabel="수소이온농도(pH)"
|
|
||||||
rightControl={
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<TextInput
|
|
||||||
value={ph.min}
|
|
||||||
onChange={(v) => setPh((p) => ({ ...p, min: v }))}
|
|
||||||
className="w-32"
|
|
||||||
/>
|
|
||||||
<span className="text-neutral-500">~</span>
|
|
||||||
<TextInput
|
|
||||||
value={ph.max}
|
|
||||||
onChange={(v) => setPh((p) => ({ ...p, max: v }))}
|
|
||||||
className="w-32"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 4행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel={
|
|
||||||
<>
|
|
||||||
생물화학적산소요구량
|
|
||||||
<br />
|
|
||||||
(BOD)(mg/L)
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
leftRequired
|
|
||||||
leftControl={<InlineSuffixInput value={bod} onChange={setBod} suffix="이하" />}
|
|
||||||
rightLabel="염화물(mgCL/L)"
|
|
||||||
rightControl={<InlineSuffixInput value={chloride} onChange={setChloride} suffix="이하" />}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 5행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel="냄새"
|
|
||||||
leftRequired
|
|
||||||
leftControl={
|
|
||||||
<select
|
|
||||||
value={odor}
|
|
||||||
onChange={(e) => setOdor(e.target.value)}
|
|
||||||
className="h-11 w-full max-w-[200px] rounded-md border border-neutral-300 bg-white px-3 text-sm outline-none focus:border-neutral-500"
|
|
||||||
>
|
|
||||||
<option>불쾌하지 않을 것</option>
|
|
||||||
<option>약간 있음</option>
|
|
||||||
<option>있음</option>
|
|
||||||
</select>
|
|
||||||
}
|
|
||||||
rightLabel="전기전도도(µs/cm)"
|
|
||||||
rightControl={<InlineSuffixInput value={ec} onChange={setEc} suffix="이하" />}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 6행 */}
|
|
||||||
<QualityRow
|
|
||||||
leftLabel="색도(도)"
|
|
||||||
leftRequired
|
|
||||||
leftControl={<InlineSuffixInput value={color} onChange={setColor} suffix="이하" />}
|
|
||||||
rightLabel="비고"
|
|
||||||
rightControl={
|
|
||||||
<textarea
|
|
||||||
value={remark}
|
|
||||||
onChange={(e) => setRemark(e.target.value)}
|
|
||||||
className="h-11 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm outline-none focus:border-neutral-500"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{/* 후보지 선택 */}
|
|
||||||
<div className="grid grid-cols-12">
|
|
||||||
<LabelCell>
|
|
||||||
공급처 후보지 선택
|
|
||||||
<br />
|
|
||||||
(필수아님)
|
|
||||||
</LabelCell>
|
|
||||||
|
|
||||||
<div className="col-span-12 md:col-span-10 p-6">
|
|
||||||
<div className="flex flex-col gap-3 xl:flex-row xl:items-center xl:gap-4">
|
|
||||||
<TextInput value={cand1} onChange={setCand1} className="max-w-[220px]" />
|
|
||||||
<TextInput value={cand2} onChange={setCand2} className="max-w-[220px]" />
|
|
||||||
<TextInput value={cand3} onChange={setCand3} className="max-w-[220px]" />
|
|
||||||
|
|
||||||
<div className="flex items-center gap-3 xl:ml-2">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="h-11 rounded-md bg-[#888] px-5 text-base text-white hover:bg-neutral-700"
|
|
||||||
onClick={() => {
|
|
||||||
// TODO: 후보지 조회 모달/검색 연결
|
|
||||||
console.log("후보지 조회", { cand1, cand2, cand3 });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
후보지 조회
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="h-11 rounded-md bg-[#888] px-5 text-base text-white hover:bg-neutral-600"
|
|
||||||
onClick={() => {
|
|
||||||
// TODO: 유사사례 연결
|
|
||||||
console.log("유사사례");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
유사사례
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 하단 버튼 */}
|
|
||||||
<div className="flex justify-center py-12">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="h-11 rounded-md bg-[#0B4EA2] px-10 text-lg text-white hover:opacity-90"
|
|
||||||
onClick={() => {
|
|
||||||
// TODO: 저장 처리
|
|
||||||
console.log("수요정보 등록");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
수요정보 등록
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<WaterQualityRefModal
|
||||||
|
open={openRef}
|
||||||
|
onClose={() => setOpenRef(false)}
|
||||||
|
imageSrc="/images/landing/water_quality_ref_1.png"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</div>
|
||||||
|
|
||||||
|
<div className="border border-neutral-200 bg-white">
|
||||||
|
<QualityRow
|
||||||
|
leftLabel="총대장균군수(개/mg)"
|
||||||
|
leftRequired
|
||||||
|
leftControl={
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
<TextInput
|
||||||
|
value={coliform}
|
||||||
|
onChange={setColiform}
|
||||||
|
disabled={noDetect}
|
||||||
|
className={noDetect ? "bg-neutral-100 text-neutral-400" : ""}
|
||||||
|
/>
|
||||||
|
<label className="flex items-center gap-2 text-sm text-neutral-700">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={noDetect}
|
||||||
|
onChange={(e) => {
|
||||||
|
setNoDetect(e.target.checked);
|
||||||
|
if (e.target.checked) setColiform("");
|
||||||
|
}}
|
||||||
|
className="h-4 w-4 rounded border-neutral-300"
|
||||||
|
/>
|
||||||
|
불검출
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
rightLabel="총질소(T-N)(mg/L)"
|
||||||
|
rightControl={<InlineSuffixInput value={tn} onChange={setTn} suffix="이하" />}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<QualityRow
|
||||||
|
leftLabel="결합잔류염소(mg/L)"
|
||||||
|
leftRequired
|
||||||
|
leftControl={<TextInput value={residualCl} onChange={setResidualCl} />}
|
||||||
|
rightLabel="총인(T-P)(mg/L)"
|
||||||
|
rightControl={<InlineSuffixInput value={tp} onChange={setTp} suffix="이하" />}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<QualityRow
|
||||||
|
leftLabel="탁도(NTU)"
|
||||||
|
leftRequired
|
||||||
|
leftControl={<InlineSuffixInput value={turbidity} onChange={setTurbidity} suffix="이하" />}
|
||||||
|
rightLabel="수소이온농도(pH)"
|
||||||
|
rightControl={
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<TextInput value={ph.min} onChange={(v) => setPh((p) => ({ ...p, min: v }))} className="w-32" />
|
||||||
|
<span className="text-neutral-500">~</span>
|
||||||
|
<TextInput value={ph.max} onChange={(v) => setPh((p) => ({ ...p, max: v }))} className="w-32" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<QualityRow
|
||||||
|
leftLabel={
|
||||||
|
<>
|
||||||
|
생물화학적산소요구량
|
||||||
|
<br />
|
||||||
|
(BOD)(mg/L)
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
leftRequired
|
||||||
|
leftControl={<InlineSuffixInput value={bod} onChange={setBod} suffix="이하" />}
|
||||||
|
rightLabel="염화물(mgCL/L)"
|
||||||
|
rightControl={<InlineSuffixInput value={chloride} onChange={setChloride} suffix="이하" />}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<QualityRow
|
||||||
|
leftLabel="냄새"
|
||||||
|
leftRequired
|
||||||
|
leftControl={
|
||||||
|
<select
|
||||||
|
value={odor}
|
||||||
|
onChange={(e) => setOdor(e.target.value)}
|
||||||
|
className="h-11 w-full max-w-[200px] rounded-md border border-neutral-300 bg-white px-3 text-sm outline-none focus:border-neutral-500"
|
||||||
|
>
|
||||||
|
<option>불쾌하지 않을 것</option>
|
||||||
|
<option>약간 있음</option>
|
||||||
|
<option>있음</option>
|
||||||
|
</select>
|
||||||
|
}
|
||||||
|
rightLabel="전기전도도(µs/cm)"
|
||||||
|
rightControl={<InlineSuffixInput value={ec} onChange={setEc} suffix="이하" />}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<QualityRow
|
||||||
|
leftLabel="색도(도)"
|
||||||
|
leftRequired
|
||||||
|
leftControl={<InlineSuffixInput value={color} onChange={setColor} suffix="이하" />}
|
||||||
|
rightLabel="비고"
|
||||||
|
rightControl={
|
||||||
|
<textarea
|
||||||
|
value={remark}
|
||||||
|
onChange={(e) => setRemark(e.target.value)}
|
||||||
|
className="h-11 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm outline-none focus:border-neutral-500"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-12">
|
||||||
|
<LabelCell>
|
||||||
|
공급처 후보지 선택
|
||||||
|
<br />
|
||||||
|
(필수아님)
|
||||||
|
</LabelCell>
|
||||||
|
|
||||||
|
<div className="col-span-12 md:col-span-10 p-6">
|
||||||
|
<div className="flex flex-col gap-3 xl:flex-row xl:items-center xl:gap-4">
|
||||||
|
<TextInput value={cand1} onChange={setCand1} className="max-w-[220px]" />
|
||||||
|
<TextInput value={cand2} onChange={setCand2} className="max-w-[220px]" />
|
||||||
|
<TextInput value={cand3} onChange={setCand3} className="max-w-[220px]" />
|
||||||
|
|
||||||
|
<div className="flex items-center gap-3 xl:ml-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="h-11 rounded-md bg-[#888] px-5 text-base text-white hover:bg-neutral-700"
|
||||||
|
onClick={() => setOpenCand(true)}
|
||||||
|
>
|
||||||
|
후보지 조회
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="h-11 rounded-md bg-[#888] px-5 text-base text-white hover:bg-neutral-700"
|
||||||
|
onClick={() => setOpenSimilar(true)}
|
||||||
|
>
|
||||||
|
유사사례 조회
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-center py-12">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="h-11 rounded-md bg-[#0B4EA2] px-10 text-lg text-white hover:opacity-90"
|
||||||
|
onClick={() => console.log("수요정보 등록")}
|
||||||
|
>
|
||||||
|
수요정보 등록
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{/* 후보지 조회 모달 */}
|
||||||
|
<CandidateSiteModal
|
||||||
|
open={openCand}
|
||||||
|
onClose={() => setOpenCand(false)}
|
||||||
|
initialSelected={selectedCands}
|
||||||
|
onApply={(list) => {
|
||||||
|
setSelectedCands(list);
|
||||||
|
setCand1(list[0]?.name ?? "");
|
||||||
|
setCand2(list[1]?.name ?? "");
|
||||||
|
setCand3(list[2]?.name ?? "");
|
||||||
|
setOpenCand(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 유사사례 모달 */}
|
||||||
|
<SimilarCaseModal
|
||||||
|
open={openSimilar}
|
||||||
|
onClose={() => setOpenSimilar(false)}
|
||||||
|
rows={similarRows}
|
||||||
|
detailsByCaseId={similarDetailsByCaseId}
|
||||||
|
onSearch={async (criterion) => {
|
||||||
|
console.log(criterion);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -308,7 +655,7 @@ function LabelCell({
|
|||||||
required?: boolean;
|
required?: boolean;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="col-span-12 md:col-span-2 flex items-center justify-center text-center bg-emerald-50/70 px-6 py-6 text-lg font-semibold text-neutral-800">
|
<div className="col-span-12 md:col-span-2 flex items-center justify-center bg-emerald-50/70 px-6 py-6 text-center text-lg font-semibold text-neutral-800">
|
||||||
<span className="inline-flex items-center gap-1">
|
<span className="inline-flex items-center gap-1">
|
||||||
{children}
|
{children}
|
||||||
{required ? <span className="text-red-500">*</span> : null}
|
{required ? <span className="text-red-500">*</span> : null}
|
||||||
@@ -349,23 +696,19 @@ function QualityRow({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-12">
|
<div className="grid grid-cols-12">
|
||||||
{/* 좌측 라벨 */}
|
<div className="col-span-12 lg:col-span-2 flex items-center justify-center bg-emerald-50/70 px-6 py-6 text-center text-lg font-semibold text-neutral-800">
|
||||||
<div className="col-span-12 lg:col-span-2 flex items-center justify-center text-center bg-emerald-50/70 px-6 py-6 text-lg font-semibold text-neutral-800">
|
|
||||||
<span className="inline-flex items-center gap-1">
|
<span className="inline-flex items-center gap-1">
|
||||||
<span className="leading-6">{leftLabel}</span>
|
<span className="leading-6">{leftLabel}</span>
|
||||||
{leftRequired ? <span className="text-red-500">*</span> : null}
|
{leftRequired ? <span className="text-red-500">*</span> : null}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 좌측 입력 */}
|
|
||||||
<div className="col-span-12 lg:col-span-4 p-6">{leftControl}</div>
|
<div className="col-span-12 lg:col-span-4 p-6">{leftControl}</div>
|
||||||
|
|
||||||
{/* 우측 라벨 */}
|
<div className="col-span-12 lg:col-span-2 flex items-center justify-center bg-emerald-50/70 px-6 py-6 text-center text-lg font-semibold text-neutral-800">
|
||||||
<div className="col-span-12 lg:col-span-2 flex items-center justify-center text-center bg-emerald-50/70 px-6 py-6 text-lg font-semibold text-neutral-800">
|
|
||||||
<span className="leading-6">{rightLabel}</span>
|
<span className="leading-6">{rightLabel}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 우측 입력 */}
|
|
||||||
<div className="col-span-12 lg:col-span-4 p-6">{rightControl}</div>
|
<div className="col-span-12 lg:col-span-4 p-6">{rightControl}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -424,23 +767,21 @@ function DateInput({
|
|||||||
value: string;
|
value: string;
|
||||||
onChange: (v: string) => void;
|
onChange: (v: string) => void;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const ref = useRef<HTMLInputElement | null>(null);
|
const ref = useRef<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
const openPicker = () => {
|
const openPicker = () => {
|
||||||
const el = ref.current;
|
const el = ref.current;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
// Chrome/Edge 등 지원
|
|
||||||
if (typeof (el as any).showPicker === "function") {
|
if (typeof (el as any).showPicker === "function") {
|
||||||
(el as any).showPicker();
|
(el as any).showPicker();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback (일부 브라우저)
|
|
||||||
el.focus();
|
el.focus();
|
||||||
el.click();
|
el.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full max-w-[200px]">
|
<div className="relative w-full max-w-[200px]">
|
||||||
<input
|
<input
|
||||||
@@ -450,7 +791,6 @@ function DateInput({
|
|||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
className={[
|
className={[
|
||||||
"h-11 w-full rounded-md border border-neutral-300 bg-white px-3 pr-10 text-sm outline-none focus:border-neutral-500",
|
"h-11 w-full rounded-md border border-neutral-300 bg-white px-3 pr-10 text-sm outline-none focus:border-neutral-500",
|
||||||
// ✅ 기본 달력 아이콘 숨김 (Tailwind arbitrary selector)
|
|
||||||
"[&::-webkit-calendar-picker-indicator]:opacity-0",
|
"[&::-webkit-calendar-picker-indicator]:opacity-0",
|
||||||
"[&::-webkit-calendar-picker-indicator]:absolute",
|
"[&::-webkit-calendar-picker-indicator]:absolute",
|
||||||
"[&::-webkit-calendar-picker-indicator]:right-0",
|
"[&::-webkit-calendar-picker-indicator]:right-0",
|
||||||
@@ -460,7 +800,6 @@ function DateInput({
|
|||||||
].join(" ")}
|
].join(" ")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* ✅ 클릭 가능한 아이콘 버튼 */}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={openPicker}
|
onClick={openPicker}
|
||||||
@@ -468,9 +807,15 @@ function DateInput({
|
|||||||
aria-label="달력 열기"
|
aria-label="달력 열기"
|
||||||
>
|
>
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||||
<path d="M7.14286 7.99104H16.7812M6.48512 2.5625V4.19126M17.3125 2.5625V4.19106M20.5 7.19106L20.5 18.5625C20.5 20.2194 19.1569 21.5625 17.5 21.5625H6.5C4.84315 21.5625 3.5 20.2194 3.5 18.5625V7.19106C3.5 5.53421 4.84315 4.19106 6.5 4.19106H17.5C19.1569 4.19106 20.5 5.53421 20.5 7.19106Z" stroke="#1A1A1A" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
|
<path
|
||||||
|
d="M7.14286 7.99104H16.7812M6.48512 2.5625V4.19126M17.3125 2.5625V4.19106M20.5 7.19106L20.5 18.5625C20.5 20.2194 19.1569 21.5625 17.5 21.5625H6.5C4.84315 21.5625 3.5 20.2194 3.5 18.5625V7.19106C3.5 5.53421 4.84315 4.19106 6.5 4.19106H17.5C19.1569 4.19106 20.5 5.53421 20.5 7.19106Z"
|
||||||
|
stroke="#1A1A1A"
|
||||||
|
strokeWidth={2}
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
//import { useDmStore } from "@/app/store";
|
||||||
|
|
||||||
type WaterDetail = {
|
type WaterDetail = {
|
||||||
toc: string;
|
toc: string;
|
||||||
@@ -114,12 +115,17 @@ type PairField = { label: string; value: string };
|
|||||||
export default function DemandStatusPage() {
|
export default function DemandStatusPage() {
|
||||||
const rows = useMemo(() => MOCK, []);
|
const rows = useMemo(() => MOCK, []);
|
||||||
|
|
||||||
// ✅ rows가 빈 경우도 대비 (런타임 오류 방지)
|
// rows가 빈 경우도 대비 (런타임 오류 방지)
|
||||||
const [selectedId, setSelectedId] = useState<number | null>(rows[0]?.id ?? null);
|
const [selectedId, setSelectedId] = useState<number | null>(rows[0]?.id ?? null);
|
||||||
|
|
||||||
// ✅ 상세영역 스크롤 이동용
|
// 상세영역 스크롤 이동용
|
||||||
const detailRef = useRef<HTMLDivElement | null>(null);
|
const detailRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
// update
|
||||||
|
/* const updateSdmInfoData = useDmStore(
|
||||||
|
(state) => state.updateSdmInfoData
|
||||||
|
); */
|
||||||
|
|
||||||
// ✅ selected 계산 안정화
|
// ✅ selected 계산 안정화
|
||||||
const selected = useMemo(() => {
|
const selected = useMemo(() => {
|
||||||
if (!rows.length) return null;
|
if (!rows.length) return null;
|
||||||
@@ -227,7 +233,7 @@ export default function DemandStatusPage() {
|
|||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
key={r.id}
|
key={r.id}
|
||||||
role="button"
|
role="row"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() => onSelectRow(r.id)}
|
onClick={() => onSelectRow(r.id)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
@@ -262,14 +268,23 @@ export default function DemandStatusPage() {
|
|||||||
|
|
||||||
{/* 상세현황 */}
|
{/* 상세현황 */}
|
||||||
<section className="mt-10 pb-16" ref={detailRef}>
|
<section className="mt-10 pb-16" ref={detailRef}>
|
||||||
<div className="text-2xl font-bold text-slate-700">수요신청 상세현황</div>
|
|
||||||
|
<div className="flex justify-between items-center">
|
||||||
|
<div className="text-2xl font-bold text-slate-700">수요신청 상세현황</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="h-8 rounded-md bg-[#888] px-4 text-base text-white hover:bg-neutral-700"
|
||||||
|
>
|
||||||
|
수정
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
{!selected ? (
|
{!selected ? (
|
||||||
<div className="mt-3 border border-neutral-200 px-6 py-10 text-center text-sm text-slate-400">
|
<div className="mt-3 border border-neutral-200 px-6 py-10 text-center text-sm text-slate-400">
|
||||||
상세 정보를 표시할 신청건이 없습니다.
|
상세 정보를 표시할 신청건이 없습니다.
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="mt-3 border border-neutral-200">
|
<div className="mt-3 border border-neutral-200">
|
||||||
<div className="bg-sky-50 px-4 py-3 text-sm font-semibold text-slate-700 border-b border-neutral-200">
|
<div className="bg-sky-50 px-4 py-3 text-sm font-semibold text-slate-700 border-b border-neutral-200">
|
||||||
요구수량
|
요구수량
|
||||||
</div>
|
</div>
|
||||||
@@ -328,8 +343,30 @@ export default function DemandStatusPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
{/* 수요신청 진행상태 */}
|
||||||
|
<div className="col-span-12 bg-sky-50 px-4 py-3 text-sm font-semibold text-slate-700 border-t border-b border-neutral-200">
|
||||||
|
수요신청 진행상태
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-span-12 md:col-span-4 grid grid-cols-12 border-b md:border-b-0 border-neutral-200">
|
||||||
|
<div className="col-span-5 bg-sky-50 px-3 py-4 flex items-center justify-center text-center font-semibold text-slate-700">
|
||||||
|
진행상태
|
||||||
|
</div>
|
||||||
|
<div className="col-span-7 px-3 py-4 flex items-center justify-center text-center">
|
||||||
|
{selected.status}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-span-12 md:col-span-4 grid grid-cols-12 border-b md:border-b-0 border-neutral-200">
|
||||||
|
<div className="col-span-5 bg-sky-50 px-3 py-4 flex items-center justify-center text-center font-semibold text-slate-700">
|
||||||
|
공급처매칭결과
|
||||||
|
</div>
|
||||||
|
<div className="col-span-7 px-3 py-4 flex items-center justify-center text-center">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
return <div className={`h-[2px] w-full bg-black/10 ${className}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
// type ImgCardProps = {
|
||||||
src: string;
|
// src: string;
|
||||||
alt: string;
|
// alt: string;
|
||||||
};
|
// };
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
// function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
// return (
|
||||||
<div className="w-full overflow-x-auto">
|
// <div className="w-full overflow-x-auto">
|
||||||
<img
|
// <img
|
||||||
src={src}
|
// src={src}
|
||||||
alt={alt}
|
// alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
// className="block mx-auto max-w-none"
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function GreywaterPage() {
|
export default function GreywaterPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
// apps/dm/app/(landing)/reuse/cases/greywater/page.tsx
|
// apps/dm/app/(landing)/reuse/cases/greywater/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import greywaterOverall from "@/public/images/landing/cases/greywater_overall.png";
|
||||||
|
import greywaterFactory from "@/public/images/landing/cases/greywater_factory.png";
|
||||||
|
import greywaterBuilding from "@/public/images/landing/cases/greywater_building.png";
|
||||||
|
import greywaterUsage from "@/public/images/landing/cases/greywater_usage.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +26,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +64,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>전체 중수도 설치 및 이용 현황 (공장 및 발전시설 제외)</SectionTitle>
|
<SectionTitle>전체 중수도 설치 및 이용 현황 (공장 및 발전시설 제외)</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/greywater_overall.png" alt="전체 중수도 설치 및 이용 현황 설명" />
|
<ImgCard src={greywaterOverall} alt="전체 중수도 설치 및 이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +74,7 @@ export default function GreywaterPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>공장 및 발전시설 내 중수도 설치 및 이용 현황</SectionTitle>
|
<SectionTitle>공장 및 발전시설 내 중수도 설치 및 이용 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/greywater_factory.png" alt="공장 및 발전시설 내 중수도 설치 및 이용 현황 설명" />
|
<ImgCard src={greywaterFactory} alt="공장 및 발전시설 내 중수도 설치 및 이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -78,7 +84,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="pb-16">
|
<section className="pb-16">
|
||||||
<SectionTitle>중수도 건축물별 이용량 현황</SectionTitle>
|
<SectionTitle>중수도 건축물별 이용량 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/greywater_building.png" alt="중수도 건축물별 이용량 현황 설명" />
|
<ImgCard src={greywaterBuilding} alt="중수도 건축물별 이용량 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -88,7 +94,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="pb-[200px]">
|
<section className="pb-[200px]">
|
||||||
<SectionTitle>중수도 용도별 이용량 현황</SectionTitle>
|
<SectionTitle>중수도 용도별 이용량 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/greywater_usage.png" alt="중수도 용도별 이용량 현황 설명" />
|
<ImgCard src={greywaterUsage} alt="중수도 용도별 이용량 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
// apps/dm/app/(landing)/reuse/cases/rain/page.tsx
|
// apps/dm/app/(landing)/reuse/cases/rain/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import rainwaterBuilding from "@/public/images/landing/cases/rainwater_building.png";
|
||||||
|
import rainwaterUsage from "@/public/images/landing/cases/rainwater_usage.png";
|
||||||
|
import rainwaterUsageAmount from "@/public/images/landing/cases/rainwater_usage_amount.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +25,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +63,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>빗물이용시설의 건축물별 빗물이용량 현황</SectionTitle>
|
<SectionTitle>빗물이용시설의 건축물별 빗물이용량 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/rainwater_building.png" alt="빗물이용시설의 건축물별 빗물이용량 현황 설명" />
|
<ImgCard src={rainwaterBuilding} alt="빗물이용시설의 건축물별 빗물이용량 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +73,7 @@ export default function GreywaterPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>빗물이용시설의 용도별 분포 (2023년 기준)</SectionTitle>
|
<SectionTitle>빗물이용시설의 용도별 분포 (2023년 기준)</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/rainwater_usage.png" alt="빗물이용시설의 용도별 분포 설명" />
|
<ImgCard src={rainwaterUsage} alt="빗물이용시설의 용도별 분포 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -78,7 +83,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="pb-[200px]">
|
<section className="pb-[200px]">
|
||||||
<SectionTitle>빗물이용시설의 용도별 빗물이용량 현황</SectionTitle>
|
<SectionTitle>빗물이용시설의 용도별 빗물이용량 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/rainwater_usage_amount.png" alt="빗물이용시설의 용도별 빗물이용량 현황 설명" />
|
<ImgCard src={rainwaterUsageAmount} alt="빗물이용시설의 용도별 빗물이용량 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
// apps/dm/app/(landing)/reuse/cases/treated/page.tsx
|
// apps/dm/app/(landing)/reuse/cases/treated/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import treatedWaterYear from "@/public/images/landing/cases/treated_water_year.png";
|
||||||
|
import treatedWaterUsage from "@/public/images/landing/cases/treated_water_usage.png";
|
||||||
|
import treatedWaterFacility from "@/public/images/landing/cases/treated_water_facility.png";
|
||||||
|
import treatedWaterRegion from "@/public/images/landing/cases/treated_water_region.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +26,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +64,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>연도별 하수처리수 재이용 현황</SectionTitle>
|
<SectionTitle>연도별 하수처리수 재이용 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/treated_water_year.png" alt="연도별 하수처리수 재이용 현황 설명" />
|
<ImgCard src={treatedWaterYear} alt="연도별 하수처리수 재이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +74,7 @@ export default function GreywaterPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>용도별 하수처리수 재이용 현황</SectionTitle>
|
<SectionTitle>용도별 하수처리수 재이용 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/treated_water_usage.png" alt="용도별 하수처리수 재이용 현황 설명" />
|
<ImgCard src={treatedWaterUsage} alt="용도별 하수처리수 재이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -78,7 +84,7 @@ export default function GreywaterPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>하수처리시설 설치 및 이용 현황</SectionTitle>
|
<SectionTitle>하수처리시설 설치 및 이용 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/treated_water_facility.png" alt="하수처리시설 설치 및 이용 현황 설명" />
|
<ImgCard src={treatedWaterFacility} alt="하수처리시설 설치 및 이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -88,7 +94,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="pb-[200px]">
|
<section className="pb-[200px]">
|
||||||
<SectionTitle>시도별 하수처리수 재이용 현황</SectionTitle>
|
<SectionTitle>시도별 하수처리수 재이용 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/cases/treated_water_region.png" alt="시도별 하수처리수 재이용 현황 설명" />
|
<ImgCard src={treatedWaterRegion} alt="시도별 하수처리수 재이용 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
// apps/dm/app/(landing)/reuse/intro/greywater/page.tsx
|
// apps/dm/app/(landing)/reuse/intro/greywater/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import greywaterIntro from "@/public/images/landing/intro/greywater_intro.png";
|
||||||
|
import greywaterMandatory from "@/public/images/landing/intro/greywater_mandatory.png";
|
||||||
|
import greywaterStandard from "@/public/images/landing/intro/greywater_standard.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +25,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +63,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>중수 재이용 소개</SectionTitle>
|
<SectionTitle>중수 재이용 소개</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/greywater_intro.png" alt="중수 재이용 소개" />
|
<ImgCard src={greywaterIntro} alt="중수 재이용 소개" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +73,7 @@ export default function GreywaterPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>중수도 설치 의무 대상</SectionTitle>
|
<SectionTitle>중수도 설치 의무 대상</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/greywater_mandatory.png" alt="중수도 설치 의무 대상 설명" />
|
<ImgCard src={greywaterMandatory} alt="중수도 설치 의무 대상 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -78,7 +83,7 @@ export default function GreywaterPage() {
|
|||||||
<section className="pb-[200px]">
|
<section className="pb-[200px]">
|
||||||
<SectionTitle>중수도 시설기준 및 관리기준</SectionTitle>
|
<SectionTitle>중수도 시설기준 및 관리기준</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/greywater_standard.png" alt="중수도 시설기준 및 관리기준 설명" />
|
<ImgCard src={greywaterStandard} alt="중수도 시설기준 및 관리기준 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
// apps/dm/app/(landing)/reuse/intro/law/page.tsx
|
// apps/dm/app/(landing)/reuse/intro/law/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import lawTimeline from "@/public/images/landing/intro/law_timeline.png";
|
||||||
|
import performanceLeft from "@/public/images/landing/intro/performance_left.png";
|
||||||
|
import domesticTextbox from "@/public/images/landing/intro/domestic_textbox.png";
|
||||||
|
import policyTimeline from "@/public/images/landing/intro/policy_timeline.png";
|
||||||
|
import relNote from "@/public/images/landing/intro/rel_note.png";
|
||||||
|
import linkage from "@/public/images/landing/intro/linkage.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +28,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +66,7 @@ export default function WaterReuseLawPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>법제도 · 계획 및 기본계획 수립</SectionTitle>
|
<SectionTitle>법제도 · 계획 및 기본계획 수립</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/law_timeline.png" alt="법제도 타임라인" />
|
<ImgCard src={lawTimeline} alt="법제도 타임라인" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +76,7 @@ export default function WaterReuseLawPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>제 2차 계획 대비 실적 현황</SectionTitle>
|
<SectionTitle>제 2차 계획 대비 실적 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/performance_left.png" alt="실적 현황 요약" />
|
<ImgCard src={performanceLeft} alt="실적 현황 요약" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -78,7 +86,7 @@ export default function WaterReuseLawPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>국내 관련 현황</SectionTitle>
|
<SectionTitle>국내 관련 현황</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/domestic_textbox.png" alt="국내 관련 현황 설명" />
|
<ImgCard src={domesticTextbox} alt="국내 관련 현황 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -88,7 +96,7 @@ export default function WaterReuseLawPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>물 재이용 정책 변천 추이</SectionTitle>
|
<SectionTitle>물 재이용 정책 변천 추이</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/policy_timeline.png" alt="정책 변천 타임라인" />
|
<ImgCard src={policyTimeline} alt="정책 변천 타임라인" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -98,7 +106,7 @@ export default function WaterReuseLawPage() {
|
|||||||
<section>
|
<section>
|
||||||
<SectionTitle>타법령과의 관계도</SectionTitle>
|
<SectionTitle>타법령과의 관계도</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/rel_note.png" alt="관계도 설명" />
|
<ImgCard src={relNote} alt="관계도 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -114,7 +122,7 @@ export default function WaterReuseLawPage() {
|
|||||||
• 물관리 계획(국가수도기본계획, 국가 및 유역하수도종합계획, 하천유역수자원관리계획 등)과의 연계성 확보 → 통합적인 관점에서 물이용 체계 구축 필요
|
• 물관리 계획(국가수도기본계획, 국가 및 유역하수도종합계획, 하천유역수자원관리계획 등)과의 연계성 확보 → 통합적인 관점에서 물이용 체계 구축 필요
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ImgCard src="/images/landing/intro/linkage.png" alt="국내 연계 현황" />
|
<ImgCard src={linkage} alt="국내 연계 현황" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
// apps/dm/app/(landing)/reuse/intro/law/page.tsx
|
// apps/dm/app/(landing)/reuse/intro/law/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import rainreuseIntro from "@/public/images/landing/intro/rainreuse_intro.png";
|
||||||
|
import rainreuseMandatory from "@/public/images/landing/intro/rainreuse_mandatory.png";
|
||||||
|
import rainwaterDesign from "@/public/images/landing/intro/rainwater_design.png";
|
||||||
|
import rainwaterStandards from "@/public/images/landing/intro/rainwater_standards.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +26,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,19 +64,40 @@ export default function RainwaterReusePage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>빗물 재이용 소개</SectionTitle>
|
<SectionTitle>빗물 재이용 소개</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/rainreuse_intro.png" alt="빗물 재이용 소개" />
|
<ImgCard src={rainreuseIntro} alt="빗물 재이용 소개" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Hr className="my-11" />
|
<Hr className="my-11" />
|
||||||
|
|
||||||
{/* 2) 빗물이용시설 설치 관리 법적 의무 대상 */}
|
{/* 2) 빗물이용시설 설치 관리 법적 의무 대상 */}
|
||||||
<section className="pb-[200px]">
|
<section className="mt-6">
|
||||||
<SectionTitle>빗물이용시설 설치 관리 법적 의무 대상</SectionTitle>
|
<SectionTitle>빗물이용시설 설치 관리 법적 의무 대상</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/rainreuse_mandatory.png" alt="법적 의무 대상 설명" />
|
<ImgCard src={rainreuseMandatory} alt="법적 의무 대상 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<Hr className="my-11" />
|
||||||
|
|
||||||
|
{/* 3) 빗물이용시설 설계 방안 */}
|
||||||
|
<section className="mt-6">
|
||||||
|
<SectionTitle>빗물이용시설 설계 방안</SectionTitle>
|
||||||
|
<div className="mt-8">
|
||||||
|
<ImgCard src={rainwaterDesign} alt="빗물이용시설 설계 방안 설명" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<Hr className="my-11" />
|
||||||
|
|
||||||
|
{/* 4) 빗물이용시설 시설기준 및 관리기준 */}
|
||||||
|
<section className="pb-[200px]">
|
||||||
|
<SectionTitle>빗물이용시설 시설기준 및 관리기준</SectionTitle>
|
||||||
|
<div className="mt-8">
|
||||||
|
<ImgCard src={rainwaterStandards} alt="빗물이용시설 시설기준 및 관리기준 설명" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
// apps/dm/app/(landing)/reuse/intro/treated/page.tsx
|
// apps/dm/app/(landing)/reuse/intro/treated/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Image, { type StaticImageData } from "next/image";
|
||||||
import SubPageHeader from "../../_components/SubPageHeader";
|
import SubPageHeader from "../../_components/SubPageHeader";
|
||||||
|
import treatedwaterIntro from "@/public/images/landing/intro/treatedwater_intro.png";
|
||||||
|
import treatedwaterMandatory from "@/public/images/landing/intro/treatedwater_mandatory.png";
|
||||||
|
|
||||||
function SectionTitle({ children }: { children: React.ReactNode }) {
|
function SectionTitle({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@@ -21,17 +24,18 @@ function Hr({ className = "" }: HrProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImgCardProps = {
|
type ImgCardProps = {
|
||||||
src: string;
|
src: StaticImageData;
|
||||||
alt: string;
|
alt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ImgCard({ src, alt }: ImgCardProps) {
|
function ImgCard({ src, alt }: ImgCardProps) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<img
|
<Image
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
className="block mx-auto max-w-none"
|
className="block mx-auto max-w-none"
|
||||||
|
style={{ width: "auto", height: "auto" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -58,7 +62,7 @@ export default function TreatedWaterPage() {
|
|||||||
<section className="mt-6">
|
<section className="mt-6">
|
||||||
<SectionTitle>하수처리수</SectionTitle>
|
<SectionTitle>하수처리수</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/treatedwater_intro.png" alt="하수처리수 설명" />
|
<ImgCard src={treatedwaterIntro} alt="하수처리수 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ export default function TreatedWaterPage() {
|
|||||||
<section className="pb-[200px]">
|
<section className="pb-[200px]">
|
||||||
<SectionTitle>하수처리수 재이용시설 의무 대상</SectionTitle>
|
<SectionTitle>하수처리수 재이용시설 의무 대상</SectionTitle>
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<ImgCard src="/images/landing/intro/treatedwater_mandatory.png" alt="하수처리수 재이용시설 의무 대상 설명" />
|
<ImgCard src={treatedwaterMandatory} alt="하수처리수 재이용시설 의무 대상 설명" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
// apps/dm/app/(landing)/reuse/layout.tsx
|
// apps/dm/app/(landing)/reuse/layout.tsx
|
||||||
import "./reuse.module.css";
|
"use client";
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import TopNav from "./_components/TopNav";
|
import "./reuse.module.css";
|
||||||
|
|
||||||
|
import TopNav from "./_components/TopNav";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
|
export default function ReuseLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
const hasLnb = pathname !== "/reuse"; // 예: 메인만 제외
|
||||||
|
|
||||||
export default function ReuseLandingLayout({ children }: { children: React.ReactNode }) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="pt-[83px]">
|
||||||
<div className="min-w-[1800px] overflow-x-auto">
|
{hasLnb && <TopNav />}
|
||||||
<TopNav />
|
<main className={hasLnb ? "ml-[260px]" : ""}>{children}</main>
|
||||||
<div className="pt-[83px]">{children}</div> {/* TopNav 높이만큼 */}
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// apps/dm/app/(landing)/reuse/page.tsx
|
// apps/dm/app/(landing)/reuse/page.tsx
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { useMemo } from "react";
|
||||||
import TopNav from "./_components/TopNav";
|
import TopNav from "./_components/TopNav";
|
||||||
import SideIndicator from "./_components/SideIndicator";
|
import SideIndicator from "./_components/SideIndicator";
|
||||||
import { useScrollSpy } from "./_hooks/useScrollSpy";
|
import { useScrollSpy } from "./_hooks/useScrollSpy";
|
||||||
@@ -30,7 +31,8 @@ const LANDING_SECTIONS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default function ReuseLandingPage() {
|
export default function ReuseLandingPage() {
|
||||||
const activeId = useScrollSpy(LANDING_SECTIONS.map((s) => s.id));
|
const sectionIds = useMemo(() => LANDING_SECTIONS.map((s) => s.id), []);
|
||||||
|
const activeId = useScrollSpy(sectionIds);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-white">
|
<main className="bg-white">
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
"use client";
|
||||||
|
import "../globals.css";
|
||||||
|
import { StoreProvider } from "../store";
|
||||||
|
|
||||||
|
export default function PopupLayout({
|
||||||
|
children,
|
||||||
|
}: Readonly<{
|
||||||
|
children: React.ReactNode;
|
||||||
|
}>) {
|
||||||
|
return <StoreProvider>{children}</StoreProvider>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Gis from "@common/business_components/ui/map/Gis";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { mapService } from "../service";
|
||||||
|
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||||
|
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||||
|
import SelectedFcltList from "./selectedFcltList";
|
||||||
|
import type { SubsInfo } from "@/app/store/map/type";
|
||||||
|
|
||||||
|
const Map = () => {
|
||||||
|
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||||
|
const gisMaps = useRef<any | null>(null);
|
||||||
|
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||||
|
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
|
||||||
|
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||||
|
const [selectDataPk, setSelectDataPk] = useState<Record<string, any>>({});
|
||||||
|
const [selectedFclts, setSelectedFclts] = useState<any[]>([]);
|
||||||
|
|
||||||
|
//적용 버튼 클릭 이벤트
|
||||||
|
const onApply = () => {
|
||||||
|
if (selectedFclts.length > 3) {
|
||||||
|
alert("재이용시설 후보지는 최대 3개까지만 선택할 수 있습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const subsInfoList: SubsInfo[] = selectedFclts.map((fclt) => ({
|
||||||
|
ruseUtztnFcltNm: fclt.ruseUtztnFcltNm,
|
||||||
|
ruseUtztnFcltCd: fclt.pbnstRuseFcltId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (!window.opener || typeof window.opener.postMessage !== "function") {
|
||||||
|
alert("부모 창을 찾을 수 없습니다. 팝업이 'noopener'로 열렸거나, 보안 정책으로 차단되었을 수 있어요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.opener.postMessage(
|
||||||
|
{
|
||||||
|
type: "SET_SUBS_INFO",
|
||||||
|
payload: subsInfoList, // 배열로 전송 (최대 3개)
|
||||||
|
},
|
||||||
|
"*"
|
||||||
|
);
|
||||||
|
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
//트리 레이어 데이터 조회
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await mapService.getLyrStngs();
|
||||||
|
setTreeData(response); // API 응답 저장
|
||||||
|
} catch (error) {
|
||||||
|
console.error("데이터 불러오기 실패:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//하수처리시설코드로 재이용시설 목록 조회
|
||||||
|
const reuseData = async (ruseFcltPk: any) => {
|
||||||
|
if (!ruseFcltPk) {
|
||||||
|
console.warn("[reuseData] ruseFcltPk가 없습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
console.log("[reuseData] API 호출 - ruseFcltPk:", ruseFcltPk);
|
||||||
|
const response = await mapService.getPbnstRuseFclts(ruseFcltPk);
|
||||||
|
console.log("[reuseData] API 응답 전체:", response);
|
||||||
|
// 응답이 배열이면 바로 사용, 객체면 .data 추출
|
||||||
|
const data = Array.isArray(response)
|
||||||
|
? response
|
||||||
|
: Array.isArray(response?.data)
|
||||||
|
? response.data
|
||||||
|
: response?.data
|
||||||
|
? [response.data]
|
||||||
|
: [];
|
||||||
|
console.log("[reuseData] 파싱된 data:", data);
|
||||||
|
setSelectedFclts((prev) => {
|
||||||
|
const newItems = data.filter(
|
||||||
|
(item: any) =>
|
||||||
|
item &&
|
||||||
|
Object.keys(item).length > 0 &&
|
||||||
|
!prev.some((f) => f.pbnstRuseFcltId === item.pbnstRuseFcltId)
|
||||||
|
);
|
||||||
|
console.log("[reuseData] 추가될 newItems:", newItems);
|
||||||
|
return [...prev, ...newItems];
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("데이터 불러오기 실패:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 컴포넌트 마운트 시 1회 실행
|
||||||
|
useEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 부모창에 초기 선택값 요청 (팝업 열릴 때 기존 선택 목록 받아오기)
|
||||||
|
useEffect(() => {
|
||||||
|
const origin = window.location.origin;
|
||||||
|
if (window.opener) {
|
||||||
|
window.opener.postMessage({ type: "REQUEST_INIT_SUBS_INFO" }, origin);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 부모창에서 초기 선택값 수신
|
||||||
|
useEffect(() => {
|
||||||
|
const origin = window.location.origin;
|
||||||
|
|
||||||
|
const handler = (event: MessageEvent) => {
|
||||||
|
if (event.origin !== origin) return;
|
||||||
|
|
||||||
|
const data = event.data;
|
||||||
|
if (!data || typeof data !== "object") return;
|
||||||
|
|
||||||
|
if (data.type === "INIT_SUBS_INFO") {
|
||||||
|
const list = Array.isArray(data.payload) ? data.payload : [];
|
||||||
|
setSelectedFclts(
|
||||||
|
list.map((x) => ({
|
||||||
|
ruseUtztnFcltNm: x.ruseUtztnFcltNm ?? "",
|
||||||
|
pbnstRuseFcltId: x.ruseUtztnFcltCd ?? "",
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("message", handler);
|
||||||
|
return () => window.removeEventListener("message", handler);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 레이어 생성 후 초기화 처리
|
||||||
|
const onCheckedLayersChange = () => {
|
||||||
|
//수요처 ID
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const dmdInfoId = urlParams.get("dmdInfoId");
|
||||||
|
console.log("[하이라이트] dmdInfoId:", dmdInfoId);
|
||||||
|
|
||||||
|
//수요처 위치로 화면 이동
|
||||||
|
const maps = gisMaps.current;
|
||||||
|
const layer = GisApp.Module.layer as any;
|
||||||
|
const layerNm = "tb_wr_ruse_fclt_dmd_co";
|
||||||
|
const featureId = `${layerNm}.${dmdInfoId}`;
|
||||||
|
let foundFeature: any = null;
|
||||||
|
|
||||||
|
// 현재 로드된 레이어 목록 출력
|
||||||
|
const allLayerNames = maps
|
||||||
|
.getLayers()
|
||||||
|
.getArray()
|
||||||
|
.map((l: any) => l.get("lyrTyNm") || l.get("name") || "(unnamed)");
|
||||||
|
console.log("[하이라이트] 전체 레이어 목록:", allLayerNames);
|
||||||
|
console.log("[하이라이트] 탐색 대상 레이어:", layerNm);
|
||||||
|
console.log("[하이라이트] 탐색 대상 featureId:", featureId);
|
||||||
|
|
||||||
|
maps
|
||||||
|
.getLayers()
|
||||||
|
.getArray()
|
||||||
|
.forEach((layer: any) => {
|
||||||
|
if (layer.get("lyrTyNm") == layerNm) {
|
||||||
|
console.log("[하이라이트] 레이어 발견:", layerNm);
|
||||||
|
const source = layer.getSource?.();
|
||||||
|
if (source?.getFeatureById) {
|
||||||
|
const feature = source.getFeatureById(String(featureId).trim());
|
||||||
|
console.log("[하이라이트] feature 탐색결과:", feature);
|
||||||
|
if (feature) {
|
||||||
|
foundFeature = feature;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// feature 못 찾을 때 소스 내 전체 feature ID 출력
|
||||||
|
if (source?.getFeatures) {
|
||||||
|
const allIds = source.getFeatures().map((f: any) => f.getId());
|
||||||
|
console.log("[하이라이트] 소스 내 전체 feature ID:", allIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!foundFeature) {
|
||||||
|
console.warn("[하이라이트] feature를 찾지 못했습니다. 위 레이어 목록/ID를 확인하세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundFeature) {
|
||||||
|
const geometry = foundFeature.getGeometry();
|
||||||
|
|
||||||
|
if (geometry) {
|
||||||
|
const extent = geometry.getExtent();
|
||||||
|
|
||||||
|
if (geometry.getType() === "Point") {
|
||||||
|
maps.getView().setCenter(geometry.getCoordinates());
|
||||||
|
maps.getView().setZoom(11);
|
||||||
|
} else {
|
||||||
|
maps.getView().fit(extent, {
|
||||||
|
duration: 300,
|
||||||
|
padding: [30, 30, 30, 30],
|
||||||
|
maxZoom: 16,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.highLightFeature(
|
||||||
|
[foundFeature],
|
||||||
|
{
|
||||||
|
id: GisApp.hlLayerId,
|
||||||
|
zIndex: 10,
|
||||||
|
opacity: 1,
|
||||||
|
selectable: true,
|
||||||
|
},
|
||||||
|
{ width: 30 }
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.warn("수요처의 좌표정보를 찾을 수 없습니다. dmdInfoId:", dmdInfoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatNumber = (val: any) => {
|
||||||
|
const num = Number(val);
|
||||||
|
return isNaN(num) ? "-" : num.toLocaleString();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 재이용시설 오버레이
|
||||||
|
maps
|
||||||
|
.getLayers()
|
||||||
|
.getArray()
|
||||||
|
.forEach((layer: any) => {
|
||||||
|
if (layer.get("lyrTyNm") === "tb_wr_bdst_ruse_fclt") {
|
||||||
|
const source = layer.getSource?.();
|
||||||
|
if (source?.getFeatures) {
|
||||||
|
const features = source.getFeatures();
|
||||||
|
|
||||||
|
features.forEach((feature: any) => {
|
||||||
|
// 필요한 고유 ID 또는 속성 가져오기 (예: ftrIdn 또는 feature.getId())
|
||||||
|
const featureId =
|
||||||
|
feature.getId() || feature.get("ftrIdn") || Math.random();
|
||||||
|
|
||||||
|
// HTML 또는 React 오버레이 컴포넌트 구성
|
||||||
|
const overlayContent = `
|
||||||
|
<div class="rounded-md border border-gray-300 bg-white shadow-md text-sm w-[120px]">
|
||||||
|
<!-- 헤더 -->
|
||||||
|
<div class="bg-cyan-700 text-white px-3 py-2 text-[11px] font-semibold text-center rounded-t-md">
|
||||||
|
${feature.get("swtrmt_fclt_nm") || "-"}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 테이블 -->
|
||||||
|
<table class="w-full text-sm text-gray-800 border-t border-gray-200">
|
||||||
|
<tbody>
|
||||||
|
<tr class="border-b border-gray-200">
|
||||||
|
<th class="bg-gray-100 text-gray-600 font-semibold text-[10px] text-left">용량(m³/일)</th>
|
||||||
|
<td class="text-right text-[10px] font-bold">${formatNumber(feature.get("fclt_cpct"))}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
feature.set("html", overlayContent);
|
||||||
|
feature.set("overLayId", `overLay.${featureId}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 검색해서 재이용시설 선택하면 해당 시설로 화면 이동 처리
|
||||||
|
useEffect(() => {
|
||||||
|
console.warn(selectDataPk);
|
||||||
|
if (!selectDataPk || Object.keys(selectDataPk).length === 0) return;
|
||||||
|
const maps = gisMaps.current;
|
||||||
|
let foundFeature: any = null;
|
||||||
|
const layerNm = "tb_wr_bdst_ruse_fclt";
|
||||||
|
const featureId = `${layerNm}.${selectDataPk.bscFctCd}`;
|
||||||
|
maps
|
||||||
|
.getLayers()
|
||||||
|
.getArray()
|
||||||
|
.forEach((layer: any) => {
|
||||||
|
if (layer.get("lyrTyNm") == layerNm) {
|
||||||
|
const source = layer.getSource?.();
|
||||||
|
if (source?.getFeatureById) {
|
||||||
|
const feature = source.getFeatureById(String(featureId).trim());
|
||||||
|
if (feature) {
|
||||||
|
foundFeature = feature;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (foundFeature) {
|
||||||
|
const geometry = foundFeature.getGeometry();
|
||||||
|
if (geometry) {
|
||||||
|
const extent = geometry.getExtent();
|
||||||
|
|
||||||
|
maps.getView().fit(extent, {
|
||||||
|
duration: 300,
|
||||||
|
padding: [50, 50, 50, 50],
|
||||||
|
maxZoom: 16,
|
||||||
|
constrainResolution: true,
|
||||||
|
nearest: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn("OpenLayers Feature를 찾을 수 없습니다:", selectDataPk);
|
||||||
|
}
|
||||||
|
}, [selectDataPk]);
|
||||||
|
|
||||||
|
// 재이용시설 클릭 시 선택 시설목록에 추가
|
||||||
|
const onFeatureSelect = (data: any) => {
|
||||||
|
// feature의 모든 속성 출력 (어떤 키가 있는지 확인)
|
||||||
|
const properties = data.getProperties?.() ?? {};
|
||||||
|
console.log("[onFeatureSelect] feature 속성 전체:", properties);
|
||||||
|
// 처리시설코드
|
||||||
|
const swtrmtFcltCd = data.get("swtrmt_fclt_cd");
|
||||||
|
console.log("[onFeatureSelect] swtrmt_fclt_cd:", swtrmtFcltCd);
|
||||||
|
reuseData(swtrmtFcltCd);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="bg-container">
|
||||||
|
<Gis
|
||||||
|
showZoomLevel={true}
|
||||||
|
height='h-screen'
|
||||||
|
treeData={treeData}
|
||||||
|
isSearch={false}
|
||||||
|
gisMaps={gisMaps}
|
||||||
|
isMiniMap={false}
|
||||||
|
searchView={undefined}
|
||||||
|
detailView={undefined}
|
||||||
|
onFeatureSelect={onFeatureSelect}
|
||||||
|
setIsOpen={setIsOpen}
|
||||||
|
setFeatureData={setFeatureData}
|
||||||
|
featureData={featureData}
|
||||||
|
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||||
|
isOpen={isOpen}
|
||||||
|
isSearchModalOpen={isSearchModalOpen}
|
||||||
|
onCheckedLayersChange={onCheckedLayersChange}
|
||||||
|
imgVisble={false}
|
||||||
|
searchBar={
|
||||||
|
<SearchBar
|
||||||
|
setHasuPk={(hasuPk: any) => {
|
||||||
|
if (hasuPk) setSelectDataPk(hasuPk);
|
||||||
|
}}
|
||||||
|
onApply={onApply}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
waterDepth={undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<SelectedFcltList
|
||||||
|
data={selectedFclts}
|
||||||
|
onRemove={(updatedList) => setSelectedFclts(updatedList)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Map;
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
type FcltItem = {
|
||||||
|
pbnstRuseFcltId: string;
|
||||||
|
ruseUtztnFcltNm: string;
|
||||||
|
splyExtraCpct?: number;
|
||||||
|
ruseCpct?: number;
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function SelectedFcltList({
|
||||||
|
data = [],
|
||||||
|
onRemove,
|
||||||
|
}: {
|
||||||
|
data: FcltItem[];
|
||||||
|
onRemove: (updatedList: FcltItem[]) => void;
|
||||||
|
}) {
|
||||||
|
const handleDelete = (code: string) => {
|
||||||
|
const updatedList = data.filter((item) => item.pbnstRuseFcltId !== code);
|
||||||
|
onRemove(updatedList);
|
||||||
|
};
|
||||||
|
|
||||||
|
const TableContent = (
|
||||||
|
<>
|
||||||
|
<thead className="bg-gray-100 text-gray-600 text-[11px] font-medium border-b border-cyan-800">
|
||||||
|
<tr>
|
||||||
|
<th className="px-2 py-1.5 text-left w-1/3">시설명</th>
|
||||||
|
<th className="px-2 py-1.5 text-right whitespace-nowrap">
|
||||||
|
처리량(㎥/일)
|
||||||
|
</th>
|
||||||
|
<th className="px-2 py-1.5 text-right whitespace-nowrap">
|
||||||
|
재이용량(㎥/일)
|
||||||
|
</th>
|
||||||
|
<th className="px-2 py-1.5 text-center w-10">삭제</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{data.map((item) => (
|
||||||
|
<tr key={item.pbnstRuseFcltId} className="border-b border-gray-100 last:border-none hover:bg-gray-50/50">
|
||||||
|
<td className="px-2 py-1.5 text-[11px] font-medium text-gray-800 break-keep">{item.ruseUtztnFcltNm}</td>
|
||||||
|
<td className="px-2 py-1.5 text-right text-[11px] text-gray-600">
|
||||||
|
{Number(item.splyExtraCpct || 0).toLocaleString()}
|
||||||
|
</td>
|
||||||
|
<td className="px-2 py-1.5 text-right text-[11px] text-gray-600">
|
||||||
|
{Number(item.ruseCpct || 0).toLocaleString()}
|
||||||
|
</td>
|
||||||
|
<td className="px-2 py-1.5 text-center">
|
||||||
|
<button
|
||||||
|
onClick={() => handleDelete(item.pbnstRuseFcltId)}
|
||||||
|
className="text-gray-400 hover:text-red-500 text-[11px] font-bold transition-colors"
|
||||||
|
aria-label="삭제"
|
||||||
|
title="삭제"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="fixed right-20 top-[3.5rem] w-[22rem] max-h-[80vh] overflow-hidden bg-white/95 backdrop-blur-sm shadow-[0_4px_12px_rgba(0,0,0,0.1)] rounded-lg border border-gray-200 z-50 flex flex-col">
|
||||||
|
<h3 className="bg-cyan-700 text-white text-[13px] font-semibold p-2">
|
||||||
|
선택된 시설
|
||||||
|
</h3>
|
||||||
|
<div className="overflow-y-auto w-full">
|
||||||
|
<table className="w-full text-sm text-gray-800 border-t border-gray-200 table-fixed">
|
||||||
|
{TableContent}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user