Skip to content

Commit 3e46638

Browse files
authored
Survey indicator (#1348)
* Add welcome survey to Welcome screen Introduces a new Compose-based survey component to the Welcome screen via WelcomeSurvey.kt. Refactors Welcome.java to include the survey, and updates PDEButton in WelcomeToBeta.kt to support a modifier and proper content color handling. * Make survey card clickable and remove button Replaces the separate 'Take Survey' button with a clickable survey card that opens the survey URL. Adds pointer hover icon for better UX and updates the survey message text. * Localize welcome survey text and fix resource paths Added localized strings for the welcome survey title and description in PDE.properties. Updated WelcomeSurvey.kt to use these localized strings. Fixed resource loading paths in Locale.kt to correctly reference the 'languages' directory. * Add welcome survey translations to language files Introduced 'welcome.survey.title' and 'welcome.survey.description' keys to multiple language property files, providing localized text for the community survey prompt in Arabic, German, French, Italian, Japanese, Dutch, and Chinese. This improves internationalization support for the welcome survey feature.
1 parent 023bfd2 commit 3e46638

File tree

12 files changed

+161
-51
lines changed

12 files changed

+161
-51
lines changed

app/src/main/resources/languages/PDE.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ beta.window.title = Welcome to Beta
633633
beta.title = Thanks for testing this Processing Beta!
634634
beta.message = This preview release lets us gather feedback and fix issues before the final version. **Some features may not work as expected.** If you encounter problems, [please post on the forum](https://discourse.processing.org) or [open a GitHub issue](https://github.com/processing/processing4/issues).
635635
beta.button = Ok
636+
# Welcome
637+
welcome.survey.title=Take the Community Survey
638+
welcome.survey.description=Processing is free, open-source, and shaped by its community. Your answers help us focus on what matters most.
636639

637640
# ---------------------------------------
638641
# Color Chooser

app/src/main/resources/languages/PDE_ar.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ update_check = تحديث
550550
update_check.updates_available.core = يوجد نسخة جديدة من بروسسنج جاهزة للتحميل. \nهل تود زيارة الموقع الرسمي لتحميلها؟
551551
update_check.updates_available.contributions = يوجد تحديثات متوفرة لبعض المشاركات المثبتة. \nهل تريد الذهاب إلى مدير المشاركات الآن؟
552552

553+
# ---------------------------------------
554+
# Welcome
555+
welcome.survey.title=شارك في استطلاع المجتمع (بالإنجليزية)
556+
welcome.survey.description=Processing مجاني ومفتوح المصدر ومشكّل من قبل مجتمعه. إجاباتك تساعدنا على التركيز على ما يهم أكثر.
553557

554558
# ---------------------------------------
555559
# Color Chooser

app/src/main/resources/languages/PDE_de.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ update_check = Update
420420
update_check.updates_available.core = Eine neue Version von Processing ist verfügbar,\nsoll der Download-Bereich aufgerufen werden?
421421
update_check.updates_available.contributions = Es sind neue Updates von installierten Paketen verfügbar,\nsoll der Contribution Manager geöffnet werden?
422422

423+
# ---------------------------------------
424+
# Welcome
425+
welcome.survey.title=Nimm an der Community-Umfrage teil (auf Englisch)
426+
welcome.survey.description=Processing ist kostenlos, open source und von seiner Community geprägt. Deine Antworten helfen uns, die wichtigsten Schwerpunkte zu setzen.
423427

424428
# ---------------------------------------
425429
# Color Chooser

app/src/main/resources/languages/PDE_fr.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ update_check = Mise à jour
502502
update_check.updates_available.core = Une nouvelle version de Processing est disponible, \nVoulez-vous visiter la page de téléchargement de Processing?
503503
update_check.updates_available.contributions = Il y a des mises à jour disponibles pour certaines des contributions installées, \nVoulez-vous ouvrir le gestionnaire de contributions?
504504

505+
# Welcome
506+
welcome.survey.title=Participez au sondage de la communauté (en anglais)
507+
welcome.survey.description=Processing est gratuit, open source et façonné par sa communauté. Vos réponses nous aident à nous concentrer sur ce qui compte le plus.
505508

506509
# ---------------------------------------
507510
# Color Chooser

app/src/main/resources/languages/PDE_it.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,11 @@ update_check = Aggiorna
546546
update_check.updates_available.core = Una nuova versione di Processing è disponibile,\nvuoi visitare la pagina di download del sito di Processing?
547547
update_check.updates_available.contributions = Ci sono aggiornamenti disponibili per alcuni dei contributi installati,\nvorresti aprire il gestore dei contributi ora?
548548

549+
# ---------------------------------------
550+
# Welcome
551+
welcome.survey.title=Partecipa al sondaggio della community (in inglese)
552+
welcome.survey.description=Processing è gratuito, open-source e plasmato dalla sua community. Le tue risposte ci aiutano a capire ciò che conta di più.
553+
549554
# ---------------------------------------
550555
# Color Chooser
551556

app/src/main/resources/languages/PDE_ja.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,11 @@ update_check = 更新
550550
update_check.updates_available.core = 新しいバージョンのProcessingが利用可能です。\nProcessingのダウンロードページにアクセスしますか?
551551
update_check.updates_available.contributions = There are updates available for some of the installed contributions,\nwould you like to open the the Contribution Manager now?
552552

553+
# ---------------------------------------
554+
# Welcome
555+
welcome.survey.title=コミュニティ調査にご協力ください(英語)
556+
welcome.survey.description=Processing は無料でオープンソースであり、コミュニティによって形作られています。あなたの回答は、私たちが何に注力すべきかを知る助けになります。
557+
553558

554559
# ---------------------------------------
555560
# Color Chooser

app/src/main/resources/languages/PDE_nl.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ update_check = Update
315315
update_check.updates_available.core = Een nieuwe versie van Processing is beschikbaar,\nwilt u de Processing download pagina bezoeken?
316316
update_check.updates_available.contributions = Er zijn updates beschikbaar voor sommige van de door u geïnstalleerde bijdragen,\nwilt u nu de Bijdragen Manager openen?
317317

318+
# ---------------------------------------
319+
# Welcome
320+
welcome.survey.title=Doe mee aan de community-enquête (in het Engels)
321+
welcome.survey.description=Processing is gratis, open-source en gevormd door de community. Jouw antwoorden helpen ons te focussen op wat het belangrijkst is.
322+
318323
# ---------------------------------------
319324
# Beta
320325
beta.window.title = Welkom bij Beta

app/src/main/resources/languages/PDE_zh-CN.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,4 +313,9 @@ warn.delete.sketch_last = 为了确保您的文件安全,Processing 不支持
313313
warn.delete.file = 你确定要删除 "%s" 吗?
314314
warn.delete.sketch_file = 你确定要删除 “%s” 吗?
315315
warn.cannot_change_mode.title = 无法切换模式
316-
warn.cannot_change_mode.body = 无法切换模式,\n因为 “%s” 模式与当前模式不兼容。
316+
warn.cannot_change_mode.body = 无法切换模式,\n因为 “%s” 模式与当前模式不兼容。
317+
318+
# ---------------------------------------
319+
# Welcome
320+
welcome.survey.title=参与社区调查(英文)
321+
welcome.survey.description=Processing 是免费的、开源的,并由社区共同塑造。你的回答将帮助我们关注最重要的事项。

app/src/processing/app/ui/Welcome.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,18 @@
2121

2222
package processing.app.ui;
2323

24-
import java.awt.Color;
25-
import java.awt.EventQueue;
26-
import java.awt.Font;
24+
import processing.app.Base;
25+
import processing.app.Platform;
26+
import processing.app.Preferences;
27+
28+
import javax.swing.*;
29+
import javax.swing.border.EmptyBorder;
30+
import java.awt.*;
2731
import java.awt.event.ItemEvent;
2832
import java.io.File;
2933
import java.io.IOException;
3034

31-
import javax.swing.Box;
32-
import javax.swing.JButton;
33-
import javax.swing.JCheckBox;
34-
import javax.swing.JComponent;
35-
import javax.swing.border.EmptyBorder;
36-
37-
import processing.app.Base;
38-
import processing.app.Platform;
39-
import processing.app.Preferences;
35+
import static processing.app.ui.WelcomeSurveyKt.addSurveyToWelcomeScreen;
4036

4137

4238
public class Welcome {
@@ -47,6 +43,7 @@ public class Welcome {
4743
public Welcome(Base base) throws IOException {
4844
this.base = base;
4945

46+
var parent = Box.createVerticalBox();
5047
JComponent panel = Box.createHorizontalBox();
5148
//panel.setBackground(new Color(245, 245, 245));
5249
panel.setBackground(Color.WHITE);
@@ -71,11 +68,13 @@ public Welcome(Base base) throws IOException {
7168
button.setFont(Toolkit.getSansFont(14, Font.PLAIN));
7269
button.addActionListener(e -> view.handleClose());
7370
panel.add(button);
71+
parent.add(addSurveyToWelcomeScreen());
72+
parent.add(panel);
7473

7574
File indexFile = getIndexFile();
7675
if (indexFile == null) return; // giving up; error already printed
7776

78-
view = new WebFrame(getIndexFile(), 420, panel) {
77+
view = new WebFrame(getIndexFile(), 420, parent) {
7978
/*
8079
@Override
8180
public void handleSubmit(StringDict dict) {
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package processing.app.ui
2+
3+
import androidx.compose.foundation.Image
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.clickable
6+
import androidx.compose.foundation.layout.*
7+
import androidx.compose.foundation.shape.RoundedCornerShape
8+
import androidx.compose.material.MaterialTheme
9+
import androidx.compose.material.Text
10+
import androidx.compose.ui.Alignment
11+
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.awt.ComposePanel
13+
import androidx.compose.ui.draw.clip
14+
import androidx.compose.ui.input.pointer.PointerIcon
15+
import androidx.compose.ui.input.pointer.pointerHoverIcon
16+
import androidx.compose.ui.res.painterResource
17+
import androidx.compose.ui.text.font.FontWeight
18+
import androidx.compose.ui.unit.dp
19+
import processing.app.Platform
20+
import processing.app.ui.theme.LocalLocale
21+
import processing.app.ui.theme.ProcessingTheme
22+
import javax.swing.JComponent
23+
24+
25+
fun addSurveyToWelcomeScreen(): JComponent {
26+
return ComposePanel().apply {
27+
setContent {
28+
ProcessingTheme {
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+
)
64+
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)