Skip to content
Open
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
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ dependencies {
debugImplementation(libs.androidx.compose.ui.tooling)
implementation("androidx.compose.material:material-icons-extended")
implementation(libs.kotlinx.serialization.core)
implementation("io.coil-kt:coil-compose:2.6.0")
implementation("dev.chrisbanes.haze:haze:0.7.3")

//navigation
implementation(libs.androidx.navigation3.ui)
Expand Down
16 changes: 11 additions & 5 deletions app/src/main/java/com/tpc/nudj/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.tpc.nudj.ui.screen.auth.clubVerification.ClubVerificationScreen
import com.tpc.nudj.ui.screen.auth.emailVerification.EmailVerificationScreen
import com.tpc.nudj.ui.screen.auth.emailVerified.EmailVerifiedScreen
import com.tpc.nudj.ui.screen.auth.forgotPassword.ForgetPasswordScreen
import com.tpc.nudj.ui.screen.auth.homeScreen.HomeScreen
import com.tpc.nudj.ui.screen.auth.landing.LandingScreen
import com.tpc.nudj.ui.screen.auth.login.LoginScreen
import com.tpc.nudj.ui.screen.auth.register.RegisterScreen
Expand Down Expand Up @@ -51,19 +52,24 @@ class MainActivity : ComponentActivity() {
backStack.clear()
backStack.add(ScreenRoute.Auth.Landing)
}

is AppViewModel.AuthState.EmailNotVerified -> {
backStack.clear()
backStack.add(ScreenRoute.Auth.EmailVerification)
}

is AppViewModel.AuthState.Authenticated -> {
backStack.clear()
when (state.destination) {
AppViewModel.Destination.StudentDashboard ->
backStack.add(ScreenRoute.App.StudentDashboard)

AppViewModel.Destination.StudentDetailsInput ->
backStack.add(ScreenRoute.App.UserDetailsInput)

AppViewModel.Destination.ClubDashboard ->
backStack.add(ScreenRoute.App.ClubDashboard)

AppViewModel.Destination.ClubPending ->
backStack.add(ScreenRoute.App.ClubVerificationScreen)
}
Expand All @@ -81,7 +87,7 @@ class MainActivity : ComponentActivity() {
entry<ScreenRoute.Auth.SplashScreen> {
SplashScreen()
}
entry<ScreenRoute.Auth.Landing>{
entry<ScreenRoute.Auth.Landing> {
LandingScreen(
onLandingScreenClick = {
backStack.add(ScreenRoute.Auth.Register)
Expand All @@ -90,7 +96,7 @@ class MainActivity : ComponentActivity() {
}
entry<ScreenRoute.Auth.Login> {
LoginScreen(
navigateToCreateAccount ={
navigateToCreateAccount = {
backStack.add(ScreenRoute.Auth.Register)
}
)
Expand Down Expand Up @@ -149,13 +155,13 @@ class MainActivity : ComponentActivity() {
}
)
}
entry<ScreenRoute.App.StudentDashboard>{
entry<ScreenRoute.App.StudentDashboard> {
DemoScreen(text = "Student Dashboard")
}
entry<ScreenRoute.App.ClubDashboard>{
entry<ScreenRoute.App.ClubDashboard> {
ClubLandingScreen()
}
entry<ScreenRoute.App.ClubVerificationScreen>{
entry<ScreenRoute.App.ClubVerificationScreen> {
ClubVerificationScreen(onNavigationBack = {})
}
entry<ScreenRoute.App.UserDetailsInput> {
Expand Down
168 changes: 168 additions & 0 deletions app/src/main/java/com/tpc/nudj/ui/components/NudjSearchBar.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
package com.tpc.nudj.ui.components

import android.content.res.Configuration
import android.graphics.drawable.Icon
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.FilterAlt
import androidx.compose.material.icons.filled.FilterList
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.DockedSearchBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonColors
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.ListItem
import androidx.compose.material3.SearchBar
import androidx.compose.material3.SearchBarDefaults
import androidx.compose.material3.SearchBarDefaults.InputField
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldColors
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.semantics.isTraversalGroup
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.traversalIndex
import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.google.firebase.database.Query
import com.tpc.nudj.ui.screen.auth.homeScreen.HomeScreen
import com.tpc.nudj.ui.theme.AppColors
import com.tpc.nudj.ui.theme.LocalAppColors
import com.tpc.nudj.ui.theme.NudjTheme
import org.w3c.dom.Text
import java.nio.file.WatchEvent

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NudjSearchBar(
expanded: Boolean = false,
query: String = "",
onQueryChange: (String) -> Unit = {},
onSearch: (String) -> Unit = {},
onExpandedChange: (Boolean) -> Unit = {},
searchResults: List<String>,
onResultClick: (String) -> Unit = {},
placeholder: @Composable () -> Unit = { Text("Search") },
leadingIcon: @Composable () -> Unit,
trailingIcon: @Composable () -> Unit,
modifier: Modifier = Modifier
) {
Box(
modifier = modifier
.fillMaxWidth()
.semantics { isTraversalGroup = true }
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(12.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
DockedSearchBar(

modifier = Modifier
.weight(1f)
.semantics { traversalIndex = 0f },

colors = SearchBarDefaults.colors(
containerColor = LocalAppColors.current.textFieldColor
),
shadowElevation = 6.dp,
inputField = {
InputField(

query = query,
onQueryChange = onQueryChange,
placeholder = placeholder,
onSearch = {
onSearch(query)
},

expanded = expanded,
onExpandedChange = { onExpandedChange(it) },
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
colors = TextFieldDefaults.colors(
focusedContainerColor = LocalAppColors.current.textFieldColor,
unfocusedContainerColor = LocalAppColors.current.textFieldColor,
focusedTextColor = LocalAppColors.current.topBarColor,
unfocusedTextColor = LocalAppColors.current.topBarColor
),

)
},

shape = RoundedCornerShape(20.dp),
expanded = expanded,
onExpandedChange = { onExpandedChange(it) }


) {
LazyColumn {
items(searchResults.size) { index ->
val result = searchResults[index]
ListItem(
headlineContent = { Text(result) },
modifier = Modifier
.fillMaxWidth()
.clickable(
onClick = { onResultClick(result) }
)
.padding(vertical = 6.dp, horizontal = 16.dp)
)

}
}
}

Spacer(modifier = Modifier.width(6.dp))
Surface(
onClick = {},
shadowElevation = 6.dp,
color = LocalAppColors.current.textFieldColor,
contentColor = Color.Black,
modifier = Modifier.size(46.dp),
shape = RoundedCornerShape(12.dp)
) {
Icon(
Icons.Default.FilterAlt,
contentDescription = "filterList",
tint = Color.Black
)
}
}
}
}


@Preview(showBackground = true)
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun HomeScreenPreview() {
NudjTheme {
HomeScreen()
}
}
33 changes: 33 additions & 0 deletions app/src/main/java/com/tpc/nudj/ui/components/NudjTopAppBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -61,6 +63,37 @@ fun NudjTopAppBar(
)
}
},
actions = {
IconButton(
onClick = {},
colors = IconButtonColors(
containerColor = Color.Unspecified,
contentColor = Color.White,
disabledContentColor = Color.Unspecified,
disabledContainerColor = Color.Unspecified
)
) {
Icon(
Icons.Default.Notifications,
contentDescription = "Notifications"
)
}
IconButton(
onClick = {},
colors = IconButtonColors(
containerColor = Color.Unspecified,
contentColor = Color.White,
disabledContentColor = Color.Unspecified,
disabledContainerColor = Color.Unspecified
)

) {
Icon(
Icons.Default.Settings,
contentDescription = "settings"
)
}
},
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalAppColors.current.topBarColor,
scrolledContainerColor = Color.Unspecified,
Expand Down
Loading