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:
@@ -22,6 +22,8 @@ export default function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const kakaoAppKey = process.env.NEXT_PUBLIC_KAKAO_APP_KEY;
|
||||
|
||||
return (
|
||||
<html lang="ko">
|
||||
<head>
|
||||
@@ -31,15 +33,17 @@ export default function RootLayout({
|
||||
crossOrigin="anonymous"
|
||||
async
|
||||
></script>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
if (typeof window !== 'undefined' && window.Kakao && !window.Kakao.isInitialized()) {
|
||||
window.Kakao.init('YOUR_KAKAO_APP_KEY'); // 실제 카카오 앱 키로 교체 필요
|
||||
}
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
{kakaoAppKey && (
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
if (typeof window !== 'undefined' && window.Kakao && !window.Kakao.isInitialized()) {
|
||||
window.Kakao.init('${kakaoAppKey}');
|
||||
}
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</head>
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user