feat: 카카오 앱 키 설정, 절기 기준 계산, 대운 정밀화

카카오 앱 키 설정:
- 환경 변수(.env.local)를 통한 안전한 키 관리
- NEXT_PUBLIC_KAKAO_APP_KEY 환경 변수 사용
- layout.tsx에서 환경 변수 읽어서 Kakao SDK 초기화
- .env.local 템플릿 파일 생성 (키 발급 가이드 포함)

음력 변환 정확도 개선:
- 24절기 계산 라이브러리 구현 (solar-terms.ts)
- 절기 기준 월주 계산으로 정확도 향상
- 입춘, 경칩, 청명 등 12개 월 절기 지원
- getSolarTermMonthBranch() - 절기 기준 월 지지 계산
- getCurrentSolarTerm() - 현재 절기 확인
- 사주 결과 페이지에 절기 정보 표시

대운 시작 나이 정밀 계산:
- 절기 기준 대운수 계산 구현
- 양남음녀(순행), 음남양녀(역행) 정확한 일수 계산
- 3일 = 1세 공식 적용
- calculateDaeunStartAge() 함수로 정밀 계산
- 이전 평균 8세 → 실제 계산값 (1~10세 범위)
- 대운 섹션에 시작 나이 계산 근거 표시

문서화:
- SETUP.md 생성
  - 카카오 앱 키 발급 및 설정 가이드
  - 절기 기준 사주 계산 설명
  - 대운 계산 원리 설명
  - 음력 변환 사용법
  - 기술 스택 및 개발 환경

사주 결과 페이지 개선:
- 절기 정보 표시 (녹색 박스)
- 대운 시작 나이 설명 추가
- 사용자에게 계산 원리 투명하게 공개

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 00:07:59 +09:00
parent affbdf1a44
commit e233e18a55
6 changed files with 472 additions and 25 deletions

View File

@@ -3,6 +3,8 @@ import Link from 'next/link';
import PDFButton from '../components/PDFButton';
import ShareButtons from '../components/ShareButtons';
import { calculateDaeun, getCurrentDaeun, getDaeunDescription } from '@/lib/daeun-calculator';
import { getCurrentSolarTerm, getSolarTermName, getSolarTermMonthBranch } from '@/lib/solar-terms';
import { EARTHLY_BRANCHES_KR } from '@/lib/saju-calculator';
interface PageProps {
searchParams: Promise<{
@@ -26,6 +28,12 @@ export default async function ResultPage({ searchParams }: PageProps) {
const sajuData = calculateSaju(yearNum, monthNum, dayNum, hourNum, gender);
// 절기 정보
const solarTermIndex = getCurrentSolarTerm(yearNum, monthNum, dayNum);
const solarTermName = getSolarTermName(solarTermIndex);
const monthBranchIndex = getSolarTermMonthBranch(yearNum, monthNum, dayNum);
const monthBranchName = EARTHLY_BRANCHES_KR[monthBranchIndex];
// 대운 계산
const daeunList = calculateDaeun(
yearNum,
@@ -174,10 +182,21 @@ export default async function ResultPage({ searchParams }: PageProps) {
</table>
</div>
<div className="mt-6 p-4 bg-blue-50 rounded-xl">
<p className="text-sm text-gray-700">
<strong className="text-blue-600"> ():</strong> {sajuData.day.stem}({sajuData.day.stemKr}) - .
</p>
<div className="mt-6 space-y-3">
<div className="p-4 bg-blue-50 rounded-xl">
<p className="text-sm text-gray-700">
<strong className="text-blue-600"> ():</strong> {sajuData.day.stem}({sajuData.day.stemKr}) - .
</p>
</div>
<div className="p-4 bg-green-50 rounded-xl">
<p className="text-sm text-gray-700">
<strong className="text-green-600"> ():</strong> {solarTermName} -
{monthBranchName}.
</p>
<p className="text-xs text-gray-600 mt-1">
* 24 .
</p>
</div>
</div>
</div>
@@ -297,10 +316,15 @@ export default async function ResultPage({ searchParams }: PageProps) {
</div>
<div className="mt-6 p-4 bg-indigo-50 rounded-xl">
<p className="text-sm text-gray-700">
<p className="text-sm text-gray-700 mb-2">
<strong className="text-indigo-600">():</strong> 10 .
, .
</p>
{daeunList.length > 0 && (
<p className="text-xs text-gray-600">
* {daeunList[0].age} . (3 = 1)
</p>
)}
</div>
</div>