Skip to content
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

Merged
merged 10 commits into from
Dec 8, 2021
Merged

Conversation

limkhl
Copy link
Member

@limkhl limkhl commented Dec 7, 2021

πŸ’ μ„€λͺ…

μœ μ €κ°€ μƒˆ 농ꡬμž₯ 정보λ₯Ό μΆ”κ°€ν•  수 μžˆλŠ” νŽ˜μ΄μ§€λ₯Ό κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€.

πŸ”— μ—°κ²°λœ 이슈

closes #8

🚨 PR 포인트

  • πŸ™ λͺ¨λ‹¬μ°½μ˜ λ§΅μ—μ„œ νŠΉμ • μœ„μΉ˜λ₯Ό ν΄λ¦­ν•˜κ³  μ €μž₯ λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μƒˆ 농ꡬμž₯ 정보 μž‘μ„± νŽ˜μ΄μ§€μ—μ„œλ„ 지도λ₯Ό 톡해 μ €μž₯ν•œ μœ„μΉ˜λ₯Ό 보여쀄 수 μžˆλ„λ‘ κ΅¬ν˜„ν–ˆλŠ”λ°μš”. 이 νŽ˜μ΄μ§€μ—μ„œ KakaoMap μ»΄ν¬λ„ŒνŠΈλ₯Ό 2개 μ‚¬μš©ν•˜κ³  μžˆμ–΄μ„œ KakaoMap μ»΄ν¬λ„ŒνŠΈ 간에 센터값을 μ œλŒ€λ‘œ μ „λ‹¬ν•˜μ§€ λͺ»ν•˜λŠ” λ¬Έμ œκ°€ μžˆμ—ˆμŠ΅λ‹ˆλ‹€. μ•„κΉŒ ν•œλ‚˜λž‘ 같이 뭐가 λ¬Έμ œμΈμ§€ μ°Ύμ•˜λŠ”λ° μ œκ°€ 집에 μ™€μ„œ μˆ˜μ •ν•˜λ €κ³  λ³΄λ‹ˆ μˆ˜μ •μ΄ μ•ˆ λ˜λ”λΌκ³ μš” 😭 μš°μ„  JSX μ½”λ“œ λΆ€λΆ„μ—μ„œ formκ³Ό λͺ¨λ‹¬ Sheet μˆœμ„œλ₯Ό λ°”κΏ”λ†“μ•„μ„œ κΈ°λŠ₯은 κ΅¬ν˜„λ˜λ„λ‘ ν•΄λ’€λŠ”λ°μš”. μ‘°μ†νžˆ 해결해보도둝 ν• κ²Œμš” πŸ™
  • μœ„μΉ˜ μ •λ³΄λŠ” λͺ¨λ‹¬μ°½μ—μ„œ 받을 수 μžˆλ„λ‘ κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€. (λ§΅μ—μ„œμ˜ λ“œλž˜κ·Έ μ΄λ²€νŠΈμ™€ 겹치기 λ•Œλ¬Έμ— λͺ¨λ‹¬μ€ λ“œλž˜κ·Έ λΆˆκ°€λŠ₯ν•˜κ²Œ μ„€μ •ν–ˆμŠ΅λ‹ˆλ‹€)
  • μž„μ‹œλ‘œ ν™ˆμ— μƒˆ 농ꡬμž₯ μΆ”κ°€ νŽ˜μ΄μ§€λ‘œ μ§„μž…ν•  수 μžˆλŠ” 링크λ₯Ό λ„£μ–΄λ‘μ—ˆμŠ΅λ‹ˆλ‹€.
  • useForm μ»€μŠ€ν…€ 훅을 μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.

πŸ“Έ 슀크린 μƒ·

image
image
image
image

@limkhl limkhl self-assigned this Dec 7, 2021
@netlify
Copy link

netlify bot commented Dec 7, 2021

❌ Deploy Preview for slams failed.

πŸ”¨ Explore the source changes: edec9f0

πŸ” Inspect the deploy log: https://app.netlify.com/sites/slams/deploys/61afac26aca90700075bc8da

Comment on lines +50 to +61
useEffect(() => {
if (map) {
map.setDraggable(draggable);
}
}, [map, draggable]);

useEffect(() => {
if (map) {
map.setZoomable(zoomable);
}
}, [map, zoomable]);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ˜΅μ…”λ„ 체이닝을 μ•Œμ•„λ³΄λ©΄ 쒋을 κ±° κ°™μ•„μš”

Comment on lines +42 to +116
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]);
Copy link
Collaborator

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>
Copy link
Collaborator

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νƒœκ·Έλ₯Ό λ„£μ–΄λ³΄μ‹œκ³  ν…ŒμŠ€νŠΈ ν•΄λ³΄μ„Έμš”

@manudeli
Copy link
Collaborator

manudeli commented Dec 8, 2021

κΈ°λŠ₯ λ¬Έμ œκ°€ μ—†λŠ” κ²ƒμœΌλ‘œ 보이기 λ•Œλ¬Έμ— λ¨Έμ§€ν• κ²Œμš”
ν•˜μ§€λ§Œ κ°œμ„ μ΄ ν•„μš”ν•΄λ³΄μ—¬μš” μ°¨μ°¨ κ³ μ³κ°€μš”~! μ’‹μŠ΅λ‹ˆλ‹€

@manudeli manudeli merged commit bd5c7e6 into develop Dec 8, 2021
@limkhl limkhl deleted the feat/createCourt/markup branch December 8, 2021 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ feat: μƒˆ 농ꡬμž₯ μΆ”κ°€ νŽ˜μ΄μ§€ κ΅¬ν˜„
2 participants