Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Feature/random voted talks (#30)
Browse files Browse the repository at this point in the history
* Update BE 23 config and css

* Added possibility to create random voted talks
  • Loading branch information
svenreimers authored Oct 1, 2023
1 parent 7d46fa2 commit b06a5ed
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cinema/src/main/resources/tweetwall.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 TweetWallFX
* Copyright (c) 2023 TweetWallFX
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 44 additions & 0 deletions cinema/src/main/resources/tweetwallConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@
"nodeSelector": "#scheduleNode"
}
},
{
"stepClassName": "org.tweetwallfx.conference.stepengine.steps.ShowTopRated",
"config": {
"layoutX": 35,
"layoutY": 140,
"topVotedType": "TODAY",
"stepDuration": 500
}
},
{
"stepClassName": "org.tweetwallfx.stepengine.steps.PauseStep",
"config": {
"unit": "SECONDS",
"amount": "15"
}
},
{
"stepClassName": "org.tweetwallfx.controls.steps.NodeFadeOutStep",
"config": {
"nodeSelector": "#topRatedToday"
}
},
{
"stepClassName": "org.tweetwallfx.conference.stepengine.steps.ShowSchedule",
"config": {
Expand Down Expand Up @@ -84,6 +106,28 @@
"config": {
"nodeSelector": "#scheduleNode"
}
},
{
"stepClassName": "org.tweetwallfx.conference.stepengine.steps.ShowTopRated",
"config": {
"layoutX": 35,
"layoutY": 140,
"topVotedType": "WEEK",
"stepDuration": 500
}
},
{
"stepClassName": "org.tweetwallfx.stepengine.steps.PauseStep",
"config": {
"unit": "SECONDS",
"amount": "15"
}
},
{
"stepClassName": "org.tweetwallfx.controls.steps.NodeFadeOutStep",
"config": {
"nodeSelector": "#topRatedWeek"
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.random.RandomGenerator;
import java.util.stream.Collectors;

import jakarta.ws.rs.core.GenericType;
Expand Down Expand Up @@ -177,19 +179,39 @@ public Optional<RatingClient> getRatingClient() {

@Override
public List<RatedTalk> getRatedTalks(final String conferenceDay) {
return getVotingResults().entrySet().stream()
if (Boolean.getBoolean("org.tweetwallfx.conference.randomTalks")) {
System.out.println("######## randomizedRatedTalksPerDay");
return randomizedRatedTalks();
} else {
return getVotingResults().entrySet().stream()
.filter(e -> e.getKey().dayId().equals(conferenceDay))
.map(Map.Entry::getValue)
.findFirst()
.orElse(List.of());
}
}

@Override
public List<RatedTalk> getRatedTalksOverall() {
return getVotingResults().entrySet().stream()
if (Boolean.getBoolean("org.tweetwallfx.conference.randomTalks")) {
System.out.println("######## randomizedRatedTalksWeek");
return randomizedRatedTalks();
} else {
return getVotingResults().entrySet().stream()
.map(Map.Entry::getValue)
.flatMap(List::stream)
.toList();
}
}

private List<RatedTalk> randomizedRatedTalks() {
System.out.println("######## randomizedRatedTalks");
return RestCallHelper.readOptionalFrom(config.getEventBaseUri() + "talks", listOfMaps())
.orElse(List.of())
.stream()
.filter(talk -> RandomGenerator.getDefault().nextBoolean())
.map(this::convertTalkToRatedTalk)
.toList();
}

private Map<WeekDay, List<RatedTalk>> getVotingResults() {
Expand Down Expand Up @@ -228,6 +250,15 @@ private Map<WeekDay, List<RatedTalk>> convertTalkRatings(final Map<String, Objec
.toList()))));
}

private RatedTalk convertTalkToRatedTalk(final Map<String, Object> input) {
LOG.debug("Converting Talk to RatedTalk: {}", input);
return RatedTalkImpl.builder()
.withAverageRating(RandomGenerator.getDefault().nextDouble(5))
.withTotalRating(RandomGenerator.getDefault().nextInt(200))
.withTalk(convertTalk(input))
.build();
}

private RatedTalk convertRatedTalk(final Map<String, Object> input) {
LOG.debug("Converting to RatedTalk: {}", input);
return RatedTalkImpl.builder()
Expand Down
78 changes: 60 additions & 18 deletions exhibition/src/main/resources/tweetwall.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 TweetWallFX
* Copyright (c) 2023 TweetWallFX
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -45,6 +45,10 @@
.root {
-fx-font-family: 'System';
devoxx_gradient: linear-gradient(to bottom right, #e55630, #f68b1f);
devoxx_gradient_opaque: linear-gradient(to bottom right, rgba(229, 86, 48, 0.85) , rgba(246, 139, 31, 0.85));
devoxx_light_font: blanchedalmond;
devoxx_dark_font: #060b33;
devoxx_font_color: devoxx_light_font;
}

.text {
Expand All @@ -69,7 +73,7 @@
}

.wordle .bg-image {
-fx-opacity: 0.4;
/*-fx-opacity: 0.4;*/
}

.wordle .secondlogo {
Expand All @@ -85,13 +89,13 @@
/*visibility: hidden;*/
/* -fx-scale-x: 0.7;
-fx-scale-y: 0.7;*/
-fx-translate-x: +150;
-fx-translate-y: -150;
/*-fx-translate-x: +50;*/
/*-fx-translate-y: -50;*/
}

.wordle .tag {
/*-fx-font-family: "Calibri";*/
-fx-fill:blanchedalmond !important;
-fx-fill: white !important;
/* -fx-stroke: black;
-fx-stroke-width: 0.5; */
/*-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.7) , 6, 0.0 , 0 , 2 );*/
Expand Down Expand Up @@ -130,6 +134,7 @@
.tweetDisplay {
-fx-background-color: devoxx_gradient;
-fx-background-radius: 5;
/*-fx-background-insets: -5pt;*/
/* -fx-border-color: black;
-fx-border-style: solid;
-fx-border-width: 0pt 0pt 1pt 0pt;
Expand All @@ -146,48 +151,85 @@
}

.scheduleSession {
-fx-background-color: devoxx_gradient;
-fx-background-color: devoxx_gradient_opaque;
-fx-background-radius: 5;

-fx-hgap: 10pt;
-fx-vgap: 8pt;
-fx-alignment: top-left;
-fx-padding: 5pt;
/*-fx-effect: dropshadow(three-pass-box, #060b33, 10, 0, 2, 2);*/
-fx-opaque: 0.85;
-fx-grid-lines-visible: false;
}

.scheduleSession .room {
-fx-text-fill: #060b33;
-fx-text-fill: blanchedalmond;
-fx-font-weight: bold;
-fx-font-size: 14pt;
}

.scheduleSession > .sessionBottomPane > .titlePane > .title {
-fx-text-fill: #060b33;
-fx-font-size: 12pt;
.scheduleSession .times {
-fx-text-fill: blanchedalmond;
-fx-font-weight: normal;
-fx-font-size: 10pt;
}

.scheduleSession > .sessionBottomPane > .centerFlow .emojiFlow {
-fx-fill: blanchedalmond;
-fx-font-size: 15pt;
-fx-font-weight: bold;
}

.scheduleSession > .sessionTopPane > .speakerNames {
-fx-alignment: "top-right"
}

.scheduleSession > .sessionTopPane > .speakerNames > .speakerName {
-fx-text-fill: blanchedalmond;
-fx-font-size: 11pt;
}

.scheduleSession > .sessionTopPane > .speakerName {
.scheduleSession > .sessionTopPane > .speakerNames > .companyName {
-fx-text-fill: blanchedalmond;
/*-fx-font-size: 12pt;*/
-fx-font-size: 8pt;
}

.scheduleSession .favoriteGlyph {
-glyph-name: "HEART";
-glyph-size: 10pt;
-fx-fill: #060b33;
-fx-fill: blanchedalmond;
}

.scheduleSession .favoriteCount {
-fx-text-fill: #060b33;
-fx-text-fill: blanchedalmond;
-fx-font-size: 10pt;
}

.schedule > .title {
-fx-background-color: devoxx_gradient;
-fx-background-color: devoxx_gradient_opaque;
-fx-background-radius: 10;
-fx-text-fill: #060b33;
-fx-text-fill: blanchedalmond;
-fx-font-size: 20pt;
-fx-font-weight: bold;
}

.scheduleSession .sessionBottomPane .centerFlow {
-fx-spacing: 3pt;
}

.scheduleSession .sessionBottomPane .centerFlow .tagPane .tags {
-fx-hgap: 8pt;
-fx-vgap: 4pt;
-fx-padding: 0 0 0 4;
}

.scheduleSession .sessionBottomPane .centerFlow .tagPane .tags .tagLabel {
-fx-font-size: 10pt;
-fx-text-fill: blanchedalmond;
/* -fx-text-fill: #e55630; */
/* -fx-background-color: black; */
-fx-border-color: blanchedalmond;
-fx-border-radius: 5 0 5 0;
-fw-border-with: 2pt;
-fx-background-radius: 5 5 5 5;
-fx-border-insets: -1 -4 -1 -4;
}
38 changes: 0 additions & 38 deletions exhibition/src/main/resources/tweetwallConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,6 @@
"config": {
"nodeSelector": "#scheduleNode"
}
},
{
"stepClassName": "org.tweetwallfx.controls.steps.FadeInCloudStep",
"config": {
"layoutX": 1100,
"layoutY": 300,
"width": 800,
"height": 600,
"stepDuration": 30000
}
},
{
"stepClassName": "org.tweetwallfx.stepengine.steps.NextTweetStep"
},
{
"stepClassName": "org.tweetwallfx.controls.steps.AddTweetToCloudStep"
},
{
"stepClassName": "org.tweetwallfx.controls.steps.CloudToCloudStep"
},
{
"stepClassName": "org.tweetwallfx.controls.steps.CloudToTweetStep"
},
{
"stepClassName": "org.tweetwallfx.stepengine.steps.PauseStep",
"config": {
"amount": 5,
"unit": "SECONDS"
}
},
{
"stepClassName": "org.tweetwallfx.controls.steps.TweetToCloudStep"
},
{
"stepClassName": "org.tweetwallfx.controls.steps.CloudFadeOutStep"
},
{
"stepClassName": "org.tweetwallfx.controls.steps.ImageMosaicStep"
}
]
}
Expand Down
Loading

0 comments on commit b06a5ed

Please sign in to comment.