-
-
Notifications
You must be signed in to change notification settings - Fork 136
Coop Tab UI Updates #3445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Coop Tab UI Updates #3445
Changes from all commits
7fe111e
e56e3b2
c914d48
f9c32ef
540c382
c5ffa5e
40c029e
917033d
e81b1f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.faforever.client.coop; | ||
|
|
||
| public enum CoopFaction { | ||
| UEF, CYBRAN, AEON, SERAPHIM, CUSTOM | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import com.faforever.client.config.CacheNames; | ||
| import com.faforever.client.domain.api.CoopMission; | ||
| import com.faforever.client.domain.api.CoopResult; | ||
| import com.faforever.client.domain.api.CoopScenario; | ||
| import com.faforever.client.mapstruct.CoopMapper; | ||
| import com.faforever.commons.api.dto.Game; | ||
| import com.faforever.commons.api.dto.GamePlayerStats; | ||
|
|
@@ -39,6 +40,14 @@ public Flux<CoopMission> getMissions() { | |
| return fafApiAccessor.getMany(navigator).map(coopMapper::map).cache(); | ||
| } | ||
|
|
||
| @Cacheable(value = CacheNames.COOP_SCENARIOS, sync = true) | ||
| public Flux<CoopScenario> getScenarios() { | ||
| ElideNavigatorOnCollection<com.faforever.commons.api.dto.CoopScenario> navigator = ElideNavigator.of( | ||
| com.faforever.commons.api.dto.CoopScenario.class).collection().addInclude("maps").pageSize(1000); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The max page size in the api is now 100 so 1000 won't do anything. Also instead of specifying the include here it should be specified in the type map in the fafApiAccessor. GetMany also handles the page size |
||
| return fafApiAccessor.getMany(navigator).map(coopMapper::map).cache(); | ||
| } | ||
|
|
||
|
|
||
| @Cacheable(value = CacheNames.COOP_LEADERBOARD, sync = true) | ||
| public Flux<CoopResult> getLeaderboard(CoopMission mission, int numberOfPlayers) { | ||
| Condition<?> filterCondition = qBuilder().intNum("mission").eq(mission.id()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.faforever.client.coop; | ||
|
|
||
| public enum CoopType { | ||
| SC, SCFA, CUSTOM | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.faforever.client.domain.api; | ||
|
|
||
| import com.faforever.client.coop.CoopFaction; | ||
|
|
||
| public record CoopCategory( | ||
| String categoryName, | ||
| CoopFaction coopCategory | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable naming here is a bit confusing. What exactly is the category? |
||
| ) {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| package com.faforever.client.domain.api; | ||
|
|
||
| import com.faforever.client.coop.CoopCategory; | ||
|
|
||
| import com.faforever.client.coop.CoopFaction; | ||
| import java.net.URL; | ||
|
|
||
| public record CoopMission( | ||
| Integer id, | ||
| String name, | ||
| String description, | ||
| int version, | ||
| CoopCategory category, | ||
| URL downloadUrl, | ||
| URL thumbnailUrlSmall, | ||
| URL thumbnailUrlLarge, | ||
| String mapFolderName | ||
| ) {} | ||
| ) { | ||
| public String concatName() { | ||
| return name + " - V" + version; | ||
| } | ||
|
Comment on lines
+16
to
+18
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this method be moved to the controller? |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.faforever.client.domain.api; | ||
|
|
||
| import com.faforever.client.coop.CoopFaction; | ||
| import com.faforever.client.coop.CoopType; | ||
| import java.util.List; | ||
|
|
||
| public record CoopScenario ( | ||
| Integer id, | ||
| String name, | ||
| String description, | ||
| Integer order, | ||
| CoopFaction faction, | ||
| CoopType type, | ||
| List<CoopMission> maps | ||
| ) { | ||
| public CoopScenario { | ||
| maps = maps == null ? List.of() : List.copyOf(maps); | ||
| } | ||
|
Comment on lines
+16
to
+18
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should make sure to not pass in null for the maps |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,13 @@ | |
|
|
||
| import com.faforever.client.domain.api.CoopMission; | ||
| import com.faforever.client.domain.api.CoopResult; | ||
| import com.faforever.client.domain.api.CoopScenario; | ||
| import org.mapstruct.InheritInverseConfiguration; | ||
| import org.mapstruct.Mapper; | ||
| import org.mapstruct.Mapping; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Mapper(uses = {ReplayMapper.class}, config = MapperConfiguration.class) | ||
| public interface CoopMapper { | ||
|
|
||
|
|
@@ -15,6 +18,12 @@ public interface CoopMapper { | |
| @InheritInverseConfiguration | ||
| com.faforever.commons.api.dto.CoopMission map(CoopMission bean); | ||
|
|
||
| @Mapping(target = ".", source = "dto") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this annotation is necessary since there is only one parameter |
||
| CoopScenario map(com.faforever.commons.api.dto.CoopScenario dto); | ||
|
|
||
| @InheritInverseConfiguration | ||
| com.faforever.commons.api.dto.CoopScenario map(CoopScenario bean); | ||
|
|
||
| @Mapping(target = "replay", source = "dto.game") | ||
| @Mapping(target = "ranking", source = "ranking") | ||
| @Mapping(target = ".", source = "dto") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the platformService.showDocument for opening a browser