Changed secondary color & reorganized welcome/home screen
This commit is contained in:
parent
8f92b6d195
commit
b980784b1f
@ -6,7 +6,7 @@ val primaryLight = Color(0xFF9FD1FF)
|
|||||||
val primary = Color(0xFF0070D8)
|
val primary = Color(0xFF0070D8)
|
||||||
val primaryDark = Color(0xFF014F97)
|
val primaryDark = Color(0xFF014F97)
|
||||||
val onPrimary = Color(0xFFFFFFFFF)
|
val onPrimary = Color(0xFFFFFFFFF)
|
||||||
val secondary = Color(0xFFAB02E9)
|
val secondary = Color(0xFFe9c754)
|
||||||
val mainText = Color(0xFF212934)
|
val mainText = Color(0xFF212934)
|
||||||
val mainTextDark = Color(0xFFFFFFFF)
|
val mainTextDark = Color(0xFFFFFFFF)
|
||||||
val secondaryText = Color(0xFF595858)
|
val secondaryText = Color(0xFF595858)
|
||||||
@ -33,4 +33,4 @@ val dialogBackgroundColor = Color(0xAA000000)
|
|||||||
val unhoverScrollbarColorLight = Color.LightGray
|
val unhoverScrollbarColorLight = Color.LightGray
|
||||||
val unhoverScrollbarColorDark = Color.Gray
|
val unhoverScrollbarColorDark = Color.Gray
|
||||||
val hoverScrollbarColorLight = primary
|
val hoverScrollbarColorLight = primary
|
||||||
val hoverScrollbarColorDark = Color.LightGray
|
val hoverScrollbarColorDark = Color.LightGray
|
@ -20,6 +20,7 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import app.AppConstants
|
import app.AppConstants
|
||||||
|
import app.AppStateManager
|
||||||
import app.extensions.dirName
|
import app.extensions.dirName
|
||||||
import app.extensions.dirPath
|
import app.extensions.dirPath
|
||||||
import app.theme.primaryTextColor
|
import app.theme.primaryTextColor
|
||||||
@ -60,118 +61,15 @@ fun WelcomePage(
|
|||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
modifier = Modifier.align(BiasAlignment(0f, -0.5f))
|
modifier = Modifier.align(BiasAlignment(0f, -0.5f))
|
||||||
) {
|
) {
|
||||||
Column(
|
HomeButtons(
|
||||||
modifier = Modifier.padding(end = 32.dp),
|
newUpdate = newUpdate,
|
||||||
) {
|
tabViewModel = tabViewModel,
|
||||||
Text(
|
onShowCloneView = {
|
||||||
text = "Gitnuro",
|
showCloneView = true
|
||||||
fontSize = 32.sp,
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
modifier = Modifier.padding(bottom = 16.dp),
|
|
||||||
)
|
|
||||||
|
|
||||||
ButtonTile(
|
|
||||||
modifier = Modifier.padding(bottom = 8.dp),
|
|
||||||
title = "Open a repository",
|
|
||||||
painter = painterResource("open.svg"),
|
|
||||||
onClick = { openRepositoryDialog(tabViewModel) })
|
|
||||||
|
|
||||||
ButtonTile(
|
|
||||||
modifier = Modifier.padding(bottom = 8.dp),
|
|
||||||
title = "Clone a repository",
|
|
||||||
painter = painterResource("download.svg"),
|
|
||||||
onClick = {
|
|
||||||
showCloneView = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
ButtonTile(
|
|
||||||
modifier = Modifier.padding(bottom = 8.dp),
|
|
||||||
title = "Start a local repository",
|
|
||||||
painter = painterResource("open.svg"),
|
|
||||||
onClick = {
|
|
||||||
val dir = openDirectoryDialog()
|
|
||||||
if (dir != null) tabViewModel.initLocalRepository(dir)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "About Gitnuro",
|
|
||||||
fontSize = 18.sp,
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
modifier = Modifier.padding(top = 16.dp, bottom = 8.dp),
|
|
||||||
)
|
|
||||||
|
|
||||||
IconTextButton(
|
|
||||||
title = "Source code",
|
|
||||||
painter = painterResource("code.svg"),
|
|
||||||
onClick = {
|
|
||||||
Desktop.getDesktop().browse(URI("https://github.com/JetpackDuba/Gitnuro"))
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
IconTextButton(
|
|
||||||
title = "Report a bug",
|
|
||||||
painter = painterResource("bug.svg"),
|
|
||||||
onClick = {
|
|
||||||
Desktop.getDesktop().browse(URI("https://github.com/JetpackDuba/Gitnuro/issues"))
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(newUpdate != null) {
|
|
||||||
IconTextButton(
|
|
||||||
title = "New update ${newUpdate?.appVersion} available ",
|
|
||||||
painter = painterResource("grade.svg"),
|
|
||||||
iconColor = MaterialTheme.colors.secondary,
|
|
||||||
onClick = {
|
|
||||||
newUpdate?.downloadUrl?.let {
|
|
||||||
Desktop.getDesktop().browse(URI(it))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
Column(
|
RecentRepositories(appStateManager, tabViewModel)
|
||||||
modifier = Modifier
|
|
||||||
.padding(start = 32.dp),
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "Recent",
|
|
||||||
fontSize = 18.sp,
|
|
||||||
modifier = Modifier.padding(top = 48.dp, bottom = 8.dp),
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
)
|
|
||||||
LazyColumn {
|
|
||||||
items(items = appStateManager.latestOpenedRepositoriesPaths) { repo ->
|
|
||||||
val repoDirName = repo.dirName
|
|
||||||
val repoDirPath = repo.dirPath
|
|
||||||
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
TextButton(
|
|
||||||
onClick = {
|
|
||||||
tabViewModel.openRepository(repo)
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = repoDirName,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
color = MaterialTheme.colors.primary,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = repoDirPath,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
modifier = Modifier.padding(start = 4.dp),
|
|
||||||
color = MaterialTheme.colors.secondaryTextColor
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
@ -201,6 +99,136 @@ fun WelcomePage(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun HomeButtons(
|
||||||
|
newUpdate: Update?,
|
||||||
|
tabViewModel: TabViewModel,
|
||||||
|
onShowCloneView: () -> Unit,
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.padding(end = 32.dp),
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Gitnuro",
|
||||||
|
fontSize = 32.sp,
|
||||||
|
color = MaterialTheme.colors.primaryTextColor,
|
||||||
|
modifier = Modifier.padding(bottom = 16.dp),
|
||||||
|
)
|
||||||
|
|
||||||
|
ButtonTile(
|
||||||
|
modifier = Modifier.padding(bottom = 8.dp),
|
||||||
|
title = "Open a repository",
|
||||||
|
painter = painterResource("open.svg"),
|
||||||
|
onClick = { openRepositoryDialog(tabViewModel) })
|
||||||
|
|
||||||
|
ButtonTile(
|
||||||
|
modifier = Modifier.padding(bottom = 8.dp),
|
||||||
|
title = "Clone a repository",
|
||||||
|
painter = painterResource("download.svg"),
|
||||||
|
onClick = onShowCloneView
|
||||||
|
)
|
||||||
|
|
||||||
|
ButtonTile(
|
||||||
|
modifier = Modifier.padding(bottom = 8.dp),
|
||||||
|
title = "Start a local repository",
|
||||||
|
painter = painterResource("open.svg"),
|
||||||
|
onClick = {
|
||||||
|
val dir = openDirectoryDialog()
|
||||||
|
if (dir != null) tabViewModel.initLocalRepository(dir)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "About Gitnuro",
|
||||||
|
fontSize = 18.sp,
|
||||||
|
color = MaterialTheme.colors.primaryTextColor,
|
||||||
|
modifier = Modifier.padding(top = 16.dp, bottom = 8.dp),
|
||||||
|
)
|
||||||
|
|
||||||
|
IconTextButton(
|
||||||
|
title = "Source code",
|
||||||
|
painter = painterResource("code.svg"),
|
||||||
|
onClick = {
|
||||||
|
Desktop.getDesktop().browse(URI("https://github.com/JetpackDuba/Gitnuro"))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
IconTextButton(
|
||||||
|
title = "Report a bug",
|
||||||
|
painter = painterResource("bug.svg"),
|
||||||
|
onClick = {
|
||||||
|
Desktop.getDesktop().browse(URI("https://github.com/JetpackDuba/Gitnuro/issues"))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(newUpdate != null) {
|
||||||
|
IconTextButton(
|
||||||
|
title = "New update ${newUpdate.appVersion} available ",
|
||||||
|
painter = painterResource("grade.svg"),
|
||||||
|
iconColor = MaterialTheme.colors.secondary,
|
||||||
|
onClick = {
|
||||||
|
Desktop.getDesktop().browse(URI(newUpdate.downloadUrl))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RecentRepositories(appStateManager: AppStateManager, tabViewModel: TabViewModel) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 32.dp),
|
||||||
|
) {
|
||||||
|
val latestOpenedRepositoriesPaths = appStateManager.latestOpenedRepositoriesPaths
|
||||||
|
Text(
|
||||||
|
text = "Recent",
|
||||||
|
fontSize = 18.sp,
|
||||||
|
modifier = Modifier.padding(top = 48.dp, bottom = 8.dp),
|
||||||
|
color = MaterialTheme.colors.primaryTextColor,
|
||||||
|
)
|
||||||
|
|
||||||
|
if(latestOpenedRepositoriesPaths.isEmpty()) {
|
||||||
|
Text(
|
||||||
|
"Nothing to see here, open a repository first!",
|
||||||
|
color = MaterialTheme.colors.secondaryTextColor,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
modifier = Modifier.padding(top = 16.dp)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LazyColumn {
|
||||||
|
items(items = latestOpenedRepositoriesPaths) { repo ->
|
||||||
|
val repoDirName = repo.dirName
|
||||||
|
val repoDirPath = repo.dirPath
|
||||||
|
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
tabViewModel.openRepository(repo)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = repoDirName,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = MaterialTheme.colors.primary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = repoDirPath,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
|
color = MaterialTheme.colors.secondaryTextColor
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ButtonTile(
|
fun ButtonTile(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user