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
284 changes: 284 additions & 0 deletions app/src/main/java/com/cornellappdev/score/screen/EmptyProfileScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
package com.cornellappdev.score.screen

import androidx.activity.compose.BackHandler
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
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.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
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.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
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.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.cornellappdev.score.R
import com.cornellappdev.score.theme.CrimsonPrimary
import com.cornellappdev.score.theme.GrayLight
import com.cornellappdev.score.theme.GrayPrimary
import com.cornellappdev.score.theme.GrayStroke
import com.cornellappdev.score.theme.Style

/** Standalone profile flow with local, recreation-safe avatar selection; no backend or nav host. */
@Composable
fun EmptyProfileScreen(modifier: Modifier = Modifier) {
var selectedPicture by rememberSaveable { mutableStateOf(ProfilePicture.BLANK) }
var editingPicture by rememberSaveable { mutableStateOf(false) }

BackHandler(enabled = editingPicture) { editingPicture = false }
Column(modifier
.fillMaxSize()
.background(Color.White)) {
Box(Modifier.weight(1f)) {
if (editingPicture) {
EditProfileScreen(
selectedPicture = selectedPicture,
onPictureSelected = { selectedPicture = it },
onBack = { editingPicture = false }
)
} else {
EmptyProfileContent(
selectedPicture = selectedPicture,
onEditProfilePicture = { editingPicture = true }
)
}
}
ProfileTabBar()
}
}

/** Content-only variant for embedding in a host that already supplies a bottom bar and insets. */
@Composable
fun EmptyProfileContent(
selectedPicture: ProfilePicture,
onEditProfilePicture: () -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(horizontal = 24.dp)
.padding(top = 8.dp, bottom = 32.dp)
) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Text(
stringResource(R.string.profile_title), style = Style.heading1,
color = Color.Black, modifier = Modifier.weight(1f)
)
Icon(
painterResource(R.drawable.profile_notifications),
stringResource(R.string.profile_notifications),
Modifier.size(32.dp),
tint = Color.Unspecified
)
Spacer(Modifier.width(8.dp))
Icon(
painterResource(R.drawable.profile_settings),
stringResource(R.string.profile_settings),
Modifier.size(32.dp),
tint = Color.Unspecified
)
}
Spacer(Modifier.height(24.dp))
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Image(
painterResource(selectedPicture.drawable),
stringResource(
R.string.selected_profile_picture,
stringResource(selectedPicture.label)
),
Modifier.size(70.dp)
)
Column(Modifier.weight(1f)) {
Text(
stringResource(R.string.profile_placeholder_name),
style = Style.heading2,
color = GrayPrimary
)
Box(
Modifier
.heightIn(min = 48.dp)
.clickable(role = Role.Button, onClick = onEditProfilePicture),
contentAlignment = Alignment.CenterStart
) {
Text(
stringResource(R.string.edit_profile_picture),
style = Style.labelsNormal,
color = CrimsonPrimary
)
}
}
}
ProfileSectionDivider()
ProfileSectionHeading(R.string.profile_favorite_sports, R.string.profile_edit, Color.Black)
Spacer(Modifier.height(16.dp))
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Box(
Modifier
.shadow(
4.dp, RoundedCornerShape(20.dp), ambientColor = Color(0x12000000),
spotColor = Color(0x12000000)
)
.background(Color.White, RoundedCornerShape(20.dp))
.border(1.dp, GrayStroke, RoundedCornerShape(20.dp))
.padding(24.dp),
contentAlignment = Alignment.Center
) {
Icon(
painterResource(R.drawable.profile_add),
null,
Modifier.size(40.dp),
tint = Color.Unspecified
)
}
Spacer(Modifier.height(8.dp))
Text(
stringResource(R.string.profile_add_sports),
style = Style.bodyMedium,
color = Color.Black
)
}
ProfileSectionDivider()
ProfileSectionHeading(
R.string.profile_bookmarked_highlights,
R.string.profile_show_all,
GrayPrimary
)
Spacer(Modifier.height(24.dp))
Column(
Modifier
.fillMaxWidth()
.heightIn(min = 176.dp)
.border(1.dp, GrayStroke, RoundedCornerShape(12.dp))
.padding(24.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Box(
Modifier
.size(44.dp)
.background(GrayStroke, CircleShape),
contentAlignment = Alignment.Center
) {
Icon(
painterResource(R.drawable.profile_bookmark),
null,
Modifier.size(24.dp),
tint = Color.Unspecified
)
}
Spacer(Modifier.height(16.dp))
Text(
stringResource(R.string.profile_no_bookmarks),
style = Style.bodyNormal,
color = GrayPrimary
)
}
}
}

@Composable
private fun ProfileSectionDivider() {
Column {
Spacer(Modifier.height(24.dp))
HorizontalDivider(color = GrayStroke)
Spacer(Modifier.height(24.dp))
}
}

@Composable
private fun ProfileSectionHeading(@StringRes title: Int, @StringRes action: Int, color: Color) {
Row(
Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
stringResource(title),
style = Style.heading2,
color = color,
modifier = Modifier.weight(1f)
)
Text(stringResource(action), style = Style.bodyMedium, color = GrayLight)
Icon(
painterResource(R.drawable.ic_right_chevron),
null,
Modifier.size(16.dp),
tint = GrayLight
)
}
}

// Static navigation artwork: the reference tabs are intentionally non-interactive.
@Composable
private fun ProfileTabBar() {
Row(
Modifier
.fillMaxWidth()
.shadow(6.dp, RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp))
.background(Color.White)
.padding(vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
ProfileTab(R.drawable.ic_schedule, R.string.profile_schedule, Modifier.weight(1f))
ProfileTab(R.drawable.ic_scores, R.string.profile_scores, Modifier.weight(1f))
ProfileTab(R.drawable.ic_nav_star, R.string.profile_highlights, Modifier.weight(1f))
ProfileTab(
R.drawable.profile_person,
R.string.profile_title,
Modifier.weight(1f),
CrimsonPrimary
)
}
}

@Composable
private fun ProfileTab(
@DrawableRes icon: Int,
@StringRes label: Int,
modifier: Modifier = Modifier,
color: Color = GrayPrimary
) {
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
Icon(painterResource(icon), null, Modifier.size(24.dp), tint = color)
Spacer(Modifier.height(4.dp))
Text(stringResource(label), style = Style.bodyMedium, color = color)
}
}

@Preview(showBackground = true, widthDp = 393, heightDp = 776)
@Composable
private fun EmptyProfileScreenPreview() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This preview doesn't seem to work

EmptyProfileScreen()
}
3 changes: 3 additions & 0 deletions app/src/main/res/drawable/profile_add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="40dp" android:height="40dp" android:viewportWidth="40" android:viewportHeight="40">
<path android:fillColor="#333333" android:pathData="M30 21.6666H21.6667V29.9999C21.6667 30.9166 20.9167 31.6666 20 31.6666C19.0834 31.6666 18.3334 30.9166 18.3334 29.9999V21.6666H10C9.08337 21.6666 8.33337 20.9166 8.33337 19.9999C8.33337 19.0833 9.08337 18.3333 10 18.3333H18.3334V9.99992C18.3334 9.08325 19.0834 8.33325 20 8.33325C20.9167 8.33325 21.6667 9.08325 21.6667 9.99992V18.3333H30C30.9167 18.3333 31.6667 19.0833 31.6667 19.9999C31.6667 20.9166 30.9167 21.6666 30 21.6666Z" />
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/drawable/profile_bookmark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#C2C2C2" android:pathData="M16.5 2.25H7.5C6.90326 2.25 6.33097 2.48705 5.90901 2.90901C5.48705 3.33097 5.25 3.90326 5.25 4.5V21.75L12 15.75L18.75 21.75V4.5C18.75 3.90326 18.5129 3.33097 18.091 2.90901C17.669 2.48705 17.0967 2.25 16.5 2.25Z" />
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/drawable/profile_notifications.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="32" android:viewportHeight="32">
<path android:fillColor="#777777" android:pathData="M6.66671 25.3334C6.28893 25.3334 5.97226 25.2056 5.71671 24.9501C5.46115 24.6945 5.33337 24.3779 5.33337 24.0001C5.33337 23.6223 5.46115 23.3056 5.71671 23.0501C5.97226 22.7945 6.28893 22.6667 6.66671 22.6667H8.00004V13.3334C8.00004 11.489 8.5556 9.85008 9.66671 8.41675C10.7778 6.98341 12.2223 6.04453 14 5.60008V4.66675C14 4.11119 14.1945 3.63897 14.5834 3.25008C14.9723 2.86119 15.4445 2.66675 16 2.66675C16.5556 2.66675 17.0278 2.86119 17.4167 3.25008C17.8056 3.63897 18 4.11119 18 4.66675V5.60008C19.7778 6.04453 21.2223 6.98341 22.3334 8.41675C23.4445 9.85008 24 11.489 24 13.3334V22.6667H25.3334C25.7112 22.6667 26.0278 22.7945 26.2834 23.0501C26.5389 23.3056 26.6667 23.6223 26.6667 24.0001C26.6667 24.3779 26.5389 24.6945 26.2834 24.9501C26.0278 25.2056 25.7112 25.3334 25.3334 25.3334H6.66671ZM16 29.3334C15.2667 29.3334 14.6389 29.0723 14.1167 28.5501C13.5945 28.0279 13.3334 27.4001 13.3334 26.6667H18.6667C18.6667 27.4001 18.4056 28.0279 17.8834 28.5501C17.3612 29.0723 16.7334 29.3334 16 29.3334ZM10.6667 22.6667H21.3334V13.3334C21.3334 11.8667 20.8112 10.6112 19.7667 9.56675C18.7223 8.5223 17.4667 8.00008 16 8.00008C14.5334 8.00008 13.2778 8.5223 12.2334 9.56675C11.1889 10.6112 10.6667 11.8667 10.6667 13.3334V22.6667Z" />
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/drawable/profile_person.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#A5210D" android:pathData="M12,12a4,4 0,1 0,0 -8a4,4 0,1 0,0 8M12,14c-4.42,0 -8,2.24 -8,5v1c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-1c0,-2.76 -3.58,-5 -8,-5" />
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/drawable/profile_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="32" android:viewportHeight="32">
<path android:fillColor="#777777" android:pathData="M14.4333 29.3334C13.8333 29.3334 13.3166 29.1334 12.8833 28.7334C12.45 28.3334 12.1889 27.8445 12.1 27.2667L11.8 25.0667C11.5111 24.9556 11.2389 24.8223 10.9833 24.6667C10.7278 24.5112 10.4778 24.3445 10.2333 24.1667L8.16664 25.0334C7.61108 25.2779 7.05553 25.3001 6.49997 25.1001C5.94442 24.9001 5.51108 24.5445 5.19997 24.0334L3.63331 21.3001C3.3222 20.789 3.23331 20.2445 3.36664 19.6667C3.49997 19.089 3.79997 18.6112 4.26664 18.2334L6.03331 16.9001C6.01109 16.7445 5.99997 16.5945 5.99997 16.4501V15.5501C5.99997 15.4056 6.01109 15.2556 6.03331 15.1001L4.26664 13.7667C3.79997 13.389 3.49997 12.9112 3.36664 12.3334C3.23331 11.7556 3.3222 11.2112 3.63331 10.7001L5.19997 7.96675C5.51108 7.45564 5.94442 7.10008 6.49997 6.90008C7.05553 6.70008 7.61108 6.7223 8.16664 6.96675L10.2333 7.83341C10.4778 7.65564 10.7333 7.48897 11 7.33341C11.2666 7.17786 11.5333 7.04453 11.8 6.93341L12.1 4.73341C12.1889 4.15564 12.45 3.66675 12.8833 3.26675C13.3166 2.86675 13.8333 2.66675 14.4333 2.66675H17.5666C18.1666 2.66675 18.6833 2.86675 19.1166 3.26675C19.55 3.66675 19.8111 4.15564 19.9 4.73341L20.2 6.93341C20.4889 7.04453 20.7611 7.17786 21.0166 7.33341C21.2722 7.48897 21.5222 7.65564 21.7666 7.83341L23.8333 6.96675C24.3889 6.7223 24.9444 6.70008 25.5 6.90008C26.0555 7.10008 26.4889 7.45564 26.8 7.96675L28.3666 10.7001C28.6777 11.2112 28.7666 11.7556 28.6333 12.3334C28.5 12.9112 28.2 13.389 27.7333 13.7667L25.9666 15.1001C25.9889 15.2556 26 15.4056 26 15.5501V16.4501C26 16.5945 25.9778 16.7445 25.9333 16.9001L27.7 18.2334C28.1666 18.6112 28.4666 19.089 28.6 19.6667C28.7333 20.2445 28.6444 20.789 28.3333 21.3001L26.7333 24.0334C26.4222 24.5445 25.9889 24.9001 25.4333 25.1001C24.8778 25.3001 24.3222 25.2779 23.7666 25.0334L21.7666 24.1667C21.5222 24.3445 21.2666 24.5112 21 24.6667C20.7333 24.8223 20.4666 24.9556 20.2 25.0667L19.9 27.2667C19.8111 27.8445 19.55 28.3334 19.1166 28.7334C18.6833 29.1334 18.1666 29.3334 17.5666 29.3334H14.4333ZM14.6666 26.6667H17.3L17.7666 23.1334C18.4555 22.9556 19.0944 22.6945 19.6833 22.3501C20.2722 22.0056 20.8111 21.589 21.3 21.1001L24.6 22.4667L25.9 20.2001L23.0333 18.0334C23.1444 17.7223 23.2222 17.3945 23.2666 17.0501C23.3111 16.7056 23.3333 16.3556 23.3333 16.0001C23.3333 15.6445 23.3111 15.2945 23.2666 14.9501C23.2222 14.6056 23.1444 14.2779 23.0333 13.9667L25.9 11.8001L24.6 9.53341L21.3 10.9334C20.8111 10.4223 20.2722 9.99453 19.6833 9.65008C19.0944 9.30564 18.4555 9.04453 17.7666 8.86675L17.3333 5.33341H14.7L14.2333 8.86675C13.5444 9.04453 12.9055 9.30564 12.3166 9.65008C11.7278 9.99453 11.1889 10.4112 10.7 10.9001L7.39997 9.53341L6.09997 11.8001L8.96664 13.9334C8.85553 14.2667 8.77775 14.6001 8.73331 14.9334C8.68886 15.2667 8.66664 15.6223 8.66664 16.0001C8.66664 16.3556 8.68886 16.7001 8.73331 17.0334C8.77775 17.3667 8.85553 17.7001 8.96664 18.0334L6.09997 20.2001L7.39997 22.4667L10.7 21.0667C11.1889 21.5779 11.7278 22.0056 12.3166 22.3501C12.9055 22.6945 13.5444 22.9556 14.2333 23.1334L14.6666 26.6667ZM16.0666 20.6667C17.3555 20.6667 18.4555 20.2112 19.3666 19.3001C20.2778 18.389 20.7333 17.289 20.7333 16.0001C20.7333 14.7112 20.2778 13.6112 19.3666 12.7001C18.4555 11.789 17.3555 11.3334 16.0666 11.3334C14.7555 11.3334 13.65 11.789 12.75 12.7001C11.85 13.6112 11.4 14.7112 11.4 16.0001C11.4 17.289 11.85 18.389 12.75 19.3001C13.65 20.2112 14.7555 20.6667 16.0666 20.6667Z" />
</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,18 @@
<string name="profile_tennis">Tennis</string>
<string name="profile_baseball">Baseball</string>
<string name="profile_soccer">Soccer</string>
<string name="profile_title">Profile</string>
<string name="profile_placeholder_name">Claire Yu</string>
<string name="edit_profile_picture">Edit profile picture</string>
<string name="profile_favorite_sports">Favorite Sports</string>
<string name="profile_edit">Edit</string>
<string name="profile_add_sports">Add Sports</string>
<string name="profile_bookmarked_highlights">Bookmarked Highlights</string>
<string name="profile_show_all">Show all</string>
<string name="profile_no_bookmarks">No bookmarks yet</string>
<string name="profile_notifications">Notifications</string>
<string name="profile_settings">Settings</string>
<string name="profile_schedule">Schedule</string>
<string name="profile_scores">Scores</string>
<string name="profile_highlights">Highlights</string>
</resources>
Binary file added docs/screenshots/empty-profile-screen.png

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading