Skip to content

Commit

Permalink
fix(ui): internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkFood02 committed Oct 4, 2024
1 parent 2c6fa3e commit 160ae54
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
45 changes: 22 additions & 23 deletions app/src/main/java/com/junkfood/seal/ui/component/SponsorItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -17,10 +18,12 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.min
import com.junkfood.seal.R
import com.junkfood.seal.ui.common.AsyncImageImpl

fun gitHubAvatar(userLogin: String): String = "https://github.com/${userLogin}.png"

fun gitHubProfile(userLogin: String): String = "https://github.com/${userLogin}"

@Composable
Expand All @@ -35,49 +38,47 @@ fun SponsorItem(
) {
Column() {
Column(
modifier = modifier
.fillMaxWidth()
.clip(MaterialTheme.shapes.large)
.clickable(
onClick = onClick,
)
.padding(4.dp),
horizontalAlignment = Alignment.CenterHorizontally
modifier =
modifier
.fillMaxWidth()
.clip(MaterialTheme.shapes.large)
.clickable(onClick = onClick)
.padding(4.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
AsyncImageImpl(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f, true)
.clip(CircleShape),
modifier =
Modifier.widthIn(min = 48.dp, max = 108.dp)
.fillMaxWidth()
.aspectRatio(1f, true)
.clip(CircleShape),
model = avatarUrl,
contentDescription = null,
contentScale = ContentScale.Crop
contentScale = ContentScale.Crop,
)
Column(
modifier = Modifier.padding(contentPadding),
horizontalAlignment = Alignment.CenterHorizontally
horizontalAlignment = Alignment.CenterHorizontally,
) {
userName?.let {
Text(
text = it,
maxLines = 1,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onSurface,
overflow = TextOverflow.Ellipsis
overflow = TextOverflow.Ellipsis,
)
}
Text(
text = "@$userLogin",
maxLines = 1,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
overflow = TextOverflow.Ellipsis
overflow = TextOverflow.Ellipsis,
)
}

}
}

}

@Composable
Expand All @@ -87,8 +88,6 @@ fun SponsorItemPreview() {
userName = "junkfood",
userLogin = "JunkFood02",
avatarUrl = R.drawable.sample1,
profileUrl = ""
) {

}
}
profileUrl = "",
) {}
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/junkfood/seal/ui/page/AppEntry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import com.junkfood.seal.ui.page.downloadv2.DownloadPageV2
import com.junkfood.seal.ui.page.settings.SettingsPage
import com.junkfood.seal.ui.page.settings.about.AboutPage
import com.junkfood.seal.ui.page.settings.about.CreditsPage
import com.junkfood.seal.ui.page.settings.about.DonatePage
import com.junkfood.seal.ui.page.settings.about.SponsorsPage
import com.junkfood.seal.ui.page.settings.about.UpdatePage
import com.junkfood.seal.ui.page.settings.appearance.AppearancePreferences
import com.junkfood.seal.ui.page.settings.appearance.DarkThemePreferences
Expand Down Expand Up @@ -204,7 +204,7 @@ fun NavGraphBuilder.settingsGraph(
onNavigateToDonatePage = { onNavigateTo(Route.DONATE) },
)
}
animatedComposable(Route.DONATE) { DonatePage(onNavigateBack) }
animatedComposable(Route.DONATE) { SponsorsPage(onNavigateBack) }
animatedComposable(Route.CREDITS) { CreditsPage(onNavigateBack) }
animatedComposable(Route.AUTO_UPDATE) { UpdatePage(onNavigateBack) }
animatedComposable(Route.APPEARANCE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package com.junkfood.seal.ui.page
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -36,6 +38,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import com.junkfood.seal.R
import com.junkfood.seal.ui.common.LocalWindowWidthState
import com.junkfood.seal.ui.common.Route
Expand Down Expand Up @@ -81,8 +84,9 @@ fun NavigationDrawer(
PermanentNavigationDrawer(
drawerContent = {
PermanentDrawerSheet(
modifier = modifier.width(240.dp),
modifier = modifier.zIndex(1f).width(240.dp),
drawerContainerColor = MaterialTheme.colorScheme.surfaceContainer,
windowInsets = WindowInsets(0)
) {
NavigationDrawerSheetContent(
modifier = Modifier,
Expand Down Expand Up @@ -116,6 +120,7 @@ fun NavigationDrawerSheetContent(
.padding(horizontal = 12.dp)
.fillMaxHeight()
.verticalScroll(rememberScrollState())
.systemBarsPadding()
) {
Spacer(Modifier.height(72.dp))
ProvideTextStyle(MaterialTheme.typography.labelLarge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.aspectRatio
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.lazy.grid.GridCells
Expand Down Expand Up @@ -61,6 +62,7 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.max
import com.junkfood.seal.R
import com.junkfood.seal.ui.common.AsyncImageImpl
import com.junkfood.seal.ui.component.BackButton
Expand Down Expand Up @@ -91,7 +93,7 @@ private const val SUPPORTERS = "Supporters 💖"

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DonatePage(onNavigateBack: () -> Unit) {
fun SponsorsPage(onNavigateBack: () -> Unit) {
val scrollBehavior =
TopAppBarDefaults.exitUntilCollapsedScrollBehavior(rememberTopAppBarState(),
canScroll = { true })
Expand Down Expand Up @@ -173,7 +175,6 @@ fun DonatePage(onNavigateBack: () -> Unit) {
}

items(items = supporterList,
span = { GridItemSpan(maxLineSpan / 3) },
key = { it.sponsorEntity.login }) { sponsorShip ->
SponsorItem(sponsorShip = sponsorShip) {
onSponsorClick(sponsorShip)
Expand Down Expand Up @@ -300,7 +301,7 @@ fun DonatePage(onNavigateBack: () -> Unit) {
@Composable
@Preview
fun SponsorPagePreview() {
DonatePage {}
SponsorsPage {}
}

@Composable
Expand Down Expand Up @@ -377,6 +378,7 @@ fun SponsorDialogContent(
) {
AsyncImageImpl(
modifier = Modifier
.heightIn(max = 72.dp)
.aspectRatio(1f, true)
.clip(CircleShape),
model = avatarUrl,
Expand Down

0 comments on commit 160ae54

Please sign in to comment.