Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic frontend #3

Merged
merged 7 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,49 @@
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<title>Grillo</title>
<style>
:root {
--white:white;
--green:#00983a;
--grey:#343a40;
--grey-menu:grey;
--grey-menu-hover:lightgrey;
--space-h:10rem;
--space-v:1.4rem;
--space-v-border:0.5rem;
}
body {
margin:0;
font-family:sans-serif;
}
nav {
padding-top:var(--space-v);
padding-bottom:var(--space-v);
padding-left:var(--space-h);
padding-right:var(--space-h);
background-color:var(--grey);
color:var(--grey-menu);
border-bottom:var(--space-v-border) solid var(--green);
display:flex;
flex-direction:row;
gap:2rem;
}
.logo {
margin-bottom:-0.3rem;
}
main {
margin-top:var(--space-v);
margin-bottom:var(--space-v);
margin-left:var(--space-h);
margin-right:var(--space-h);
/* border:1px solid red; */
}
h1 {
font-weight:normal;
font-size:280%;
}
</style>
</head>
<body>
<div id="app"></div>
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"dayjs": "^1.11.10",
"pinia": "^2.1.7",
"vue": "^3.3.4",
"vue-router": "^4.2.5"
Expand Down
84 changes: 6 additions & 78 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,85 +1,13 @@
<script setup>
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
// import { RouterLink, RouterView } from 'vue-router'
import { HomePage } from './components'
import Icons from './components/icons/'
</script>

<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

<div class="wrapper">
<HelloWorld msg="You did it!" />

<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header>

<RouterView />
<HomePage/>
<!-- <Icons.IconDocumentation/> -->
</template>

<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}

.logo {
display: block;
margin: 0 auto 2rem;
}

nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}

nav a.router-link-exact-active {
color: var(--color-text);
}

nav a.router-link-exact-active:hover {
background-color: transparent;
}

nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
border: 0;
}

@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}

.logo {
margin: 0 2rem 0 0;
}

header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}

nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;

padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
</style>
Binary file added frontend/src/assets/weee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions frontend/src/components/Bookings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<script>
import dayjs from 'dayjs'
import dayOfYear from 'dayjs/plugin/dayOfYear'
import isToday from 'dayjs/plugin/isToday'
import isTomorrow from 'dayjs/plugin/isTomorrow'
dayjs.extend(dayOfYear)
dayjs.extend(isToday)
dayjs.extend(isTomorrow)
export default {
data() {
return {
bookings: [
{user:'Enrico Franciscono',time:dayjs()},
{user:'Donato Modugno',time:dayjs().add(2,'h')},
{user:'Francesco Basile',time:dayjs().add(1,'d')},
{user:'Cataldo Basile',time:dayjs().add(2,'d')},
],
}
},
methods: {
nextBookings() {
return this.bookings.filter(b => b.time.isAfter(dayjs()))
},
compare(date) {
if(date.isToday()) return 'today'
else if(date.isTomorrow()) return 'tomorrow'
else return 'on '+date.format('YYYY-MM-DD')
},
printDate(date) {
return date.format('DD/MM/YYYY')
},
printTime(date) {
return date.format('HH:mm')
},
},
computed: {
},
mounted() {
}
}
</script>

<template>
There are {{ nextBookings().length }} students that are going to lab:<br/>
<span v-for="b in nextBookings()">- {{ b.user+' '+compare(b.time)+' at '+printTime(b.time) }}<br/></span>
</template>
44 changes: 0 additions & 44 deletions frontend/src/components/HelloWorld.vue

This file was deleted.

37 changes: 37 additions & 0 deletions frontend/src/components/HomePage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script>
import Bookings from './Bookings.vue'
export default {
components: {
Bookings
},
data() {
return {
buttons: [
{title:'Bookings',route:'/inlab'},
{title:'Stat',route:'/stat'},
]
}
},
methods: {
alza() {
this.conta++
},
ciaone() {
alert('tanti saluti')
},
},
mounted() {
}
}
</script>

<template>
<nav>
<img src="../assets/weee.png" height="26" class="logo"/>
<span v-for="b in buttons">{{b.title}}</span>
</nav>
<main>
<h1>Grillo</h1>
<Bookings/>
</main>
</template>
88 changes: 0 additions & 88 deletions frontend/src/components/TheWelcome.vue

This file was deleted.

Loading