-
Notifications
You must be signed in to change notification settings - Fork 0
Profile and edit profile screen UI #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
c1b0570
b9064ef
d6a14ec
152765a
f931b20
d02c837
e525d28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since GamesCarousel is used on the home screen for another feature, changing it here for the profile page affects how the home screen looks. The changes look great but we just need to move them to a new composable so we can tweak them specifically for the profile page without accidentally changing other parts of the UI! you'll want to revert the changes in this file after you've moved them to a new composable! also, the bookmarks lazy column might be pretty similar to the HighlightsCardRow composable (in terms of the header (Bookmarks n Results >). feel free to take a look at that/copy some code from there into the new component for this profile page row! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,11 +11,13 @@ import androidx.navigation.toRoute | |
| import com.cornellappdev.score.model.ScoreEvent | ||
| import com.cornellappdev.score.nav.root.ScoreScreens | ||
| import com.cornellappdev.score.nav.root.ScoreScreens.Home | ||
| import com.cornellappdev.score.screen.EditProfileScreen | ||
| import com.cornellappdev.score.screen.GameDetailsScreen | ||
| import com.cornellappdev.score.screen.HighlightsScreen | ||
| import com.cornellappdev.score.screen.HighlightsSearchScreen | ||
| import com.cornellappdev.score.screen.HomeScreen | ||
| import com.cornellappdev.score.screen.PastGamesScreen | ||
| import com.cornellappdev.score.screen.ProfileScreen | ||
| import com.cornellappdev.score.util.highlightsList | ||
| import com.cornellappdev.score.util.recentSearchList | ||
| import com.cornellappdev.score.util.sportList | ||
|
|
@@ -47,6 +49,20 @@ fun ScoreNavHost(navController: NavHostController) { | |
| }) | ||
| } | ||
| } | ||
| composable<ScoreScreens.Profile> { | ||
| ProfileScreen( | ||
| navigateToEditProfile = { | ||
| navController.navigate(ScoreScreens.EditProfile) | ||
| } | ||
| ) | ||
| } | ||
| composable<ScoreScreens.EditProfile> { | ||
| EditProfileScreen( | ||
| onBackClick = { | ||
| navController.navigateUp() | ||
| } | ||
| ) | ||
| } | ||
|
Comment on lines
+57
to
+73
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good! |
||
| composable<ScoreScreens.GameDetailsPage> { | ||
| GameDetailsScreen( | ||
| onBackArrow = { | ||
|
|
@@ -89,4 +105,3 @@ fun ScoreNavHost(navController: NavHostController) { | |
| // } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import androidx.compose.material3.Text | |
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.graphics.vector.ImageVector | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.navigation.NavBackStackEntry | ||
|
|
@@ -38,11 +39,20 @@ fun ScoreNavigationBar( | |
| selectedIndicatorColor = Color.Transparent | ||
| ), | ||
| icon = { | ||
| Icon( | ||
| painter = painterResource(id = if (isSelected) item.selectedIcon else item.unselectedIcon), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| val icon = if (isSelected) item.selectedIcon else item.unselectedIcon | ||
| if (icon is Int) { | ||
| Icon( | ||
| painter = painterResource(id = icon), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| } else if (icon is ImageVector) { | ||
| Icon( | ||
| imageVector = icon, | ||
| contentDescription = null, | ||
| tint = if (isSelected) CrimsonPrimary else GrayPrimary | ||
| ) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to import the Profile Icon as a Drawable in Resource Manager on the left. This way you do not need this additional if statement. I can show you next time! |
||
| }, | ||
| label = { | ||
| Text( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,10 @@ import androidx.compose.foundation.layout.fillMaxSize | |
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material.icons.Icons | ||
| import androidx.compose.material.icons.filled.Person | ||
| import androidx.compose.material.icons.outlined.Person | ||
| import androidx.compose.material.icons.outlined.Schedule | ||
| import androidx.compose.material3.Scaffold | ||
| import androidx.compose.material3.Surface | ||
| import androidx.compose.runtime.Composable | ||
|
|
@@ -18,6 +22,7 @@ import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.draw.dropShadow | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.graphics.shadow.Shadow | ||
| import androidx.compose.ui.graphics.vector.ImageVector | ||
| import androidx.compose.ui.unit.DpOffset | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.hilt.navigation.compose.hiltViewModel | ||
|
|
@@ -65,7 +70,8 @@ fun RootNavigation( | |
|
|
||
| Scaffold( | ||
| modifier = modifier.fillMaxSize(), bottomBar = { | ||
| if (navBackStackEntry?.toScreen() is ScoreScreens.GameDetailsPage) { | ||
| val currentScreen = navBackStackEntry?.toScreen() | ||
| if (currentScreen is ScoreScreens.GameDetailsPage || currentScreen is ScoreScreens.EditProfile) { | ||
| return@Scaffold | ||
| } | ||
| Surface( | ||
|
|
@@ -110,6 +116,12 @@ sealed class ScoreScreens { | |
| @Serializable | ||
| data class GameScoreSummaryPage(val scoreEvents: String) : ScoreScreens() | ||
|
|
||
| @Serializable | ||
| data object Profile : ScoreScreens() | ||
|
|
||
| @Serializable | ||
| data object EditProfile : ScoreScreens() | ||
|
|
||
| ////removed for 2/2026 release | ||
| // @Serializable | ||
| // data object HighlightsScreen : ScoreScreens() | ||
|
|
@@ -124,17 +136,19 @@ fun NavBackStackEntry.toScreen(): ScoreScreens? = | |
| "GameDetailsPage" -> toRoute<ScoreScreens.GameDetailsPage>() | ||
| "ScoresScreen" -> toRoute<ScoreScreens.ScoresScreen>() | ||
| "GameScoreSummaryPage" -> toRoute<ScoreScreens.GameScoreSummaryPage>() | ||
| "Profile" -> toRoute<ScoreScreens.Profile>() | ||
| "EditProfile" -> toRoute<ScoreScreens.EditProfile>() | ||
| //removed for 2/2026 release | ||
| // "HighlightsScreen" -> toRoute<ScoreScreens.HighlightsScreen>() | ||
| // "HighlightsSearchScreen" -> toRoute<ScoreScreens.HighlightsScreen>() | ||
| else -> throw IllegalArgumentException("Invalid screen") | ||
| else -> null | ||
| } | ||
|
|
||
| data class NavItem( | ||
| val screen: ScoreScreens, | ||
| val label: String, | ||
| val unselectedIcon: Int, | ||
| val selectedIcon: Int | ||
| val unselectedIcon: Any, | ||
| val selectedIcon: Any | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change this back to int |
||
| ) | ||
|
|
||
| val tabs = listOf( | ||
|
|
@@ -157,4 +171,10 @@ val tabs = listOf( | |
| selectedIcon = R.drawable.ic_scores_filled, | ||
| screen = ScoreScreens.ScoresScreen, | ||
| ), | ||
| ) | ||
| NavItem( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we might've talked ab this after you opened this PR so no worries, but just a note that this icon will be in the top right corner of the home page! |
||
| label = "Profile", | ||
| unselectedIcon = Icons.Outlined.Person, | ||
| selectedIcon = Icons.Filled.Person, | ||
| screen = ScoreScreens.Profile, | ||
| ), | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think all the other Icons are Drawable so here u would make the change! |
||
Uh oh!
There was an error while loading. Please reload this page.