Skip to content

Commit e9d2a61

Browse files
Apply baeldung formatter
1 parent 0143620 commit e9d2a61

File tree

8 files changed

+81
-78
lines changed

8 files changed

+81
-78
lines changed

hilla/src/main/frontend/index.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
<html>
77
<head>
8-
<meta charset="UTF-8" />
9-
<meta name="viewport" content="width=device-width, initial-scale=1" />
10-
<style>
11-
body, #outlet {
12-
height: 100vh;
13-
width: 100%;
14-
margin: 0;
15-
}
16-
</style>
17-
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
8+
<meta charset="UTF-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1" />
10+
<style>
11+
body, #outlet {
12+
height: 100vh;
13+
width: 100%;
14+
margin: 0;
15+
}
16+
</style>
17+
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
1818
</head>
1919
<body>
20-
<!-- This outlet div is where the views are rendered -->
21-
<div id="outlet"></div>
20+
<!-- This outlet div is where the views are rendered -->
21+
<div id="outlet"></div>
2222
</body>
2323
</html>
+31-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
import {useEffect} from "react";
2-
import {useSignal} from "@vaadin/hilla-react-signals";
3-
import {ContactService} from "Frontend/generated/endpoints";
4-
import {Grid, GridSortColumn} from "@vaadin/react-components";
5-
import {NavLink} from "react-router-dom";
6-
import Contact from "Frontend/generated/com/example/demo/Contact";
7-
import {ViewConfig} from "@vaadin/hilla-file-router/types.js";
1+
import { useEffect } from 'react';
2+
import { useSignal } from '@vaadin/hilla-react-signals';
3+
import { ContactService } from 'Frontend/generated/endpoints';
4+
import { Grid, GridSortColumn } from '@vaadin/react-components';
5+
import { NavLink } from 'react-router-dom';
6+
import Contact from 'Frontend/generated/com/example/demo/Contact';
7+
import { ViewConfig } from '@vaadin/hilla-file-router/types.js';
88

99
export const config: ViewConfig = {
10-
title: "Contact List",
11-
menu: {
12-
order: 1,
13-
}
14-
}
10+
title: 'Contact List',
11+
menu: {
12+
order: 1
13+
}
14+
};
1515

1616

1717
export default function Contacts() {
18-
const contacts = useSignal<Contact[]>([]);
18+
const contacts = useSignal<Contact[]>([]);
1919

20-
async function fetchContacts() {
21-
contacts.value = await ContactService.findAll();
22-
}
20+
async function fetchContacts() {
21+
contacts.value = await ContactService.findAll();
22+
}
2323

24-
useEffect(() => {
25-
fetchContacts();
26-
}, []);
24+
useEffect(() => {
25+
fetchContacts();
26+
}, []);
2727

28-
return (
29-
<div className="p-m flex flex-col gap-m">
30-
<h2>Contacts</h2>
31-
<Grid items={contacts.value}>
32-
<GridSortColumn path="name">
33-
{({item}) => <NavLink to={`contacts/${item.id}/edit`}>{item.name}</NavLink>}
34-
</GridSortColumn>
35-
<GridSortColumn path="email"/>
36-
<GridSortColumn path="phone"/>
37-
</Grid>
38-
</div>
39-
);
28+
return (
29+
<div className="p-m flex flex-col gap-m">
30+
<h2>Contacts</h2>
31+
<Grid items={contacts.value}>
32+
<GridSortColumn path="name">
33+
{({ item }) => <NavLink to={`contacts/${item.id}/edit`}>{item.name}</NavLink>}
34+
</GridSortColumn>
35+
<GridSortColumn path="email" />
36+
<GridSortColumn path="phone" />
37+
</Grid>
38+
</div>
39+
);
4040
}
+20-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import {createMenuItems} from "@vaadin/hilla-file-router/runtime.js";
2-
import {NavLink, Outlet} from "react-router-dom";
3-
import {Suspense} from "react";
1+
import { createMenuItems } from '@vaadin/hilla-file-router/runtime.js';
2+
import { NavLink, Outlet } from 'react-router-dom';
3+
import { Suspense } from 'react';
44

55
export default function MainLayout() {
66

7-
return (
8-
<div className="p-m h-full flex flex-col box-border">
9-
<header className="flex gap-m pb-m">
10-
<h1 className="text-l m-0">
11-
My Hilla App
12-
</h1>
13-
{createMenuItems().map(({to, title}) => (
14-
<NavLink to={to} key={to}>
15-
{title}
16-
</NavLink>
17-
))}
18-
</header>
19-
<Suspense>
20-
<Outlet/>
21-
</Suspense>
22-
</div>
23-
);
7+
return (
8+
<div className="p-m h-full flex flex-col box-border">
9+
<header className="flex gap-m pb-m">
10+
<h1 className="text-l m-0">
11+
My Hilla App
12+
</h1>
13+
{createMenuItems().map(({ to, title }) => (
14+
<NavLink to={to} key={to}>
15+
{title}
16+
</NavLink>
17+
))}
18+
</header>
19+
<Suspense>
20+
<Outlet />
21+
</Suspense>
22+
</div>
23+
);
2424
}
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import ContactModel from "Frontend/generated/com/example/demo/ContactModel";
2-
import {ContactService} from "Frontend/generated/endpoints";
3-
import {AutoCrud} from "@vaadin/hilla-react-crud";
1+
import ContactModel from 'Frontend/generated/com/example/demo/ContactModel';
2+
import { ContactService } from 'Frontend/generated/endpoints';
3+
import { AutoCrud } from '@vaadin/hilla-react-crud';
44

55
export default function AutoCrudView() {
6-
return <AutoCrud service={ContactService} model={ContactModel} className="h-full"/>
6+
return <AutoCrud service={ContactService} model={ContactModel} className="h-full" />;
77
}

hilla/src/main/java/com/example/demo/ContactRepository.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.springframework.data.jpa.repository.JpaRepository;
44
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
55

6-
public interface ContactRepository extends
7-
JpaRepository<Contact, Long>,
8-
JpaSpecificationExecutor<Contact> {
6+
public interface ContactRepository extends JpaRepository<Contact, Long>, JpaSpecificationExecutor<Contact> {
7+
98
}

hilla/src/main/java/com/example/demo/ContactService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public List<Contact> findAll() {
1515
}
1616

1717
public Contact findById(Long id) {
18-
return getRepository().findById(id).orElseThrow();
18+
return getRepository().findById(id)
19+
.orElseThrow();
1920
}
2021
}

hilla/src/main/java/com/example/demo/DemoApplication.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
import com.vaadin.flow.component.page.AppShellConfigurator;
44
import com.vaadin.flow.theme.Theme;
5+
56
import org.springframework.boot.SpringApplication;
67
import org.springframework.boot.autoconfigure.SpringBootApplication;
78

89
@SpringBootApplication
910
@Theme("hilla")
1011
public class DemoApplication implements AppShellConfigurator {
1112

12-
public static void main(String[] args) {
13-
SpringApplication.run(DemoApplication.class, args);
14-
}
13+
public static void main(String[] args) {
14+
SpringApplication.run(DemoApplication.class, args);
15+
}
1516

1617
}

hilla/src/main/java/com/example/demo/DemoData.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.example.demo;
22

3-
import com.vaadin.open.App;
43
import org.springframework.boot.ApplicationArguments;
54
import org.springframework.boot.ApplicationRunner;
65
import org.springframework.stereotype.Component;
@@ -16,12 +15,15 @@ public DemoData(ContactRepository contactRepository) {
1615

1716
@Override
1817
public void run(ApplicationArguments args) {
19-
String[] firstNames = {"John", "Jane", "Alice", "Bob", "Carol", "David", "Eve", "Frank", "Grace", "Hank", "Ivy", "Jack", "Kate", "Luke", "Mary", "Ned", "Olga", "Paul", "Rose", "Sam"};
20-
String[] lastNames = {"Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson"};
18+
String[] firstNames = { "John", "Jane", "Alice", "Bob", "Carol", "David", "Eve", "Frank", "Grace", "Hank", "Ivy", "Jack", "Kate", "Luke", "Mary", "Ned",
19+
"Olga", "Paul", "Rose", "Sam" };
20+
String[] lastNames = { "Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas",
21+
"Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson" };
2122

2223
for (int i = 0; i < 50; i++) {
2324
String name = firstNames[(int) (Math.random() * firstNames.length)] + " " + lastNames[(int) (Math.random() * lastNames.length)];
24-
String email = name.replaceAll(" ", ".").toLowerCase() + "@example.com";
25+
String email = name.replaceAll(" ", ".")
26+
.toLowerCase() + "@example.com";
2527
String phone = "+1-555-" + (int) (Math.random() * 1000) + "-" + (int) (Math.random() * 10000);
2628
contactRepository.save(new Contact(name, email, phone));
2729
}

0 commit comments

Comments
 (0)