diff --git a/src/app/pw-reset/layout.tsx b/src/app/pw-reset/layout.tsx
new file mode 100644
index 0000000..eb72abf
--- /dev/null
+++ b/src/app/pw-reset/layout.tsx
@@ -0,0 +1,23 @@
+import type { ReactNode } from 'react'
+
+interface PwResetLayoutProps {
+ children: ReactNode
+}
+
+export default function layout({ children }: PwResetLayoutProps) {
+ return (
+ <>
+
+
+
+
+
パスワードをリセットする
+
新しいパスワードを入力してください.
+
+
+ {children}
+
+
+ >
+ )
+}
diff --git a/src/app/pw-reset/page.tsx b/src/app/pw-reset/page.tsx
new file mode 100644
index 0000000..a1ac7f3
--- /dev/null
+++ b/src/app/pw-reset/page.tsx
@@ -0,0 +1,9 @@
+import PwResetForm from '@/components/pw-reset/PwResetForm'
+
+export default function page() {
+ return (
+ <>
+
+ >
+ )
+}
diff --git a/src/app/suitable/layout.tsx b/src/app/suitable/layout.tsx
index 25e2615..e5e7c3f 100644
--- a/src/app/suitable/layout.tsx
+++ b/src/app/suitable/layout.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from 'react'
+import type { ReactNode } from 'react'
interface SuitableLayoutProps {
children: ReactNode
diff --git a/src/app/survey-sale/layout.tsx b/src/app/survey-sale/layout.tsx
index c4e7854..f558ad6 100644
--- a/src/app/survey-sale/layout.tsx
+++ b/src/app/survey-sale/layout.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from 'react'
+import type { ReactNode } from 'react'
interface SurveySaleLayoutProps {
children: ReactNode
diff --git a/src/components/pw-reset/PwResetForm.tsx b/src/components/pw-reset/PwResetForm.tsx
new file mode 100644
index 0000000..1dd3d85
--- /dev/null
+++ b/src/components/pw-reset/PwResetForm.tsx
@@ -0,0 +1,59 @@
+'use client'
+
+import { useState } from 'react'
+import { useRouter } from 'next/navigation'
+
+export default function PwResetForm() {
+ const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기
+ const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기
+ const router = useRouter()
+
+ return (
+ <>
+
+
+
+
+ 新規パスワード再入力 *
+
+
+
+
+
+
+
+
10文字以内
+
+
+
+ 新規パスワード入力 *
+
+
+
+
+
+
+
+
10文字以内
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
diff --git a/src/components/ui/common/Header.tsx b/src/components/ui/common/Header.tsx
index f2e56ee..6630e1a 100644
--- a/src/components/ui/common/Header.tsx
+++ b/src/components/ui/common/Header.tsx
@@ -4,27 +4,23 @@ import Link from 'next/link'
import { usePathname, useRouter } from 'next/navigation'
import { Swiper, SwiperSlide } from 'swiper/react'
+import { useQueryClient } from '@tanstack/react-query'
import { useSideNavState } from '@/store/sideNavState'
import { useHeaderStore } from '@/store/header'
+import { useSessionStore } from '@/store/session'
+import { useTitle } from '@/hooks/useTitle'
-import type { HeaderProps } from '@/types/Header'
+import { axiosInstance } from '@/libs/axios'
import 'swiper/css'
-import { axiosInstance } from '@/libs/axios'
-import { useSessionStore } from '@/store/session'
-import { useQueryClient } from '@tanstack/react-query'
-// type HeaderProps = {
-// name: string //header 이름
-// backBtn: boolean // 뒤로가기 버튼 유무
-// }
-
-export default function Header({ name }: HeaderProps) {
+export default function Header() {
const router = useRouter()
const pathname = usePathname()
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
const { backBtn } = useHeaderStore()
+ const { getTitle } = useTitle()
const { session, reset } = useSessionStore()
const queryClient = useQueryClient()
@@ -53,7 +49,7 @@ export default function Header({ name }: HeaderProps) {
)}
@@ -112,7 +108,7 @@ export default function Header({ name }: HeaderProps) {
-
+
diff --git a/src/hooks/useTitle.ts b/src/hooks/useTitle.ts
new file mode 100644
index 0000000..d2f2aa0
--- /dev/null
+++ b/src/hooks/useTitle.ts
@@ -0,0 +1,37 @@
+export const useTitle = () => {
+ const getTitle = (pathname: string) => {
+ // Handle dynamic routes first
+ if (pathname.startsWith('/survey-sale/') && pathname !== '/survey-sale/basic-info' && pathname !== '/survey-sale/roof-info') {
+ return '調査物件一覧'
+ }
+
+ if (pathname.startsWith('/inquiry/') && pathname !== '/inquiry/list' && pathname !== '/inquiry/regist') {
+ return '1:1お問い合わせ詳細'
+ }
+
+ // Handle static routes
+ switch (pathname) {
+ case '/':
+ return 'Hanasys 現地調査'
+ case '/suitable':
+ return '屋根材適合性の確認'
+ case '/survey-sale':
+ return '調査物件一覧'
+ case '/survey-sale/basic-info':
+ return '調査物件登録'
+ case '/survey-sale/roof-info':
+ return '調査物件新規登録'
+ case '/inquiry/list':
+ return '1:1お問い合わせ'
+ case '/inquiry/regist':
+ return '1:1お問い合わせ'
+ case '/pw-reset':
+ return 'パスワードリセット'
+
+ default:
+ return 'Hanasys 現地調査'
+ }
+ }
+
+ return { getTitle }
+}
diff --git a/src/providers/EdgeProvider.tsx b/src/providers/EdgeProvider.tsx
index 3d8ea42..4d789f3 100644
--- a/src/providers/EdgeProvider.tsx
+++ b/src/providers/EdgeProvider.tsx
@@ -1,25 +1,29 @@
'use client'
-import { useAlertSwitch } from '@/store/alertSwitch'
import { useHeaderStore } from '@/store/header'
import { usePopupController } from '@/store/popupController'
import { useSideNavState } from '@/store/sideNavState'
import { usePathname } from 'next/navigation'
import { useEffect } from 'react'
+import { useSessionStore } from '@/store/session'
-declare global {
- interface Window {
- alert2: (msg: string, alert2BtnYes?: () => void, alert2BtnNo?: () => void) => void
- }
+interface EdgeProviderProps {
+ children: React.ReactNode
+ sessionData: string
}
-export default function EdgeProvider({ children }: React.PropsWithChildren) {
+export default function EdgeProvider({ children, sessionData }: EdgeProviderProps) {
const pathname = usePathname()
const { setBackBtn } = useHeaderStore()
const { reset } = useSideNavState()
const { setAlertMsg, setAlertBtn, setAlert, setAlert2, setAlert2BtnYes, setAlert2BtnNo } = usePopupController()
- const { alertKind } = useAlertSwitch()
+ const { session, setSession } = useSessionStore()
+ /**
+ * alert 함수 - window.alert 함수 대체
+ * @param msg
+ * @param alertBtn
+ */
const alertFunc = (msg: string, alertBtn: Function) => {
console.log('🚀 ~ alertFunc ~ msg:', msg)
setAlertMsg(msg)
@@ -27,7 +31,7 @@ export default function EdgeProvider({ children }: React.PropsWithChildren) {
setAlert(true)
}
/**
- * alert2 함수
+ * alert2 함수 - window.confirm 함수 대체
* @param msg alert 메시지
* @param alertBtn2Yes alert 확인 버튼 클릭시 실행되는 함수
* @param alertBtn2No alert 취소 버튼 클릭시 실행되는 함수
@@ -42,16 +46,28 @@ export default function EdgeProvider({ children }: React.PropsWithChildren) {
//alert 함수 변경해서 바인딩
useEffect(() => {
- if (alertKind === 'single') {
- window.alert = function (msg, alertBtn = () => setAlert(false)) {
- alertFunc(msg, alertBtn)
- }
- } else if (alertKind === 'multi') {
- window.alert = function (msg, alert2BtnYes = () => setAlert2(false), alert2BtnNo = () => setAlert2(false)) {
- alertFunc2(msg, alert2BtnYes, alert2BtnNo)
- }
+ window.alert = function (msg, alertBtn = () => setAlert(false)) {
+ alertFunc(msg, alertBtn)
}
- }, [alertKind])
+ window.confirm = function (msg = '', alert2BtnYes = () => setAlert2(false), alert2BtnNo = () => setAlert2(false)) {
+ alertFunc2(
+ msg,
+ () => {
+ alert2BtnYes()
+ return true
+ },
+ () => {
+ alert2BtnNo()
+ return false
+ },
+ )
+ return false
+ }
+ setSession({
+ ...session,
+ ...JSON.parse(sessionData),
+ })
+ }, [])
/**
* 헤더 뒤로가기 버튼 컨트롤
diff --git a/src/store/alertSwitch.ts b/src/store/alertSwitch.ts
deleted file mode 100644
index 54c9d00..0000000
--- a/src/store/alertSwitch.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { create } from 'zustand'
-
-type AlertSwitchState = {
- alertKind: string
- setAlertKind: (value: string) => void
- reset: () => void
-}
-
-type InitialState = {
- alertKind: string
-}
-
-const initialState: InitialState = {
- alertKind: 'single',
-}
-
-export const useAlertSwitch = create
((set) => ({
- ...initialState,
- setAlertKind: (value: string) => set((state) => ({ ...state, alertKind: value })),
- reset: () => set(initialState),
-}))