@@ -84,9 +84,19 @@ const PlanetManagePage = () => {
8484 } ;
8585
8686 /* BottomSheet 관련 함수 */
87+ useEffect ( ( ) => {
88+ if ( isBottomUp ) {
89+ setShowBottom ( true ) ;
90+ } else {
91+ setTimeout ( ( ) => {
92+ setShowBottom ( false ) ;
93+ } , 490 ) ;
94+ }
95+ } , [ isBottomUp ] ) ;
96+
8797 const handleShowBottom = ( id : string ) => {
8898 setSelectedId ( id ) ;
89- setShowBottom ( true ) ;
99+ setIsBottomUp ( true ) ;
90100 } ;
91101
92102 const handleBottomUpChange = ( state : boolean ) => {
@@ -95,23 +105,31 @@ const PlanetManagePage = () => {
95105
96106 /* 홈(메인) 행성 고정 */
97107 const handleFixMainPlanet = ( ) => {
108+ const selectedPlanet = planets ?. filter ( ( planet ) =>
109+ selectedId . includes ( planet . spaceId )
110+ ) ;
111+
98112 /* TODO: 선택 행성 (selectedId) 메인 행성으로 변경 API 연동 */
99- setShowBottom ( false ) ;
113+
114+ setIsBottomUp ( false ) ;
115+ showToast ( `${ selectedPlanet [ 0 ] ?. spaceName } 행성을 홈으로 고정했어요` , {
116+ icon : false ,
117+ close : false ,
118+ bottom : '65px'
119+ } ) ;
100120 } ;
101121
102122 /* 행성 삭제 관련 함수 */
103123 const handleDeletePlanet = ( ) => {
104- setShowBottom ( false ) ;
124+ setIsBottomUp ( false ) ;
105125 setConfirmDeleteModal ( true ) ;
106126 } ;
107127
108128 const handleConfirmDeletePlanet = async ( ) => {
109129 if ( selectedId ) {
110- const smallestIndexPlanet = planets
111- ?. filter ( ( planet ) => selectedId . includes ( planet . spaceId ) )
112- ?. reduce ( ( prev , curr ) =>
113- planets . indexOf ( prev ) < planets . indexOf ( curr ) ? prev : curr
114- ) ;
130+ const selectedPlanet = planets ?. filter ( ( planet ) =>
131+ selectedId . includes ( planet . spaceId )
132+ ) ;
115133
116134 /* 행성 삭제하기 */
117135 try {
@@ -124,15 +142,15 @@ const PlanetManagePage = () => {
124142 ) || [ ]
125143 ) ;
126144 await fetchSpaceList ( ) ;
127- setShowBottom ( false ) ;
145+ setIsBottomUp ( false ) ;
128146 } catch ( error ) {
129147 console . error ( '행성 삭제 실패:' , error ) ;
130148 }
131149
132150 setConfirmDeleteModal ( false ) ;
133151 setDragMode ( false ) ;
134152 showToast (
135- `${ smallestIndexPlanet ?. spaceName } 행성과 등록된 편지들이 함께 삭제 되었어요 ` ,
153+ `${ selectedPlanet [ 0 ] ?. spaceName } 행성과 등록된 편지들이 함께 삭제되었어요 ` ,
136154 {
137155 icon : false ,
138156 close : false ,
@@ -203,7 +221,6 @@ const PlanetManagePage = () => {
203221 < PlanetBoxList
204222 ref = { provided . innerRef }
205223 { ...provided . droppableProps }
206- $marginBottom = { dragMode }
207224 >
208225 { planets ?. map ( ( planet , index ) => (
209226 < Draggable
@@ -285,7 +302,7 @@ const Layout = styled.div`
285302 display: flex;
286303 flex-direction: column;
287304 overflow-x: hidden;
288- /* overflow-y: hidden; */
305+ overflow-y: hidden;
289306 gap: 7px;
290307 padding: 20px;
291308 background-color: ${ theme . colors . bg } ;
@@ -334,17 +351,12 @@ const Divider = styled.div`
334351 margin-bottom: 22px;
335352` ;
336353
337- const PlanetBoxList = styled . div < { $marginBottom : boolean } > `
354+ const PlanetBoxList = styled . div `
338355 height: 100%;
339356 display: flex;
340357 flex-direction: column;
341358 overflow-y: scroll;
342-
343- ${ ( { $marginBottom } ) =>
344- $marginBottom &&
345- css `
346- margin-bottom: 100px;
347- ` }
359+ padding-bottom: 50px;
348360
349361 ::-webkit-scrollbar {
350362 display: none;
@@ -354,11 +366,13 @@ const PlanetBoxList = styled.div<{ $marginBottom: boolean }>`
354366` ;
355367
356368const BottomSheetContent = styled . div `
369+ height: 100%;
357370 display: flex;
358371 flex-direction: column;
359- justify-content: center ;
372+ justify-content: flex-end ;
360373 align-items: flex-start;
361374 gap: 24px;
375+ margin-top: 20px;
362376` ;
363377
364378const BottomSheetButton = styled . button `
0 commit comments