Grid position

This commit is contained in:
sheychen 2019-04-16 18:06:10 +02:00
parent df7dfb080d
commit ec779ab541
12 changed files with 89 additions and 48 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
<template lang="pug"> <template lang="pug">
.client .client(@scroll="onScroll")
.statues .statues
.header(v-if="notifications.length > 0") Accueil .header(v-if="notifications.length > 0") Accueil
.list(v-if="statues.length > 0" @scroll="onScroll") .list(v-if="statues.length > 0")
template(v-for="status in statues") template(v-for="status in statues")
status(v-if="showStatus(status)" :key="status.id" :status="status" :now="now" :showMedia="showMedia" @mark="onStatusMark") status(v-if="showStatus(status)" :key="status.id" :status="status" :now="now" :showMedia="showMedia" @mark="onStatusMark")
.status(v-show="loadingOlder") .status(v-show="loadingOlder")

View File

@ -1,10 +1,11 @@
<template lang="pug"> <template lang="pug">
.nextcloud-news(v-show="unreaded.length > 0 || !server || !token || !username") .nextcloud-news(v-show="showEmpty || unreaded.length > 0 || !server || !token || !username")
service-header service-header
template(#title) Nextcloud News template(#title) Nextcloud News
template(#settings) template(#settings)
setting-int(:id="'update'" :title="'Update interval'" :value="update" @change="setOptionCouple") setting-int(:id="'update'" :title="'Update interval'" :value="update" @change="setOptionCouple")
setting-int(:id="'buffer'" :title="'Buffer size'" :value="buffer" @change="setOptionCouple") setting-int(:id="'buffer'" :title="'Buffer size'" :value="buffer" @change="setOptionCouple")
setting-boolean(:id="'showEmpty'" :title="'Show empty'" :value="showEmpty" @change="setOptionCouple")
.unreaded .unreaded
.news(v-for="news in unreaded") .news(v-for="news in unreaded")
a(:href="news.url" target="_blank") a(:href="news.url" target="_blank")
@ -53,6 +54,10 @@ export default {
update: { update: {
default: 5 * 60, //5min default: 5 * 60, //5min
type: Number type: Number
},
showEmpty: {
default: false,
type: Boolean
} }
}, },
data() { data() {

View File

@ -8,7 +8,7 @@ export default {
mixins: [ reactiveProp ], mixins: [ reactiveProp ],
mounted () { mounted () {
this.renderChart(this.chartData, { this.renderChart(this.chartData, {
responsive: true, responsive: true, maintainAspectRatio: false,
legend: { legend: {
labels: { labels: {
fontColor: "white" fontColor: "white"

View File

@ -23,7 +23,7 @@
| {{ city.main.temp }}°C {{ city.main.humidity }}% | {{ city.main.temp }}°C {{ city.main.humidity }}%
input.weather(v-show="showAdd" placeholder="city id" @keyup.enter="addCity(parseInt($event.target.value))") input.weather(v-show="showAdd" placeholder="city id" @keyup.enter="addCity(parseInt($event.target.value))")
.forecast .forecast
chart(v-if="forecast" :chartData="forecastChart") chart.chart(v-if="forecast" :chartData="forecastChart")
.service-loader(v-else) .service-loader(v-else)
.service-loader(v-else) .service-loader(v-else)
</template> </template>

View File

@ -25,7 +25,11 @@
<input v-show="showManager" v-model="newService" @keyup.enter="addService"> <input v-show="showManager" v-model="newService" @keyup.enter="addService">
</div> </div>
<div id="services"> <div id="services">
<component v-for="(service, key) in services" :is="service.type" :key="key" v-bind="service.options" @error="addError" @save="setService(key, $event)"></component> <component
v-for="(service, key) in services" :is="service.type" :key="key"
v-bind="service.options" @error="addError" @save="setService(key, $event)"
:style="gridPos(key, service.position)"
/>
</div> </div>
</div> </div>
<script src="main.js"></script> <script src="main.js"></script>

View File

@ -2,6 +2,7 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: Verdana, Geneva, sans-serif; font-family: Verdana, Geneva, sans-serif;
scrollbar-width: thin;
} }
body { body {
@ -51,16 +52,18 @@ a {
#services { #services {
height: 100vh; height: 100vh;
overflow: hidden; display: -ms-grid;
display: -webkit-box; display: grid;
display: -ms-flexbox; grid-gap: .2em;
display: flex; -ms-grid-columns: (minmax(0, 1fr))[8];
grid-template-columns: repeat(8, minmax(0, 1fr));
-ms-grid-rows: (minmax(0, 1fr))[4];
grid-template-rows: repeat(4, minmax(0, 1fr));
justify-items: stretch;
} }
#services > div { #services > div {
-webkit-box-flex: 1; overflow: auto;
-ms-flex: 1;
flex: 1;
} }
#services > div .service-header .title, #services > div .service-header .settings { #services > div .service-header .title, #services > div .service-header .settings {
@ -117,20 +120,21 @@ a {
} }
} }
.mastodon {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.mastodon .client { .mastodon .client {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
height: 100vh;
overflow: hidden;
}
.mastodon .client .list {
height: 100%;
overflow-y: auto; overflow-y: auto;
min-height: -webkit-min-content;
min-height: -moz-min-content;
min-height: min-content;
} }
.mastodon .client .list > div { .mastodon .client .list > div {
@ -228,7 +232,6 @@ a {
-webkit-box-direction: normal; -webkit-box-direction: normal;
-ms-flex-direction: column; -ms-flex-direction: column;
flex-direction: column; flex-direction: column;
max-width: 30%;
} }
.openweathermap .list { .openweathermap .list {
@ -253,9 +256,12 @@ a {
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-flex: 1; -ms-flex: 1;
flex: 1; flex: 1;
max-height: 100%; overflow: hidden;
overflow-y: auto; }
overflow-x: hidden;
.openweathermap .forecast .chart {
position: relative;
height: 100%;
} }
.openweathermap .weather { .openweathermap .weather {
@ -308,9 +314,9 @@ a {
grid-area: remove; grid-area: remove;
-ms-grid-column-align: right; -ms-grid-column-align: right;
justify-self: right; justify-self: right;
-ms-flex-item-align: bottom; -ms-flex-item-align: end;
-ms-grid-row-align: bottom; -ms-grid-row-align: end;
align-self: bottom; align-self: end;
font-size: .8em; font-size: .8em;
} }
@ -324,6 +330,20 @@ a {
margin-top: -10px; margin-top: -10px;
} }
.nextcloud-news {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.nextcloud-news .unreaded {
overflow-y: auto;
}
.nextcloud-news .news { .nextcloud-news .news {
margin: 0.3em; margin: 0.3em;
background-color: #222; background-color: #222;

File diff suppressed because one or more lines are too long

10
main.js
View File

@ -33,7 +33,7 @@ var app = new Vue({
this.services.push({ this.services.push({
type: this.newService, type: this.newService,
options: {} options: {}, position: {}
}) })
this.newService = '' this.newService = ''
this.showManager = false this.showManager = false
@ -41,7 +41,7 @@ var app = new Vue({
}, },
setService(id, options) { setService(id, options) {
this.$set(this.services, id, { this.$set(this.services, id, {
type: this.services[id].type, ...this.services[id],
options: options options: options
}) })
this.saveServices() this.saveServices()
@ -53,6 +53,12 @@ var app = new Vue({
saveServices() { saveServices() {
localStorage.setItem(servicesStorage, JSON.stringify(this.services)) localStorage.setItem(servicesStorage, JSON.stringify(this.services))
this.$forceUpdate() this.$forceUpdate()
},
gridPos(id, position = {}) {
return {
"grid-row": `${position.x || 1} / span ${position.h || 2}`,
"grid-column": `${position.y || id*2+1} / span ${position.w || 2}`
}
} }
} }
}) })

View File

@ -18,6 +18,7 @@ $foreColor: #eee
margin: 0 margin: 0
padding: 0 padding: 0
font-family: Verdana, Geneva, sans-serif font-family: Verdana, Geneva, sans-serif
scrollbar-width: thin
body body
background-color: $backColor background-color: $backColor
@ -53,10 +54,13 @@ a
#services #services
height: 100vh height: 100vh
overflow: hidden display: grid
display: flex grid-gap: .2em
grid-template-columns: repeat(8, minmax(0, 1fr))
grid-template-rows: repeat(4, minmax(0, 1fr))
justify-items: stretch
& > div & > div
flex: 1 overflow: auto
.service-header .service-header
.title, .settings .title, .settings
@include tile @include tile
@ -85,14 +89,12 @@ a
transform: rotate(360deg) transform: rotate(360deg)
.mastodon .mastodon
display: flex
flex-direction: column
.client .client
display: flex display: flex
height: 100vh overflow-y: auto
overflow: hidden
.list .list
height: 100%
overflow-y: auto
min-height: min-content
& > div & > div
@include tile @include tile
.statues .statues
@ -151,7 +153,6 @@ a
.openweathermap .openweathermap
display: flex display: flex
flex-direction: column flex-direction: column
max-width: 30%
.list .list
display: flex display: flex
flex-wrap: wrap flex-wrap: wrap
@ -160,9 +161,10 @@ a
@include tile @include tile
.forecast .forecast
flex: 1 flex: 1
max-height: 100% overflow: hidden
overflow-y: auto .chart
overflow-x: hidden position: relative
height: 100%
.weather .weather
min-width: 17em min-width: 17em
border: 1px solid $tileColor border: 1px solid $tileColor
@ -188,7 +190,7 @@ a
.remove .remove
grid-area: remove grid-area: remove
justify-self: right justify-self: right
align-self: bottom align-self: end
font-size: .8em font-size: .8em
.ic .ic
overflow: hidden overflow: hidden
@ -198,6 +200,10 @@ a
margin-top: -10px margin-top: -10px
.nextcloud-news .nextcloud-news
display: flex
flex-direction: column
.unreaded
overflow-y: auto
.news .news
@include tile @include tile
.date .date