File tree Expand file tree Collapse file tree
app/src/main/java/com/kuit/ourmenu Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
66@Serializable
77data class MapSearchHistoryResponse (
88 @SerialName(" menuId" )
9- val menuId : Int ,
9+ val menuId : Long ,
1010 @SerialName(" menuTitle" )
1111 val menuTitle : String ,
1212 @SerialName(" storeTitle" )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import com.kuit.ourmenu.ui.theme.ourMenuTypography
3333fun SearchHistoryList (
3434 modifier : Modifier = Modifier ,
3535 historyList : List <MapSearchHistoryResponse >? ,
36- onClick : () -> Unit = {},
36+ onClick : (Long ) -> Unit = {},
3737) {
3838 val lazyListState = rememberLazyListState()
3939
@@ -99,13 +99,13 @@ fun SearchHistoryList(
9999fun SearchHistoryItem (
100100 modifier : Modifier = Modifier ,
101101 historyData : MapSearchHistoryResponse ,
102- onClick : () -> Unit
102+ onClick : (Long ) -> Unit
103103) {
104104
105105 Column (
106106 modifier = modifier
107107 .fillMaxWidth()
108- .clickable(onClick = onClick)
108+ .clickable(onClick = { onClick(historyData.menuId) } )
109109 .padding(vertical = 20 .dp, horizontal = 28 .dp)
110110 ) {
111111 Text (
Original file line number Diff line number Diff line change @@ -181,8 +181,10 @@ fun SearchMenuScreen(
181181 } else {
182182 SearchHistoryList (
183183 historyList = searchHistory,
184- onClick = {
184+ onClick = { menuId ->
185185 // 크롤링 기록 아이템 클릭시 동작
186+ viewModel.getMapMenuDetail(menuId)
187+ Log .d(" SearchMenuScreen" , " 검색 기록 아이템 클릭: $menuId " )
186188 showSearchBackground = false
187189 showBottomSheet = true
188190 }
Original file line number Diff line number Diff line change @@ -313,11 +313,22 @@ class SearchMenuViewModel @Inject constructor(
313313 }
314314 }
315315
316- fun getMapMenuDetail (menuId : Long ){
316+ fun getMapMenuDetail (menuId : Long ) {
317317 viewModelScope.launch {
318318 val response = mapRepository.getMapMenuDetail(menuId)
319- response.onSuccess {
320- Log .d(" SearchMenuViewModel" , " 메뉴 상세 조회 성공: $it " )
319+ response.onSuccess { menuDetail ->
320+ Log .d(" SearchMenuViewModel" , " 메뉴 상세 조회 성공: $menuDetail " )
321+
322+ // myMenus에서 해당 menuId를 가진 메뉴의 위치 정보 찾기
323+ myMenus.value?.find { it.mapId == menuId }?.let { menu ->
324+ // 해당 위치로 카메라 이동
325+ moveCamera(menu.mapY, menu.mapX)
326+ // 해당 핀을 활성화 상태로 변경
327+ _activeMapId .value = menuId
328+ refreshMarkers()
329+ // 메뉴 상세 정보를 바텀시트에 표시하기 위해 설정
330+ getMapDetail(menuId)
331+ }
321332 }.onFailure {
322333 Log .d(" SearchMenuViewModel" , " 메뉴 상세 조회 실패: ${it.message} " )
323334 }
You can’t perform that action at this time.
0 commit comments