Skip to content

Commit

Permalink
관심강좌, 알림 아이콘 이동 (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
eastshine2741 authored Jan 3, 2024
1 parent e4aec30 commit bdca815
Show file tree
Hide file tree
Showing 14 changed files with 537 additions and 471 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ package com.wafflestudio.snutt2.components.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Surface
import androidx.compose.material.Divider
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -53,75 +47,33 @@ fun TopBar(
navigationIcon: @Composable RowScope.() -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
Surface(
shape = RectangleShape,
color = SNUTTColors.White900,
elevation = 1.dp,
Column(
modifier = modifier
.padding(bottom = 2.dp)
.fillMaxWidth()
.height(56.dp)
.drawWithContent {
val paddingPx = 2.dp.toPx()
clipRect(
left = 0f,
top = 0f,
right = size.width,
bottom = size.height + paddingPx,
) {
this@drawWithContent.drawContent()
}
},
.height(56.dp),
) {
Row(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.background(SNUTTColors.White900)
.weight(1f)
.padding(horizontal = 12.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
modifier = Modifier.width(54.dp),
horizontalArrangement = Arrangement.Center,
) { navigationIcon() }

navigationIcon()
Row(
modifier = Modifier
.weight(1f)
.padding(end = 8.dp),
.weight(1f),
verticalAlignment = Alignment.CenterVertically,
) { title() }

Row(
modifier = Modifier.wrapContentWidth().padding(end = 12.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) { actions() }
}
}
}

@Composable
fun SearchTopBar(
modifier: Modifier = Modifier,
content: @Composable RowScope.() -> Unit,
) {
Row(
modifier = modifier
.background(SNUTTColors.White900)
.shadow(elevation = 1.dp, clip = false)
.height(56.dp)
.fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
modifier = Modifier
.background(SNUTTColors.Gray100, shape = RoundedCornerShape(6.dp))
.fillMaxSize()
.padding(horizontal = 8.dp, vertical = 3.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
content()
) {
title()
}
actions()
}
Divider(
thickness = 0.5.dp,
color = SNUTTColors.TableGrid,
)
}
}

Expand Down
10 changes: 0 additions & 10 deletions app/src/main/java/com/wafflestudio/snutt2/views/RootActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.wafflestudio.snutt2.lib.network.ApiOnError
import com.wafflestudio.snutt2.lib.network.ApiOnProgress
import com.wafflestudio.snutt2.react_native.ReactNativeBundleManager
import com.wafflestudio.snutt2.ui.SNUTTTheme
import com.wafflestudio.snutt2.views.logged_in.bookmark.BookmarkPage
import com.wafflestudio.snutt2.views.logged_in.home.HomeItem
import com.wafflestudio.snutt2.views.logged_in.home.HomePage
import com.wafflestudio.snutt2.views.logged_in.home.HomePageController
Expand Down Expand Up @@ -229,15 +228,6 @@ class RootActivity : AppCompatActivity() {
LectureColorSelectorPage()
}

composable2(NavigationDestination.Bookmark) {
val parentEntry = remember(it) {
navController.getBackStackEntry(NavigationDestination.Home)
}
val searchViewModel = hiltViewModel<SearchViewModel>(parentEntry)
val vacancyViewModel = hiltViewModel<VacancyViewModel>(parentEntry)
BookmarkPage(searchViewModel, vacancyViewModel)
}

settingcomposable2(navController)
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ fun HomePage() {
contentAlignment = Alignment.BottomCenter,
) {
when (pageController.homePageState.value) {
HomeItem.Timetable -> TimetablePage()
HomeItem.Timetable -> TimetablePage(uncheckedNotification)
HomeItem.Search -> SearchPage(searchResultPagingItems)
is HomeItem.Review -> {
CompositionLocalProvider(LocalReviewWebView provides reviewPageWebViewContainer) {
ReviewPage()
}
}
HomeItem.Friends -> FriendsPage()
HomeItem.Settings -> SettingsPage(uncheckedNotification)
HomeItem.Settings -> SettingsPage()
}

Box(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.wafflestudio.snutt2.views.logged_in.home.search

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Divider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.wafflestudio.snutt2.lib.android.webview.WebViewContainer
import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.views.logged_in.home.TableListViewModel
import com.wafflestudio.snutt2.views.logged_in.home.settings.UserViewModel
import com.wafflestudio.snutt2.views.logged_in.home.timetable.TimetableViewModel
import com.wafflestudio.snutt2.views.logged_in.lecture_detail.LectureDetailViewModel
import com.wafflestudio.snutt2.views.logged_in.vacancy_noti.VacancyViewModel

@Composable
fun BookmarkList(
searchViewModel: SearchViewModel,
timetableViewModel: TimetableViewModel,
tableListViewModel: TableListViewModel,
lectureDetailViewModel: LectureDetailViewModel,
userViewModel: UserViewModel,
vacancyViewModel: VacancyViewModel,
reviewWebViewContainer: WebViewContainer,
) {
val bookmarks by searchViewModel.bookmarkList.collectAsState()
if (bookmarks.isEmpty()) {
BookmarkPlaceHolder()
} else {
LazyColumn(
state = rememberLazyListState(),
modifier = Modifier
.fillMaxSize(),
) {
items(bookmarks) {
LectureListItem(
lectureDataWithState = it,
searchViewModel = searchViewModel,
reviewWebViewContainer = reviewWebViewContainer,
isBookmarkPage = true,
timetableViewModel = timetableViewModel,
tableListViewModel = tableListViewModel,
lectureDetailViewModel = lectureDetailViewModel,
userViewModel = userViewModel,
vacancyViewModel = vacancyViewModel,
)
}
item { Divider(color = SNUTTColors.White400) }
}
}
}
Loading

0 comments on commit bdca815

Please sign in to comment.