Skip to content

Commit

Permalink
Merge pull request #99 from eshc123/feature/mod-club-screen
Browse files Browse the repository at this point in the history
[FEATURE] Modified Club Detail Screen (2)
  • Loading branch information
eshc123 authored Jun 26, 2024
2 parents 932066b + a858212 commit de38b14
Showing 1 changed file with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fun ClubDetailRoute(
clubDetailViewModel: ClubDetailViewModel = hiltViewModel()
) {
val context = LocalContext.current
val intentActionView = Intent(Intent.ACTION_VIEW)
val clubDetailUiState by clubDetailViewModel.clubDetail.collectAsStateWithLifecycle()

LaunchedEffect(clubDetailUiState){
Expand All @@ -47,10 +48,25 @@ fun ClubDetailRoute(

ClubDetailScreen(
onBackIconClick = onBackIconClick,
onHomePageUrlClick = { homePageUrl ->
Intent(Intent.ACTION_VIEW, Uri.parse(homePageUrl)).run {
context.startActivity(this)
}
onHomePageClick = { homepageUrl ->
intentActionView
.apply { data = Uri.parse(homepageUrl) }
.run { context.startActivity(this) }
},
onInstagramClick = { instagramUrl ->
intentActionView
.apply { data = Uri.parse(instagramUrl) }
.run { context.startActivity(this) }
},
onFaceBookClick = { facebookUrl ->
intentActionView
.apply { data = Uri.parse(facebookUrl) }
.run { context.startActivity(this) }
},
onXClick = { xUrl ->
intentActionView
.apply { data = Uri.parse(xUrl) }
.run { context.startActivity(this) }
},
clubDetailUiState = clubDetailUiState
)
Expand All @@ -59,7 +75,10 @@ fun ClubDetailRoute(
@Composable
fun ClubDetailScreen(
onBackIconClick: () -> Unit,
onHomePageUrlClick: (String) -> Unit,
onHomePageClick: (String) -> Unit,
onInstagramClick: (String) -> Unit,
onFaceBookClick: (String) -> Unit,
onXClick: (String) -> Unit,
clubDetailUiState: ClubDetailUiState
) {
when(clubDetailUiState){
Expand Down Expand Up @@ -105,23 +124,23 @@ fun ClubDetailScreen(
)
ClubDetailHomePageRow(
homepageUrl = clubDetailUiState.teamDetail.team.officialWebUrl,
onHomePageClick = onHomePageUrlClick
onHomePageClick = onHomePageClick
)
}

if (clubDetailUiState.teamDetail.socialMediaIsNotEmpty()) {
Text(
text = "Social Media",
modifier = Modifier.padding(top = 30.dp),
modifier = Modifier.padding(top = 30.dp, bottom = 16.dp),
style = GnrTypography.subtitleSemiBold
)
ClubDetailSocialMediaRow(
isInstagramNotEmpty = clubDetailUiState.teamDetail.instagramIsNotEmpty(),
isFaceBookNotEmpty = clubDetailUiState.teamDetail.faceBookIsNotEmpty(),
isXNotEmpty = clubDetailUiState.teamDetail.xIsNotEmpty(),
onInstagramLogoClick = { /* Nothing Implemented */ },
onFaceBookLogoClick = { /* Nothing Implemented */ },
onXLogoClick = { /* Nothing Implemented */ }
onInstagramLogoClick = { onInstagramClick(clubDetailUiState.teamDetail.team.snsInstagram) },
onFaceBookLogoClick = { onFaceBookClick(clubDetailUiState.teamDetail.team.snsFaceBook) },
onXLogoClick = { onXClick(clubDetailUiState.teamDetail.team.snsX) }
)
}

Expand Down

0 comments on commit de38b14

Please sign in to comment.