2022-07-31 12:33:10 -06:00
|
|
|
<template>
|
2022-08-02 15:00:04 -06:00
|
|
|
<!-- TODO add masonry later -->
|
|
|
|
|
<div class="container-fluid px-md-5 pt-4">
|
2022-08-03 16:31:59 -06:00
|
|
|
<div class="masonry-frame">
|
2022-08-04 10:38:52 -06:00
|
|
|
<div v-for="k in keeps" :key="k.id" @click="viewKeep(k)" class="py-2">
|
2022-08-02 15:00:04 -06:00
|
|
|
<!-- <img src="../assets/img/404.svg" alt=""> TODO use this as default img in DB-->
|
|
|
|
|
<KeepTile :keep="k" />
|
|
|
|
|
</div>
|
2022-07-31 12:33:10 -06:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-08-03 10:20:05 -06:00
|
|
|
<KeepModal :keep="activeKeep" />
|
2022-07-31 12:33:10 -06:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-08-02 15:00:04 -06:00
|
|
|
import { computed, onMounted, ref } from 'vue'
|
|
|
|
|
import { AppState } from '../AppState.js'
|
|
|
|
|
import { logger } from '../utils/Logger.js'
|
|
|
|
|
import { keepsService } from '../services/KeepsService.js'
|
2022-08-03 10:20:05 -06:00
|
|
|
import { Modal } from 'bootstrap'
|
2022-07-31 12:33:10 -06:00
|
|
|
export default {
|
2022-08-02 15:00:04 -06:00
|
|
|
name: 'Home',
|
|
|
|
|
setup() {
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
2022-08-03 16:31:59 -06:00
|
|
|
await keepsService.getAll()
|
2022-08-03 10:20:05 -06:00
|
|
|
// document.getElementById('keepModal').
|
|
|
|
|
|
2022-08-02 15:00:04 -06:00
|
|
|
} catch (error) {
|
|
|
|
|
logger.error(error)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return {
|
2022-08-03 10:20:05 -06:00
|
|
|
keeps: computed(() => AppState.keeps),
|
|
|
|
|
activeKeep: computed(() => AppState.activeKeep),
|
|
|
|
|
|
|
|
|
|
viewKeep(keep) {
|
|
|
|
|
AppState.activeKeep = keep
|
|
|
|
|
Modal.getOrCreateInstance(document.getElementById('keepModal')).show()
|
|
|
|
|
}
|
2022-08-02 15:00:04 -06:00
|
|
|
}
|
|
|
|
|
}
|
2022-07-31 12:33:10 -06:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.home{
|
|
|
|
|
display: grid;
|
|
|
|
|
height: 80vh;
|
|
|
|
|
place-content: center;
|
|
|
|
|
text-align: center;
|
|
|
|
|
user-select: none;
|
|
|
|
|
.home-card{
|
|
|
|
|
width: 50vw;
|
|
|
|
|
> img{
|
|
|
|
|
height: 200px;
|
|
|
|
|
max-width: 200px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
object-position: center;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-03 16:31:59 -06:00
|
|
|
|
|
|
|
|
.masonry-frame {
|
|
|
|
|
columns: 6;
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
break-inside: avoid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 991.98px) {
|
|
|
|
|
.masonry-frame {
|
|
|
|
|
columns: 4
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 767.98px) {
|
|
|
|
|
.masonry-frame {
|
|
|
|
|
columns: 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-02 15:00:04 -06:00
|
|
|
</style>
|