Skip to content

Commit

Permalink
♻️ complete refactor and redesign to fit perfectly on FullHD monitors
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Mar 26, 2024
1 parent d372c0c commit b1a17d8
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

:root {
font-family: Arial, Helvetica, sans-serif;
}

#social-wall {
#conference-view {
background-color: #007e89;
position: absolute;
top: 0;
left: 0;
width: 1300px;
height: 1080px;
overflow: clip;
}

#social-wall-container {
width: 100%;
#conference-view h2 {
font-size: 30px;
margin: 10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#posts {
.message-view {
background-color: #84ddee;
border-radius: 5px;
width: 500px;
display: inline-block;
width: 580px;
margin-left: 10px;
margin-bottom: 10px;
padding: 10px;
}
22 changes: 0 additions & 22 deletions frontend/themes/apus/views/next-session-view.css

This file was deleted.

22 changes: 0 additions & 22 deletions frontend/themes/apus/views/running-session-view.css

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#running-sessions {
.session-view {
background-color: #21ccdd;
border-radius: 5px;
display: inline-block;
width: 400px;
height: 174px;
margin-left: 10px;
margin-bottom: 10px;
padding: 10px;
overflow: clip;
font-size: 16px;
}

.session-view h3 {
font-size: 18px;
margin-bottom: 10px;
}
22 changes: 0 additions & 22 deletions frontend/themes/apus/views/sessions-view.css

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#next-sessions {
#social-view {
background-color: #1aa3b1;
border-radius: 5px;
position: absolute;
top: 0;
left: 1300px;
width: 620px;
height: 1080px;
overflow: clip;
}

#social-view h2 {
font-size: 30px;
margin: 10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

.post-view {
border: 1px solid #007e89;
border-radius: 5px;
width: 100%;
:root {
background-color: #000000;
}

.post-view > div {
padding: 5px;
:root, h3, a, a:visited {
color: #014f7a;
}

h2 {
color: #003861;
}

#social-wall-view {
position: absolute;
top: 0;
left: 0;
width: 1920px;
height: 1080px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package swiss.fihlon.apus.service;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.stereotype.Service;
import swiss.fihlon.apus.conference.Session;

Expand Down Expand Up @@ -72,8 +74,8 @@ public List<Session> getNextSessions() {

private List<Session> generateSampleData() {
final int sampleDataSize = 100;
final int sampleSessionParallel = 5;
final int sampleDuration = 5;
final int sampleSessionParallel = 15;
final int sampleDuration = 10;

final List<Session> sampleData = new ArrayList<>(sampleDataSize);

Expand All @@ -91,6 +93,8 @@ private List<Session> generateSampleData() {
final String id = UUID.randomUUID().toString();
final LocalDateTime endDate = startDate.plusMinutes(sampleDuration);
final String room = String.valueOf((char) ('A' + counter));
// final String random = RandomStringUtils.random(RandomUtils.nextInt(1, 150), "abcd efghi jklmn opqrst uvwxyz ");
// final String title = random + " Test Session #" + index;
final String title = "Test Session #" + index;
final String speaker = "Speaker #" + (counter + 1);
sampleData.add(new Session(id, startDate, endDate, room, title, speaker));
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/swiss/fihlon/apus/service/SocialService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package swiss.fihlon.apus.service;

import org.springframework.stereotype.Service;
import swiss.fihlon.apus.social.Post;
import swiss.fihlon.apus.social.Message;
import swiss.fihlon.apus.social.mastodon.MastodonAPI;

import java.util.Collections;
Expand All @@ -27,15 +27,15 @@
@Service
public final class SocialService {

private final List<Post> posts;
private final List<Message> messages;

public SocialService() {
final MastodonAPI mastodonAPI = new MastodonAPI("mastodon.social");
posts = mastodonAPI.getPosts("javaland");
messages = mastodonAPI.getMessages("javaland");
}

public List<Post> getPosts() {
return Collections.unmodifiableList(posts);
public List<Message> getMessages() {
return Collections.unmodifiableList(messages);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

import java.time.LocalDateTime;

public record Post(String id, LocalDateTime date, String author, String avatar, String html)
implements Comparable<Post> {
public record Message(String id, LocalDateTime date, String author, String avatar, String html)
implements Comparable<Message> {
@Override
public int compareTo(@NotNull final Post other) {
public int compareTo(@NotNull final Message other) {
return date.compareTo(other.date);
}
}
10 changes: 5 additions & 5 deletions src/main/java/swiss/fihlon/apus/social/mastodon/MastodonAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import social.bigbone.api.entity.Account;
import social.bigbone.api.entity.Status;
import social.bigbone.api.exception.BigBoneRequestException;
import swiss.fihlon.apus.social.Post;
import swiss.fihlon.apus.social.Message;

import java.time.Instant;
import java.time.LocalDateTime;
Expand All @@ -40,12 +40,12 @@ public MastodonAPI(@NotNull final String instance) {
this.instance = instance;
}

public List<Post> getPosts(@NotNull final String hashtag) {
public List<Message> getMessages(@NotNull final String hashtag) {
try {
final MastodonClient client = new MastodonClient.Builder(instance).build();
final Pageable<Status> statuses = client.timelines().getTagTimeline(hashtag, LOCAL_AND_REMOTE).execute();
return statuses.getPart().stream()
.map(this::convertToPost)
.map(this::convertToMessage)
.sorted()
.toList()
.reversed();
Expand All @@ -55,11 +55,11 @@ public List<Post> getPosts(@NotNull final String hashtag) {
return List.of();
}

private Post convertToPost(@NotNull final Status status) {
private Message convertToMessage(@NotNull final Status status) {
final Account account = status.getAccount();
final Instant instant = status.getCreatedAt().mostPreciseInstantOrNull();
final LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return new Post(
return new Message(
status.getId(),
date,
account.getDisplayName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
package swiss.fihlon.apus.ui.view;

import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H2;
import org.jetbrains.annotations.NotNull;
import swiss.fihlon.apus.conference.Session;
import swiss.fihlon.apus.service.ConferenceService;

@CssImport(value = "./themes/apus/views/next-sessions-view.css")
public class NextSessionsView extends VerticalLayout {
@CssImport(value = "./themes/apus/views/conference-view.css")
public final class ConferenceView extends Div {

public NextSessionsView(@NotNull final ConferenceService conferenceService) {
final HorizontalLayout nextSessions = new HorizontalLayout();
for (final Session session : conferenceService.getNextSessions()) {
nextSessions.add(new NextSessionView(session));
public ConferenceView(@NotNull final ConferenceService conferenceService) {
setId("conference-view");
final var sessions = conferenceService.getRunningSessions();
add(new H2(String.format("Agenda (%d)", sessions.size())));
final var sessionContainer = new Div();
for (final Session session : sessions) {
sessionContainer.add(new SessionView(session));
}
setId("next-sessions");
add(new H3("Next Sessions"), nextSessions);
add(sessionContainer);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.html.Div;
import org.jetbrains.annotations.NotNull;
import swiss.fihlon.apus.social.Post;
import swiss.fihlon.apus.social.Message;

@CssImport(value = "./themes/apus/views/post-view.css")
public final class PostView extends Div {
@CssImport(value = "./themes/apus/views/message-view.css")
public final class MessageView extends Div {

public PostView(@NotNull final Post post) {
addClassName("post-view");
add(new Html("<div>" + post.html() + "</div>"));
public MessageView(@NotNull final Message message) {
addClassName("message-view");
add(new Html("<div>" + message.html() + "</div>"));
}

}
39 changes: 0 additions & 39 deletions src/main/java/swiss/fihlon/apus/ui/view/NextSessionView.java

This file was deleted.

Loading

0 comments on commit b1a17d8

Please sign in to comment.