Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ fun EventDto.toDomain() = Event(
maxAttendees = maxAttendees,
remainingSeats = remainingSeats,
longitude = longitude,
latitude = latitude
latitude = latitude,
state = state.orEmpty()
)

fun CategoryDto.toDomain() = Category(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ data class EventDto(
@SerialName("pin_latitude")
val latitude: Double? = null,
@SerialName("pin_longitude")
val longitude: Double? = null
val longitude: Double? = null,
@SerialName("status")
val state: String?= null
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ data class Event(
val longitude: Double?,
val maxAttendees: Int?,
val remainingSeats: Int?,
val state: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil3.compose.AsyncImage
import com.uni.eventbridge.presentation.common.component.modifier.noRippleClickable
import com.uni.eventbridge.presentation.common.component.theme.Primary
import com.uni.eventbridge.presentation.common.component.theme.Secondary
import com.uni.eventbridge.presentation.common.component.theme.SlateGray
import com.uni.eventbridge.presentation.common.component.theme.White
Expand All @@ -40,6 +42,7 @@ fun EventCard(
title: String,
date: String,
location: String,
state: String?,
imageUrl: String? = null,
imageRes: DrawableResource = Res.drawable.im_banner_image,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -81,6 +84,17 @@ fun EventCard(
.padding(start = 16.dp, top = 13.dp)
.align(Alignment.Top)
) {
state?.let {
Text(
text = state,
color = White,
modifier = modifier
.noRippleClickable { onClick() }
.background(color = Primary, shape = RoundedCornerShape(100))
.padding(vertical = 4.dp, horizontal = 12.dp)
)
}

Text(
text = title,
fontSize = 18.sp,
Expand Down Expand Up @@ -129,5 +143,6 @@ private fun EventCardPreview() {
title = "AI & Ethics Workshop",
date = "Oct 26, 2023 • 2:30 PM",
location = "sammaarra",
state = ""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fun LocationSection(
) {
var showMap by remember { mutableStateOf(false) }
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
SectionTitle("Location")
SectionTitle("Venue Name")

EventTextField(
value = location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ fun EventDetailsContent(
category = uiState.category,
title = uiState.title.orEmpty(),
organizer = uiState.organizer.orEmpty(),
organizerAvatarUrl = uiState.organizerAvatarUrl.orEmpty(),
)

HorizontalDivider(color = MaterialTheme.colorScheme.outline.copy(alpha = 0.15f))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
package com.uni.eventbridge.presentation.eventDetails.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.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.layout.ContentScale
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage
import com.uni.eventbridge.presentation.common.component.theme.Primary
import com.uni.eventbridge.presentation.common.component.theme.Secondary
import com.uni.eventbridge.presentation.eventDetails.EventDetailsUiState
import eventbridge.composeapp.generated.resources.Res
import eventbridge.composeapp.generated.resources.im_banner_image
import org.jetbrains.compose.resources.painterResource

@Composable
fun EventHeader(
category: EventDetailsUiState.CategoryUiState,
title: String,
organizer: String,
organizerAvatarUrl: String,
) {
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
if (category.name.isNotBlank()) {
Expand Down Expand Up @@ -62,29 +51,6 @@ fun EventHeader(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
Box(
modifier = Modifier
.size(26.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.secondaryContainer),
contentAlignment = Alignment.Center,
) {
if (organizerAvatarUrl.isNotBlank()) {
AsyncImage(
model = organizerAvatarUrl,
contentDescription = "Organizer avatar",
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize(),
)
} else {
Image(
painter = painterResource(Res.drawable.im_banner_image),
contentDescription = "Organizer avatar placeholder",
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize(),
)
}
}
Text(
text = "Organized by ",
style = MaterialTheme.typography.bodySmall,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private fun EventsContent(
location = event.location,
imageUrl = event.imageUrl.takeIf { it.isNotBlank() },
onClick = { onEventClicked(event.id) },
state = event.state
)
}
}
Expand All @@ -115,6 +116,7 @@ private fun EventsContentPreview() {
date = "Oct 24, 2023 • 10:00 AM",
location = "Grand University Hall",
imageUrl = "",
state = "Upcoming"

),
EventsUiState.EventUiState(
Expand All @@ -123,13 +125,15 @@ private fun EventsContentPreview() {
date = "Oct 26, 2023 • 2:30 PM",
location = "Innovation Tech Hub",
imageUrl = "",
state = "Upcoming"
),
EventsUiState.EventUiState(
id = 3,
title = "Winter Music Fest",
date = "Dec 12, 2023 • 6:00 PM",
location = "University Stadium",
imageUrl = "",
state = ""
),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ data class EventsUiState(
val date: String,
val location: String,
val imageUrl: String,
val state: String? = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ fun Event.toUiState() = EventsUiState.EventUiState(
date = "$date • $startTime",
location = location,
imageUrl = bannerUrl,
state = state
)
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private fun HomeContent(
selectedCategory = uiState.selectedCategoryId,
onCategorySelected = { onCategorySelected(it?.id) },
listState = categoryScrollState,
modifier = Modifier.padding(top = 16.dp),
modifier = Modifier.padding(top = 14.dp),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
Expand All @@ -34,7 +30,6 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -45,10 +40,11 @@ import com.uni.eventbridge.presentation.common.component.EventBridgeScaffold
import com.uni.eventbridge.presentation.common.component.theme.Primary
import com.uni.eventbridge.presentation.common.component.theme.Secondary
import com.uni.eventbridge.presentation.common.component.theme.White
import com.uni.eventbridge.presentation.profile.component.SignOutDialog
import com.uni.eventbridge.presentation.profile.component.TermOfService
import eventbridge.composeapp.generated.resources.Res
import eventbridge.composeapp.generated.resources.ic_arrow_right
import eventbridge.composeapp.generated.resources.ic_doc
import eventbridge.composeapp.generated.resources.ic_explore
import eventbridge.composeapp.generated.resources.ic_message
import eventbridge.composeapp.generated.resources.ic_out
import org.jetbrains.compose.resources.painterResource
Expand All @@ -59,7 +55,6 @@ fun ProfileScreen(
viewModel: ProfileViewModel = koinViewModel(),
onNavigateToSignIn: () -> Unit,
onNavigateToContactUs: () -> Unit = {},
onNavigateToTermsOfService: () -> Unit = {},
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()

Expand All @@ -68,7 +63,6 @@ fun ProfileScreen(
when (effect) {
is ProfileUIEffect.NavigateToSignIn -> onNavigateToSignIn()
is ProfileUIEffect.NavigateToContactUs -> onNavigateToContactUs()
is ProfileUIEffect.NavigateToTermsOfService -> onNavigateToTermsOfService()
}
}
}
Expand All @@ -77,6 +71,7 @@ fun ProfileScreen(
uiState = uiState,
onContactUsClicked = viewModel::onContactUsClicked,
onTermsOfServiceClicked = viewModel::onTermsOfServiceClicked,
onTermsOfServiceDismissed = viewModel::onTermOfServiceDismissed,
onSignOutClicked = viewModel::onSignOutClicked,
onSignOutConfirmed = viewModel::onSignOutConfirmed,
onSignOutDismissed = viewModel::onSignOutDismissed,
Expand All @@ -88,6 +83,7 @@ private fun ProfileContent(
uiState: ProfileUiState = ProfileUiState(),
onContactUsClicked: () -> Unit = {},
onTermsOfServiceClicked: () -> Unit = {},
onTermsOfServiceDismissed: () -> Unit = {},
onSignOutClicked: () -> Unit = {},
onSignOutConfirmed: () -> Unit = {},
onSignOutDismissed: () -> Unit = {},
Expand Down Expand Up @@ -156,6 +152,12 @@ private fun ProfileContent(

}

if (uiState.showTermOfServiceDialog) {
TermOfService(
onDismiss = onTermsOfServiceDismissed,
)
}

if (uiState.showSignOutDialog) {
SignOutDialog(
onConfirm = onSignOutConfirmed,
Expand Down Expand Up @@ -295,83 +297,6 @@ private fun ProfileSignOutRow(onSignOutClicked: () -> Unit) {
}
}

@Composable
private fun SignOutDialog(
onConfirm: () -> Unit,
onDismiss: () -> Unit,
) {
AlertDialog(
onDismissRequest = onDismiss,
containerColor = White,
shape = RoundedCornerShape(20.dp),
icon = {
Box(
modifier = Modifier
.size(56.dp)
.clip(CircleShape)
.background(Color(0xFFEEF2FF)),
contentAlignment = Alignment.Center,
) {
Icon(
painter = painterResource(Res.drawable.ic_explore),
contentDescription = null,
tint = Primary,
modifier = Modifier.size(28.dp),
)
}
},
title = {
Text(
text = "Sign Out?",
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
color = Color(0xFF1A1A2E),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
)
},
text = {
Text(
text = "Are you sure you want to sign out of your account?",
fontSize = 14.sp,
color = Color(0xFF9E9E9E),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
)
},
confirmButton = {
Button(
onClick = onConfirm,
modifier = Modifier
.fillMaxWidth()
.height(48.dp),
shape = RoundedCornerShape(12.dp),
colors = ButtonDefaults.buttonColors(containerColor = Primary),
) {
Text(
text = "Sign Out",
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold,
color = White,
)
}
},
dismissButton = {
TextButton(
onClick = onDismiss,
modifier = Modifier.fillMaxWidth(),
) {
Text(
text = "Cancel",
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
color = Color(0xFF1A1A2E),
)
}
},
)
}

@Preview
@Composable
private fun ProfilscreenPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package com.uni.eventbridge.presentation.profile
sealed interface ProfileUIEffect {
data object NavigateToSignIn : ProfileUIEffect
data object NavigateToContactUs : ProfileUIEffect
data object NavigateToTermsOfService : ProfileUIEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ data class ProfileUiState(
val attendedCount: Int = 0,
val organizedCount: Int = 0,
val showSignOutDialog: Boolean = false,
val showTermOfServiceDialog: Boolean = false,
)
Loading
Loading