This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-21 12:41:47 +01:00
parent e5441d55f1
commit 985cc3ca27
3 changed files with 48 additions and 10 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,7 @@
.DS_Store
public/index.html
# Logs
logs
*.log

View File

@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Vinlottis</title>
<meta name=viewport content="width=device-width,initial-scale=1">
<link href=/dist/css/vinlottis.37fd51a.css rel=stylesheet></head>
<body>
<div id=app></div>
<script type=text/javascript src=/dist/js/vinlottis.bundle.37fd51a.js></script></body>
</html>

46
src/ui/Wines.vue Normal file
View File

@@ -0,0 +1,46 @@
<template>
<div v-if="wines.length > 0">
<h3>Viner</h3>
<ol>
<li v-for="wine in wines">
<span v-if="wine.vivinoLink == '' || wine.vivinoLink == null">{{ wine.name }} - sett {{ wine.occurences }} ganger, {{ wine.rating }} i rating</span>
<a :href="wine.vivinoLink" v-if="wine.vivinoLink != '' && wine.vivinoLink != null">{{ wine.name }} - sett {{ wine.occurences }} ganger, {{ wine.rating }} i rating</li>
</ol>
</div>
</template>
<script>
export default {
data() {
return { wines: [] };
},
async mounted() {
let _response = await fetch("/api/wines/statistics");
let response = await _response.json();
response.sort();
response = response.filter(
wine => wine.name != null && wine.name != ""
).sort((a, b) =>
a.occurences > b.occurences ? -1 : 1
);
this.wines = response;
}
};
</script>
<style lang="scss" scoped>
h3 {
text-align:center;
}
div {
font-family: sans-serif;
display: inline-flex;
flex-direction: column;
}
a {
text-decoration: none;
color: orange;
}
</style>