diff --git a/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/AboutUsContactForm.kt b/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/AboutUsContactForm.kt index 336daab..e588cdb 100644 --- a/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/AboutUsContactForm.kt +++ b/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/AboutUsContactForm.kt @@ -1,6 +1,7 @@ package com.mnnit.moticlubs.ui.components.aboutus -import android.widget.Toast +import android.content.Intent +import android.net.Uri import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.imePadding @@ -28,6 +29,7 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import com.mnnit.moticlubs.domain.util.getUserId import com.mnnit.moticlubs.domain.util.getValue import com.mnnit.moticlubs.domain.util.isTrimmedNotEmpty import com.mnnit.moticlubs.domain.util.publishedStateOf @@ -39,7 +41,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { val context = LocalContext.current val keyboardController = LocalSoftwareKeyboardController.current - var name by remember { publishedStateOf("") } + var subject by remember { publishedStateOf("") } var postMsg by remember { publishedStateOf("") } Surface( @@ -58,10 +60,10 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { modifier = Modifier .fillMaxWidth() .imePadding(), - value = name, - onValueChange = { name = it }, + value = subject, + onValueChange = { subject = it }, shape = RoundedCornerShape(24.dp), - label = { Text(text = "Name") }, + label = { Text(text = "Subject") }, keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text), colors = OutlinedTextFieldDefaults.colors( disabledTextColor = contentColorFor(backgroundColor = colorScheme.background), @@ -89,14 +91,21 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { AssistChip( onClick = { keyboardController?.hide() - Toast.makeText(context, "No Domain 🤨", Toast.LENGTH_SHORT).show() + context.startActivity( + Intent(Intent.ACTION_SENDTO).apply { + data = Uri.parse( + "mailto:computer.club@mnnit.ac.in?subject=[MotiClubs - Query] $subject" + + "&body=[ID - ${context.getUserId()}]\n\n$postMsg", + ) + }, + ) }, label = { Text( text = "Send", fontSize = 14.sp, color = contentColorFor( - backgroundColor = if (postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty()) { + backgroundColor = if (postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty()) { colorScheme.primary } else { colorScheme.onSurface.copy(alpha = 0.38f) @@ -110,7 +119,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { painter = rememberVectorPainter(image = Icons.Rounded.Send), contentDescription = "", tint = contentColorFor( - backgroundColor = if (postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty()) { + backgroundColor = if (postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty()) { colorScheme.primary } else { colorScheme.onSurface.copy(alpha = 0.38f) @@ -124,7 +133,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { .align(Alignment.End), shape = RoundedCornerShape(24.dp), colors = AssistChipDefaults.assistChipColors(containerColor = colorScheme.primary), - enabled = postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty(), + enabled = postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty(), ) } } diff --git a/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/DeveloperProfile.kt b/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/DeveloperProfile.kt index 0198b49..d867af6 100644 --- a/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/DeveloperProfile.kt +++ b/app/src/main/java/com/mnnit/moticlubs/ui/components/aboutus/DeveloperProfile.kt @@ -40,6 +40,7 @@ fun ColumnScope.DeveloperProfile( stream: String = "", year: String = "", showIcons: Boolean = true, + icons: (@Composable () -> Unit)? = null, ) { val focusManager = LocalFocusManager.current val uriHandler = LocalUriHandler.current @@ -105,44 +106,48 @@ fun ColumnScope.DeveloperProfile( .fillMaxHeight(), ) { if (showIcons) { - if (userModel.avatar.isTrimmedNotEmpty()) { - IconButton( - modifier = Modifier - .size(28.dp) - .align(Alignment.CenterHorizontally), - onClick = { - focusManager.clearFocus(true) - uriHandler.openUri(userModel.avatar.replace(".png", "")) - }, - ) { - Icon( + if (icons != null) { + icons() + } else { + if (userModel.avatar.isTrimmedNotEmpty()) { + IconButton( modifier = Modifier - .size(20.dp) + .size(28.dp) .align(Alignment.CenterHorizontally), - painter = painterResource(id = R.drawable.github), - contentDescription = "", - ) + onClick = { + focusManager.clearFocus(true) + uriHandler.openUri(userModel.avatar.replace(".png", "")) + }, + ) { + Icon( + modifier = Modifier + .size(20.dp) + .align(Alignment.CenterHorizontally), + painter = painterResource(id = R.drawable.github), + contentDescription = "", + ) + } } - } - if (linkedin.isTrimmedNotEmpty()) { - Spacer(modifier = Modifier.padding(8.dp)) - IconButton( - modifier = Modifier - .size(28.dp) - .align(Alignment.CenterHorizontally), - onClick = { - focusManager.clearFocus(true) - uriHandler.openUri(linkedin) - }, - ) { - Icon( + if (linkedin.isTrimmedNotEmpty()) { + Spacer(modifier = Modifier.padding(8.dp)) + IconButton( modifier = Modifier - .size(20.dp) + .size(28.dp) .align(Alignment.CenterHorizontally), - painter = painterResource(id = R.drawable.linkedin), - contentDescription = "", - ) + onClick = { + focusManager.clearFocus(true) + uriHandler.openUri(linkedin) + }, + ) { + Icon( + modifier = Modifier + .size(20.dp) + .align(Alignment.CenterHorizontally), + painter = painterResource(id = R.drawable.linkedin), + contentDescription = "", + ) + } } } } diff --git a/app/src/main/java/com/mnnit/moticlubs/ui/screens/AboutUsScreen.kt b/app/src/main/java/com/mnnit/moticlubs/ui/screens/AboutUsScreen.kt index ec3fef5..4677009 100644 --- a/app/src/main/java/com/mnnit/moticlubs/ui/screens/AboutUsScreen.kt +++ b/app/src/main/java/com/mnnit/moticlubs/ui/screens/AboutUsScreen.kt @@ -24,6 +24,7 @@ import androidx.compose.material3.BottomSheetScaffold import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.rememberBottomSheetScaffoldState @@ -58,9 +59,11 @@ import com.mnnit.moticlubs.ui.viewmodel.AboutUsViewModel fun AboutUsScreen(modifier: Modifier = Modifier, viewModel: AboutUsViewModel = hiltViewModel()) { val cc = "https://github.com/CC-MNNIT.png" val shank = "https://github.com/shank03.png" + val amit = "https://github.com/hackeramitkumar.png" val scrollState = rememberScrollState() val scaffoldState = rememberBottomSheetScaffoldState() + val uriHandler = LocalUriHandler.current MotiClubsTheme { SetTransparentSystemBars(setStatusBar = 1f, setNavBar = false) @@ -161,26 +164,26 @@ fun AboutUsScreen(modifier: Modifier = Modifier, viewModel: AboutUsViewModel = h .padding(bottom = 8.dp), name = "Made with 💻\nBy CC Club - MNNIT", userModel = User().copy(avatar = cc), - showIcons = false, + showIcons = true, + icons = { + IconButton( + modifier = Modifier + .size(28.dp) + .align(Alignment.CenterHorizontally), + onClick = { + uriHandler.openUri("https://sac.mnnit.ac.in/moticlubs/") + }, + ) { + Icon( + modifier = Modifier + .size(20.dp) + .align(Alignment.CenterHorizontally), + imageVector = Icons.Rounded.OpenInNew, + contentDescription = "", + ) + } + }, ) - - Row( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), - ) { - GithubLinkButton( - viewModel, - name = "App", - url = "https://github.com/CC-MNNIT/MotiClubs", - ) - Spacer(modifier = Modifier.padding(4.dp)) - GithubLinkButton( - viewModel, - name = "Backend", - url = "https://github.com/CC-MNNIT/MotiClubs-Service", - ) - } } } @@ -201,7 +204,15 @@ fun AboutUsScreen(modifier: Modifier = Modifier, viewModel: AboutUsViewModel = h userModel = User().copy(avatar = shank), linkedin = "https://linkedin.com/in/shank03", name = "Shashank Verma", - stream = "CSE", + stream = "20204184 - CSE", + year = "Final year", + ) + Spacer(modifier = Modifier.padding(8.dp)) + DeveloperProfile( + userModel = User().copy(avatar = amit), + linkedin = "https://linkedin.com/in/amit3210", + name = "Amit Kumar", + stream = "20204022 - CSE", year = "Final year", ) } @@ -228,6 +239,7 @@ private fun RowScope.GithubLinkButton( viewModel: AboutUsViewModel, name: String, url: String = "", + showGithub: Boolean = true, ) { val uriHandler = LocalUriHandler.current @@ -254,15 +266,17 @@ private fun RowScope.GithubLinkButton( .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { - Icon( - modifier = Modifier - .size(20.dp) - .align(Alignment.CenterVertically), - painter = painterResource(id = R.drawable.github), - contentDescription = "", - ) + if (showGithub) { + Icon( + modifier = Modifier + .size(20.dp) + .align(Alignment.CenterVertically), + painter = painterResource(id = R.drawable.github), + contentDescription = "", + ) - Spacer(modifier = Modifier.padding(2.dp)) + Spacer(modifier = Modifier.padding(2.dp)) + } Text( text = name,