2019-11-30 04:55:32 +00:00
|
|
|
<template>
|
2020-05-21 01:44:44 +00:00
|
|
|
<div class="networks">
|
2021-08-21 23:26:09 +00:00
|
|
|
<div class="content-inner">
|
2021-08-22 23:54:22 +00:00
|
|
|
<SearchBar
|
|
|
|
:placeholder="`Search ${channelCount} channels in ${entities.length} networks`"
|
|
|
|
:eager="true"
|
|
|
|
/>
|
2020-01-22 21:25:58 +00:00
|
|
|
|
2021-08-21 23:26:09 +00:00
|
|
|
<span
|
|
|
|
v-if="done && entities.length === 0"
|
|
|
|
class="empty"
|
|
|
|
>No results for "{{ $route.query.query }}"</span>
|
2020-02-15 00:10:32 +00:00
|
|
|
|
2021-08-21 23:26:09 +00:00
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
class="entity-tiles"
|
|
|
|
>
|
|
|
|
<Entity
|
|
|
|
v-for="entity in entities"
|
2021-08-22 23:54:22 +00:00
|
|
|
:key="entity.parent ? `entity-tile-${entity.parent.slug}-${entity.slug}` : `entity-tile-${entity.slug}`"
|
2021-08-21 23:26:09 +00:00
|
|
|
:entity="entity"
|
|
|
|
/>
|
|
|
|
</div>
|
2020-05-21 01:44:44 +00:00
|
|
|
</div>
|
2020-08-15 17:04:33 +00:00
|
|
|
|
|
|
|
<Footer />
|
2020-05-21 01:44:44 +00:00
|
|
|
</div>
|
2019-11-30 04:55:32 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-06-27 22:15:13 +00:00
|
|
|
import Entity from '../entities/tile.vue';
|
2021-08-21 23:26:09 +00:00
|
|
|
import SearchBar from '../search/bar.vue';
|
2020-02-15 00:10:32 +00:00
|
|
|
|
2021-08-21 23:26:09 +00:00
|
|
|
async function fetchEntities() {
|
|
|
|
if (this.$route.query.query) {
|
|
|
|
await this.searchEntities();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.done = false;
|
2019-11-30 04:55:32 +00:00
|
|
|
|
2020-06-28 01:58:16 +00:00
|
|
|
this.entities = await this.$store.dispatch('fetchEntities', {
|
2020-06-27 22:15:13 +00:00
|
|
|
type: 'network',
|
2020-07-02 02:04:28 +00:00
|
|
|
entitySlugs: [],
|
2020-06-27 22:15:13 +00:00
|
|
|
});
|
2020-06-28 01:58:16 +00:00
|
|
|
|
2021-08-21 23:26:09 +00:00
|
|
|
this.done = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function searchEntities() {
|
|
|
|
this.done = false;
|
|
|
|
|
|
|
|
this.entities = await this.$store.dispatch('searchEntities', {
|
|
|
|
query: this.$route.query.query,
|
|
|
|
limit: 20,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.done = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function mounted() {
|
|
|
|
this.pageTitle = 'Channels';
|
|
|
|
|
|
|
|
await this.fetchEntities();
|
2019-11-30 04:55:32 +00:00
|
|
|
}
|
|
|
|
|
2020-06-28 01:58:16 +00:00
|
|
|
function channelCount() {
|
|
|
|
return this.entities.reduce((acc, entity) => acc + entity.childrenTotal, 0);
|
2020-01-22 21:25:58 +00:00
|
|
|
}
|
|
|
|
|
2019-11-30 04:55:32 +00:00
|
|
|
export default {
|
2020-05-21 01:44:44 +00:00
|
|
|
components: {
|
2020-06-27 00:57:30 +00:00
|
|
|
Entity,
|
2021-08-21 23:26:09 +00:00
|
|
|
SearchBar,
|
2020-05-21 01:44:44 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-08-21 23:26:09 +00:00
|
|
|
done: false,
|
2020-05-21 01:44:44 +00:00
|
|
|
pageTitle: null,
|
2020-06-28 01:58:16 +00:00
|
|
|
entities: [],
|
2020-05-21 01:44:44 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2020-06-28 01:58:16 +00:00
|
|
|
channelCount,
|
2020-05-21 01:44:44 +00:00
|
|
|
},
|
2021-08-21 23:26:09 +00:00
|
|
|
watch: {
|
|
|
|
$route: fetchEntities,
|
|
|
|
},
|
2020-05-21 01:44:44 +00:00
|
|
|
mounted,
|
|
|
|
methods: {
|
2021-08-21 23:26:09 +00:00
|
|
|
fetchEntities,
|
2020-06-27 00:57:30 +00:00
|
|
|
searchEntities,
|
2020-05-21 01:44:44 +00:00
|
|
|
},
|
2019-11-30 04:55:32 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-01-06 04:19:38 +00:00
|
|
|
@import 'theme';
|
|
|
|
|
2020-01-31 01:01:30 +00:00
|
|
|
.networks {
|
2021-08-21 23:26:09 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content-inner {
|
|
|
|
padding: 0 1rem;
|
2020-01-31 01:01:30 +00:00
|
|
|
}
|
|
|
|
|
2020-01-22 21:25:58 +00:00
|
|
|
.search {
|
2021-08-21 22:40:22 +00:00
|
|
|
margin: 1rem 0 0 0;
|
2020-02-15 00:10:32 +00:00
|
|
|
}
|
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
.entity-tiles {
|
2019-11-30 04:55:32 +00:00
|
|
|
display: grid;
|
2020-07-02 02:04:28 +00:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
|
2021-02-03 01:59:39 +00:00
|
|
|
grid-gap: .5rem;
|
2020-01-31 01:01:30 +00:00
|
|
|
padding: 1rem 0;
|
2021-04-04 19:52:19 +00:00
|
|
|
|
|
|
|
.tile {
|
|
|
|
height: 6rem;
|
|
|
|
}
|
2019-11-30 04:55:32 +00:00
|
|
|
}
|
2020-01-06 04:19:38 +00:00
|
|
|
|
2021-08-21 23:26:09 +00:00
|
|
|
.empty {
|
|
|
|
display: block;
|
|
|
|
margin: 1rem 0;
|
|
|
|
color: var(--shadow);
|
|
|
|
font-size: 1.25rem;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
2020-07-05 02:10:35 +00:00
|
|
|
@media(max-width: $breakpoint2) {
|
|
|
|
.entity-tiles {
|
|
|
|
grid-gap: .5rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-02 23:28:22 +00:00
|
|
|
@media(max-width: $breakpoint0) {
|
|
|
|
.entity-tiles {
|
2020-01-06 04:19:38 +00:00
|
|
|
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
|
|
|
|
}
|
|
|
|
}
|
2019-11-30 04:55:32 +00:00
|
|
|
</style>
|