Skip to content

Commit

Permalink
💄 add base layout of social wall
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Mar 24, 2024
1 parent 16f0509 commit 5d61806
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 184 deletions.
21 changes: 21 additions & 0 deletions frontend/themes/apus/views/social-wall.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Apus - A social wall for conferences with additional features.
* Copyright (C) Marcus Fihlon and the individual contributors to Apus.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

:root {
font-family: Arial, Helvetica, sans-serif;
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</dependency>
<dependency>
<groupId>com.github.mvysny.kaributesting</groupId>
<artifactId>karibu-testing-v24</artifactId>
<artifactId>karibu-testing-v10-spring</artifactId>
<version>2.1.4</version>
<scope>test</scope>
</dependency>
Expand Down
32 changes: 32 additions & 0 deletions src/main/bundles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
This directory is automatically generated by Vaadin and contains the pre-compiled
frontend files/resources for your project (frontend development bundle).

It should be added to Version Control System and committed, so that other developers
do not have to compile it again.

Frontend development bundle is automatically updated when needed:
- an npm/pnpm package is added with @NpmPackage or directly into package.json
- CSS, JavaScript or TypeScript files are added with @CssImport, @JsModule or @JavaScript
- Vaadin add-on with front-end customizations is added
- Custom theme imports/assets added into 'theme.json' file
- Exported web component is added.

If your project development needs a hot deployment of the frontend changes,
you can switch Flow to use Vite development server (default in Vaadin 23.3 and earlier versions):
- set `vaadin.frontend.hotdeploy=true` in `application.properties`
- configure `vaadin-maven-plugin`:
```
<configuration>
<frontendHotdeploy>true</frontendHotdeploy>
</configuration>
```
- configure `jetty-maven-plugin`:
```
<configuration>
<systemProperties>
<vaadin.frontend.hotdeploy>true</vaadin.frontend.hotdeploy>
</systemProperties>
</configuration>
```

Read more [about Vaadin development mode](https://vaadin.com/docs/next/configuration/development-mode/#pre-compiled-front-end-bundle-for-faster-start-up).
Binary file added src/main/bundles/dev.bundle
Binary file not shown.
80 changes: 0 additions & 80 deletions src/main/java/swiss/fihlon/apus/MainView.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package swiss.fihlon.apus;

import java.io.Serializable;
package swiss.fihlon.apus.service;

import org.springframework.stereotype.Service;

import java.io.Serial;
import java.io.Serializable;

@Service
public final class GreetService implements Serializable {
public class ConferenceService implements Serializable {

public String greet(final String name) {
if (name == null || name.isEmpty()) {
return "Hello anonymous user";
} else {
return "Hello " + name;
}
}
@Serial
private static final long serialVersionUID = -5273205444017934528L;

}
43 changes: 43 additions & 0 deletions src/main/java/swiss/fihlon/apus/ui/view/SocialWall.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Apus - A social wall for conferences with additional features.
* Copyright (C) Marcus Fihlon and the individual contributors to Apus.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package swiss.fihlon.apus.ui.view;

import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;

import java.io.Serial;

@Route("")
@CssImport(value = "./themes/apus/views/social-wall.css")
public class SocialWall extends VerticalLayout {

@Serial
private static final long serialVersionUID = 7909437130138135008L;

public SocialWall() {
setId("social-wall");
add(new HorizontalLayout(
new Div("Agenda"),
new Div("Posts")));
add(new Div("Footer"));
}

}
92 changes: 0 additions & 92 deletions src/test/java/swiss/fihlon/apus/MainViewIT.java

This file was deleted.

70 changes: 70 additions & 0 deletions src/test/java/swiss/fihlon/apus/ui/KaribuTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Apus - A social wall for conferences with additional features.
* Copyright (C) Marcus Fihlon and the individual contributors to Apus.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package swiss.fihlon.apus.ui;

import com.github.mvysny.kaributesting.v10.MockVaadin;
import com.github.mvysny.kaributesting.v10.Routes;
import com.github.mvysny.kaributesting.v10.spring.MockSpringServlet;
import com.vaadin.flow.component.UI;
import kotlin.jvm.functions.Function0;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.annotation.DirtiesContext;

/**
* An abstract class which sets up Spring, Karibu-Testing and your app.
* The easiest way to use this class in your tests is having your test class to extend
* this class.
*/
@SpringBootTest
@DirtiesContext
public abstract class KaribuTest {

private static Routes routes;

@BeforeAll
public static void discoverRoutes() {
routes = new Routes().autoDiscoverViews("swiss.fihlon.apus");
}

@Autowired
private ApplicationContext applicationContext;

/**
* @see org.junit.jupiter.api.BeforeEach
*/
@BeforeEach
public void setup() {
final Function0<UI> uiFactory = UI::new;
final var servlet = new MockSpringServlet(routes, applicationContext, uiFactory);
MockVaadin.setup(uiFactory, servlet);
}

/**
* @see org.junit.jupiter.api.AfterEach
*/
@AfterEach
public void tearDown() {
MockVaadin.tearDown();
}

}
Loading

0 comments on commit 5d61806

Please sign in to comment.