-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/courtCreate/addNewCourtInfo #24
Conversation
β Deploy Preview for slams failed. π¨ Explore the source changes: edec9f0 π Inspect the deploy log: https://app.netlify.com/sites/slams/deploys/61afac26aca90700075bc8da |
useEffect(() => { | ||
if (map) { | ||
map.setDraggable(draggable); | ||
} | ||
}, [map, draggable]); | ||
|
||
useEffect(() => { | ||
if (map) { | ||
map.setZoomable(zoomable); | ||
} | ||
}, [map, zoomable]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΅μ λ 체μ΄λμ μμ보면 μ’μ κ±° κ°μμ
const { useMountPage } = useNavigationContext(); | ||
useMountPage((page) => page.COURT_CREATE); | ||
|
||
const [isOpen, setOpen] = useState(false); | ||
const [isAddressLoading, setIsAddressLoading] = useState<boolean>(false); | ||
const [level, setLevel] = useState<number>(3); | ||
const [center, setCenter] = useState<Coord>(); | ||
const [position, setPosition] = useState<Coord>(); | ||
const [savedPosition, setSavedPosition] = useState<Coord>(); | ||
const [address, setAddress] = useState<string>(); | ||
|
||
const searchAddrFromCoords = ([latitude, longitude]: Coord) => { | ||
const geocoder = new kakao.maps.services.Geocoder(); | ||
|
||
setIsAddressLoading(true); | ||
const callback = (result: any, status: any) => { | ||
if (status === kakao.maps.services.Status.OK) { | ||
// λλ‘λͺ μ£Όμ | ||
if (result[0].road_address) { | ||
setAddress(result[0].road_address.address_name); | ||
} | ||
// λ²μ μ£Όμ | ||
else if (result[0].address.address_name) { | ||
setAddress(result[0].address.address_name); | ||
} | ||
// μ£Όμκ° μλ κ²½μ° | ||
else { | ||
setAddress("μ£Όμκ° μ‘΄μ¬νμ§ μμ΅λλ€."); | ||
} | ||
} | ||
|
||
setIsAddressLoading(false); | ||
}; | ||
|
||
(geocoder as Geocoder).coord2Address(longitude, latitude, callback); | ||
}; | ||
|
||
const onClick = ( | ||
_: kakao.maps.Map, | ||
mouseEvent: kakao.maps.event.MouseEvent | ||
) => { | ||
const { latLng } = mouseEvent; | ||
|
||
if (latLng) { | ||
setPosition([latLng.getLat(), latLng.getLng()]); | ||
searchAddrFromCoords([latLng.getLat(), latLng.getLng()]); | ||
} | ||
}; | ||
|
||
const handleInitCenter = useCallback(() => { | ||
getCurrentLocation(([latitude, longitude]) => { | ||
setCenter([latitude, longitude]); | ||
}); | ||
}, []); | ||
|
||
const handleZoomIn = useCallback(() => { | ||
setLevel((level) => level - 1); | ||
}, []); | ||
|
||
const handleZoomOut = useCallback(() => { | ||
setLevel((level) => level + 1); | ||
}, []); | ||
|
||
const savedLocation = () => { | ||
setOpen(false); | ||
setSavedPosition(position); | ||
setCenter(position); | ||
}; | ||
|
||
useEffect(() => { | ||
if (center) { | ||
return; | ||
} | ||
handleInitCenter(); | ||
}, [handleInitCenter]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ν μΌλ‘ λ°κΉ₯μΌλ‘ 빼보λ κ²μ κ³ λ―Όν΄λ³΄λ©΄ μ΄λ¨κΉμ?
@@ -15,6 +16,7 @@ const Home: NextPage = () => { | |||
<link rel="icon" href="/favicon.ico" /> | |||
</Head> | |||
<h1>ν νμ΄μ§</h1> | |||
<Link href="/court/create">μ λꡬμ₯ μΆκ°</Link> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linkνκ·Έλ Nextjs 곡μλ¬Έμμμ νμΈν΄λ³΄μλ©΄ μ’μ κ±° κ°μμ
μ μκ°μλ μμ aνκ·Έλ₯Ό λ£μ΄μ£Όλ κ²μ΄ λ μ맨ν±νλ€κ³ μκ°μ΄ λ€μ΄μ
CSRκ³Ό SSRμ μ₯μ μ λλ€ κ°μ Έκ°κΈ° μν΄μμ
Linkλ κΈ°λ³Έμ μΌλ‘ CSRμ μν μ»΄ν¬λνΈλ‘ μκ³ μμ΄μ aνκ·Έλ₯Ό μμ λ£μ΄μ Linkμ hrefλ₯Ό κ²μμμ§μ΄ Linkμ νμ νκ·ΈμΈ aνκ·Έμ λ£μ΄μ€μ SSRμ μ₯μ μΈ SEOλ₯Ό κ°μ Έ κ° μ μκ±°λ μ
κΆκΈνμλ€λ©΄ Linkμλμ μ무 μμ±λ μλ aνκ·Έλ₯Ό λ£μ΄λ³΄μκ³ ν μ€νΈ ν΄λ³΄μΈμ
κΈ°λ₯ λ¬Έμ κ° μλ κ²μΌλ‘ 보μ΄κΈ° λλ¬Έμ λ¨Έμ§ν κ²μ |
π μ€λͺ
μ μ κ° μ λꡬμ₯ μ 보λ₯Ό μΆκ°ν μ μλ νμ΄μ§λ₯Ό ꡬννμ΅λλ€.
π μ°κ²°λ μ΄μ
closes #8
π¨ PR ν¬μΈνΈ
πΈ μ€ν¬λ¦° μ·