@igea/oac_frontend 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "start": "cross-env NODE_ENV=production node src/index.js",
8
- "dev": "cross-env NODE_ENV=development nodemon src/index.js",
8
+ "dev": "cross-env NODE_ENV=development nodemon src/index.js --ext js,twig",
9
9
  "build:scss": "sass src/scss/main.scss src/public/css/style.css",
10
10
  "watch:scss": "sass --watch src/scss/main.scss:src/public/css/style.css"
11
11
  },
package/src/index.js CHANGED
@@ -12,6 +12,7 @@ i18n.configure({
12
12
  directory: path.join(__dirname, 'locales'),
13
13
  queryParameter: 'lang',
14
14
  autoReload: true,
15
+ objectNotation: true,
15
16
  updateFiles: false, // don't auto-create keys
16
17
  api: {
17
18
  '__': 't'
@@ -61,7 +62,7 @@ getPort.default({
61
62
 
62
63
 
63
64
  app.get(`/${serviceName}`, (req, res) => {
64
- res.render('base', { root: serviceName, title: 'Home Page', message: 'Hello from Twig!' });
65
+ res.render('login', { root: serviceName, title: 'Home Page', message: 'Hello from Twig!' });
65
66
  });
66
67
 
67
68
  // Start listing on the specified port
@@ -1,3 +1,10 @@
1
1
  {
2
- "welcome": "Welcome"
2
+ "welcome": "Welcome",
3
+ "login": {
4
+ "title": "Login",
5
+ "user": "Email or Username",
6
+ "password": "Password",
7
+ "sign_in": "Sign in",
8
+ "anonymous": "Anonymous"
9
+ }
3
10
  }
@@ -1,3 +1,10 @@
1
1
  {
2
- "welcome": "Benvenuto"
2
+ "welcome": "Benvenuto",
3
+ "login": {
4
+ "title": "Accesso",
5
+ "user": "Email or Nome utente",
6
+ "password": "Password",
7
+ "sign_in": "Accedi",
8
+ "anonymous": "Anonimo"
9
+ }
3
10
  }
@@ -0,0 +1,40 @@
1
+ .login-container {
2
+ background: white;
3
+ padding: 2rem;
4
+ border-radius: 6px;
5
+ box-shadow: 0 2px 8px rgba(0,0,0,0.2);
6
+ width: 300px;
7
+ margin: auto;
8
+ }
9
+ .login-container h2 {
10
+ margin-top: 0;
11
+ text-align: center;
12
+ }
13
+ .login-container label {
14
+ display: block;
15
+ margin: 0.5rem 0 0.25rem;
16
+ }
17
+ .login-container input[type="text"],
18
+ .login-container input[type="password"] {
19
+ width: 100%;
20
+ padding: 0.5rem;
21
+ box-sizing: border-box;
22
+ }
23
+ .login-container button {
24
+ width: 100%;
25
+ padding: 0.5rem;
26
+ margin-top: 1rem;
27
+ background: #3498db;
28
+ border: none;
29
+ color: white;
30
+ font-size: 1rem;
31
+ cursor: pointer;
32
+ border-radius: 4px;
33
+ }
34
+ .login-container button:hover {
35
+ background: #2980b9;
36
+ }
37
+ .login-message{
38
+ color: red;
39
+ font-size: 12px;
40
+ }
@@ -1,7 +1,52 @@
1
- body {
1
+ html, body {
2
2
  font-family: "Helvetica Neue", Arial, sans-serif;
3
3
  font-size: 1rem;
4
- color: red;
4
+ color: #3498db;
5
+ height: 100%;
6
+ }
7
+
8
+ .site-header {
9
+ background: #333;
10
+ color: white;
11
+ padding: 1em;
12
+ position: fixed;
13
+ top: 0;
14
+ left: 0;
15
+ width: 100%;
16
+ z-index: 100;
17
+ }
18
+
19
+ .site-footer {
20
+ background: #333;
21
+ color: white;
22
+ padding: 1em;
23
+ position: fixed;
24
+ bottom: 0;
25
+ left: 0;
26
+ width: 100%;
27
+ z-index: 100;
28
+ }
29
+
30
+ .container {
31
+ display: flex;
32
+ margin-top: 140px;
33
+ margin-bottom: 80px;
34
+ min-height: calc(100vh - 220px);
35
+ overflow: auto;
36
+ }
37
+
38
+ .sidebar {
39
+ width: 200px;
40
+ background: #f4f4f4;
41
+ padding: 1em;
42
+ flex-shrink: 0;
43
+ overflow-y: auto;
44
+ }
45
+
46
+ .main-content {
47
+ flex: 1;
48
+ padding: 1em;
49
+ overflow-y: auto;
5
50
  }
6
51
 
7
52
  /*# sourceMappingURL=style.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../../scss/_typography.scss","../../scss/_variables.scss"],"names":[],"mappings":"AAGA;EACI,aCFS;EDGT;EACA,OCNY","file":"style.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../../scss/_typography.scss","../../scss/_variables.scss"],"names":[],"mappings":"AAGA;EACI,aCFS;EDGT;EACA,OCNY;EDOZ;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EAAQ;EACR;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EAAW;EACX;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA","file":"style.css"}
@@ -1,8 +1,51 @@
1
1
  @use './variables' as *;
2
2
  @use './functions' as *;
3
3
 
4
- body {
4
+ html, body {
5
5
  font-family: $font-stack;
6
6
  font-size: rem(16);
7
7
  color: $primary-color;
8
- }
8
+ height: 100%
9
+ }
10
+
11
+ .site-header {
12
+ background: #333;
13
+ color: white;
14
+ padding: 1em;
15
+ position: fixed;
16
+ top: 0; left: 0;
17
+ width: 100%;
18
+ z-index: 100;
19
+ }
20
+
21
+ .site-footer {
22
+ background: #333;
23
+ color: white;
24
+ padding: 1em;
25
+ position: fixed;
26
+ bottom: 0; left: 0;
27
+ width: 100%;
28
+ z-index: 100;
29
+ }
30
+
31
+ .container {
32
+ display: flex;
33
+ margin-top: 140px;
34
+ margin-bottom: 80px;
35
+ min-height: calc(100vh - 220px);
36
+ overflow: auto;
37
+ }
38
+
39
+ .sidebar {
40
+ width: 200px;
41
+ background: #f4f4f4;
42
+ padding: 1em;
43
+ flex-shrink: 0;
44
+ overflow-y: auto;
45
+ }
46
+
47
+ .main-content {
48
+ flex: 1;
49
+ padding: 1em;
50
+ overflow-y: auto;
51
+ }
@@ -1,11 +1,28 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>{{ title }}</title>
5
- <link rel="stylesheet" type="text/css" href="/{{ root }}/css/style.css">
4
+ <meta charset="UTF-8">
5
+ <title>{{ t('welcome') ~ ': ' ~ title }}</title>
6
+ <link rel="stylesheet" href="/{{ root }}/css/style.css">
7
+ {% block extendHead %}{% endblock %}
6
8
  </head>
7
9
  <body>
8
- <h1>{{ message }}</h1>
9
- <h2>{{ t('welcome') }}</h2>
10
+ {% include 'header.twig' %}
11
+
12
+ <div class="container">
13
+
14
+ {% if showSidebar %}
15
+ <aside class="sidebar">
16
+ {% block sidebar %}
17
+ {% endblock %}
18
+ </aside>
19
+ {% endif %}
20
+
21
+ <main class="main-content">
22
+ {% block content %}{% endblock %}
23
+ </main>
24
+ </div>
25
+
26
+ {% include 'footer.twig' %}
10
27
  </body>
11
28
  </html>
@@ -0,0 +1,3 @@
1
+ <footer class="site-footer">
2
+ <p>&copy; {{ "now"|date("Y") }} IGEA: all rights reserved.</p>
3
+ </footer>
@@ -0,0 +1,7 @@
1
+ <header class="site-header">
2
+ <h1>OAC Site</h1>
3
+ <nav>
4
+ <a href="/">Home</a>
5
+ <a href="/about">About</a>
6
+ </nav>
7
+ </header>
@@ -0,0 +1,15 @@
1
+ {% extends "base.twig" %}
2
+
3
+ {% block sidebar %}
4
+ <ul>
5
+ <li><a href="#">Dashboard</a></li>
6
+ <li><a href="#">Settings</a></li>
7
+ <li><a href="#">Profile</a></li>
8
+ </ul>
9
+ {% endblock %}
10
+
11
+ {% block content %}
12
+ <h2>Home Page</h2>
13
+ <p>{{ mainContent }}</p>
14
+ {% endblock %}
15
+
@@ -0,0 +1,27 @@
1
+ {% set showSidebar = false %}
2
+
3
+ {% extends "base.twig" %}
4
+
5
+ {% block extendHead %}
6
+ <link rel="stylesheet" href="/{{ root }}/css/login.css">
7
+ {% endblock %}
8
+
9
+ {% block content %}
10
+
11
+ <div class="login-container">
12
+ <h2>{{ t('login.title') }}</h2>
13
+ <form action="/{{ root }}/login" method="POST">
14
+ <label for="username">{{ t('login.user') }}</label>
15
+ {% if invalidLogin %}
16
+ <span class=".login-message">Invalid credentials</span>
17
+ {% endif %}
18
+ <input type="text" id="username" name="username" required />
19
+ <label for="password">{{ t('login.password') }}</label>
20
+ <input type="password" id="password" name="password" required />
21
+ <button type="submit">{{ t('login.sign_in') }}</button>
22
+ <button type="submit" style="background: #ff0000">
23
+ {{ t('login.anonymous') }}</button>
24
+ </form>
25
+ </div>
26
+
27
+ {% endblock %}