Skip to content

Commit d52befe

Browse files
committed
Added survey button to the new welcome screen
1 parent 8883c02 commit d52befe

File tree

2 files changed

+64
-43
lines changed

2 files changed

+64
-43
lines changed

app/src/processing/app/ui/PDEWelcome.kt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import androidx.compose.ui.Alignment
2323
import androidx.compose.ui.ExperimentalComposeUiApi
2424
import androidx.compose.ui.Modifier
2525
import androidx.compose.ui.draw.clip
26+
import androidx.compose.ui.draw.shadow
2627
import androidx.compose.ui.graphics.ImageBitmap
2728
import androidx.compose.ui.graphics.decodeToImageBitmap
2829
import androidx.compose.ui.graphics.painter.BitmapPainter
@@ -568,7 +569,7 @@ fun showWelcomeScreen(base: Base? = null) {
568569
unique = WelcomeScreen::class,
569570
fullWindowContent = true
570571
) {
571-
PDEWelcome(base)
572+
PDEWelcomeWithSurvey(base)
572573
}
573574
}
574575

@@ -594,16 +595,35 @@ fun languagesDropdown(showOptions: MutableState<Boolean>) {
594595
}
595596
}
596597

598+
@Composable
599+
fun PDEWelcomeWithSurvey(base: Base? = null) {
600+
Box {
601+
PDEWelcome(base)
602+
Column(
603+
modifier = Modifier
604+
.align(Alignment.BottomEnd)
605+
.padding(16.dp)
606+
.padding(bottom = 12.dp)
607+
.shadow(
608+
elevation = 5.dp,
609+
shape = RoundedCornerShape(12.dp)
610+
)
611+
) {
612+
SurveyInvitation()
613+
}
614+
}
615+
}
616+
597617
fun main(){
598618
application {
599619
PDEComposeWindow(titleKey = titleKey, size = size, fullWindowContent = true) {
600620
PDETheme(darkTheme = true) {
601-
PDEWelcome()
621+
PDEWelcomeWithSurvey()
602622
}
603623
}
604624
PDEComposeWindow(titleKey = titleKey, size = size, fullWindowContent = true) {
605625
PDETheme(darkTheme = false) {
606-
PDEWelcome()
626+
PDEWelcomeWithSurvey()
607627
}
608628
}
609629
}

app/src/processing/app/ui/WelcomeSurvey.kt

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import androidx.compose.foundation.background
55
import androidx.compose.foundation.clickable
66
import androidx.compose.foundation.layout.*
77
import androidx.compose.foundation.shape.RoundedCornerShape
8-
import androidx.compose.material.MaterialTheme
9-
import androidx.compose.material.Text
8+
import androidx.compose.material3.MaterialTheme
9+
import androidx.compose.material3.Text
10+
import androidx.compose.runtime.Composable
1011
import androidx.compose.ui.Alignment
1112
import androidx.compose.ui.Modifier
1213
import androidx.compose.ui.awt.ComposePanel
@@ -26,46 +27,46 @@ fun addSurveyToWelcomeScreen(): JComponent {
2627
return ComposePanel().apply {
2728
setContent {
2829
PDETheme {
29-
val locale = LocalLocale.current
30-
Box {
31-
Row(
32-
modifier = Modifier
33-
.width(420.dp)
34-
.padding(16.dp)
35-
.padding(bottom = 12.dp)
36-
.clip(RoundedCornerShape(12.dp))
37-
.background(MaterialTheme.colors.surface)
38-
.clickable {
39-
Platform.openURL("https://survey.processing.org/")
40-
}
41-
.pointerHoverIcon(
42-
PointerIcon.Hand
43-
)
44-
) {
45-
Image(
46-
painter = painterResource("bird.svg"),
47-
contentDescription = locale["beta.logo"],
48-
modifier = Modifier
49-
.align(Alignment.CenterVertically)
50-
.padding(20.dp)
51-
.size(50.dp)
52-
53-
)
54-
Column(
55-
modifier = Modifier.padding(12.dp),
56-
) {
57-
Text(
58-
text = locale["welcome.survey.title"],
59-
style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold)
60-
)
61-
Text(
62-
text = locale["welcome.survey.description"],
63-
)
30+
SurveyInvitation()
31+
}
32+
}
33+
}
34+
}
6435

65-
}
66-
}
67-
}
36+
@Composable
37+
fun SurveyInvitation() {
38+
val locale = LocalLocale.current
39+
Row(
40+
modifier = Modifier
41+
.width(420.dp)
42+
.clip(RoundedCornerShape(12.dp))
43+
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
44+
.clickable {
45+
Platform.openURL("https://survey.processing.org/")
6846
}
47+
.pointerHoverIcon(
48+
PointerIcon.Hand
49+
)
50+
) {
51+
Image(
52+
painter = painterResource("bird.svg"),
53+
contentDescription = locale["beta.logo"],
54+
modifier = Modifier
55+
.align(Alignment.CenterVertically)
56+
.padding(20.dp)
57+
.size(50.dp)
58+
)
59+
Column(
60+
modifier = Modifier.padding(12.dp),
61+
) {
62+
Text(
63+
text = locale["welcome.survey.title"],
64+
style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold)
65+
)
66+
Text(
67+
text = locale["welcome.survey.description"],
68+
style = MaterialTheme.typography.bodyMedium
69+
)
6970
}
7071
}
7172
}

0 commit comments

Comments
 (0)