@@ -8,16 +8,13 @@ import androidx.compose.foundation.layout.fillMaxWidth
88import androidx.compose.foundation.layout.height
99import androidx.compose.foundation.layout.padding
1010import androidx.compose.foundation.layout.width
11- import androidx.compose.foundation.lazy.LazyColumn
12- import androidx.compose.foundation.lazy.items
1311import androidx.compose.foundation.shape.RoundedCornerShape
1412import androidx.compose.material3.Scaffold
1513import androidx.compose.material3.Tab
1614import androidx.compose.material3.TabRow
1715import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
1816import androidx.compose.material3.Text
1917import androidx.compose.runtime.Composable
20- import androidx.compose.runtime.collectAsState
2118import androidx.compose.runtime.getValue
2219import androidx.compose.runtime.mutableStateOf
2320import androidx.compose.runtime.saveable.rememberSaveable
@@ -26,20 +23,15 @@ import androidx.compose.ui.Alignment
2623import androidx.compose.ui.Modifier
2724import androidx.compose.ui.draw.clip
2825import androidx.compose.ui.graphics.Color
29- import androidx.compose.ui.res.painterResource
3026import androidx.compose.ui.res.stringResource
3127import androidx.compose.ui.text.style.TextAlign
3228import androidx.compose.ui.tooling.preview.Preview
3329import androidx.compose.ui.unit.dp
34- import androidx.lifecycle.viewmodel.compose.viewModel
3530import com.texthip.thip.R
36- import com.texthip.thip.ui.common.cards.CardBookList
3731import com.texthip.thip.ui.common.topappbar.DefaultTopAppBar
38- import com.texthip.thip.ui.myPage.component.SavedFeedCard
39- import com.texthip.thip.ui.myPage.viewmodel.SavedBookViewModel
40- import com.texthip.thip.ui.myPage.viewmodel.SavedFeedViewModel
32+ import com.texthip.thip.ui.myPage.component.BookContent
33+ import com.texthip.thip.ui.myPage.component.FeedContent
4134import com.texthip.thip.ui.theme.Black
42- import com.texthip.thip.ui.theme.Grey02
4335import com.texthip.thip.ui.theme.ThipTheme.colors
4436import com.texthip.thip.ui.theme.ThipTheme.typography
4537import com.texthip.thip.ui.theme.White
@@ -112,43 +104,6 @@ fun SavedScreen() {
112104 }
113105}
114106
115- @Composable
116- fun FeedContent (viewModel : SavedFeedViewModel = viewModel()) {
117- val feedList by viewModel.feeds.collectAsState()
118-
119- LazyColumn {
120- items(feedList, key = { it.id }) { feed ->
121- val bookImagePainter = feed.imageUrl?.let { painterResource(it) }
122- val profileImagePainter = feed.userProfileImage?.let { painterResource(it) }
123-
124- SavedFeedCard (
125- feedItem = feed,
126- bookImage = bookImagePainter,
127- profileImage = profileImagePainter,
128- onBookmarkClick = { viewModel.toggleBookmark(feed.id) },
129- onLikeClick = { viewModel.toggleLike(feed.id) }
130- )
131- }
132- }
133- }
134-
135- @Composable
136- fun BookContent (viewModel : SavedBookViewModel = viewModel()) {
137- val books by viewModel.bookList.collectAsState()
138-
139- LazyColumn {
140- items(items = books, key = { it.id }) { book ->
141- CardBookList (
142- title = book.title,
143- author = book.author,
144- imageRes = null ,
145- publisher = book.publisher,
146- isBookmarked = book.isSaved,
147- onBookmarkClick = { viewModel.toggleBookmark(book.id) }
148- )
149- }
150- }
151- }
152107
153108@Preview
154109@Composable
0 commit comments