Skip to content

Commit

Permalink
fix: skeleton 뷰 살짝 수정 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhz committed Aug 22, 2024
1 parent 2310430 commit ff4d267
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import com.easyhz.noffice.core.design_system.R
import com.easyhz.noffice.core.design_system.component.banner.Banner
import com.easyhz.noffice.core.design_system.component.banner.SkeletonBanner
import com.easyhz.noffice.core.design_system.component.card.ItemCard
import com.easyhz.noffice.core.design_system.component.card.SkeletonItemCard
import com.easyhz.noffice.core.design_system.component.skeleton.SkeletonProvider
import com.easyhz.noffice.core.design_system.extension.screenHorizonPadding
import com.easyhz.noffice.core.design_system.util.card.CardDetailInfo
Expand Down Expand Up @@ -48,19 +50,13 @@ fun NoticeView(
Banner(userName = name, date = dayOfWeek)
}
}
if(isLoading) {
items(2) {
SkeletonOrganizationSection()
}
} else {
items(organizationList.itemCount) { index ->
organizationList[index]?.let {
OrganizationSection(
organization = it,
isRefreshing = isRefreshing,
navigateToAnnouncementDetail = {id, title -> navigateToAnnouncementDetail(it.id, id, title) }
)
}
items(organizationList.itemCount) { index ->
organizationList[index]?.let {
OrganizationSection(
organization = it,
isRefreshing = isRefreshing,
navigateToAnnouncementDetail = {id, title -> navigateToAnnouncementDetail(it.id, id, title) }
)
}
}
}
Expand All @@ -75,6 +71,7 @@ private fun OrganizationSection(
navigateToAnnouncementDetail: (Int, String) -> Unit,
) {
val announcementList = noticeViewModel.getAnnouncementStateByOrganization(organizationId = organization.id).collectAsLazyPagingItems()
val isRefreshingAnnouncement = announcementList.loadState.refresh == LoadState.Loading
LaunchedEffect(organization.id) {
noticeViewModel.fetchAnnouncementByOrganization(organization.id)
}
Expand Down Expand Up @@ -124,8 +121,12 @@ private fun OrganizationSection(
}
}
}
if (announcementList.itemCount == 0) {
if (announcementList.itemCount == 0 && !isRefreshingAnnouncement) {
exceptionItem(CardExceptionType.NO_RESULT)
} else {
items(2) {
SkeletonItemCard()
}
}
}
JoinStatus.PENDING -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data class HomeState(
name = "",
dayOfWeek = "",
isJoinLoading = false,
isInitLoading = true
isInitLoading = true,
)
}
}

0 comments on commit ff4d267

Please sign in to comment.