Hiding scroll buttons on small screens. Fixed channel count on overview.

This commit is contained in:
ThePendulum 2020-06-28 03:58:16 +02:00
parent 4bf4183a2a
commit 087d349cec
5 changed files with 58 additions and 20 deletions

View File

@ -52,6 +52,22 @@
v-if="entity.children.length > 0" v-if="entity.children.length > 0"
class="children-container" class="children-container"
> >
<div
v-if="expanded"
class="expand noselect"
@click="expanded = !expanded"
>
<Icon
v-show="expanded"
icon="arrow-up3"
/>
<Icon
v-show="!expanded"
icon="arrow-down3"
/>
</div>
<div <div
class="scroll-container" class="scroll-container"
:class="{ expanded }" :class="{ expanded }"
@ -83,7 +99,7 @@
</div> </div>
<div <div
v-if="(scrollable && entity.children.length > 1) || expanded" v-if="scrollable || expanded"
class="expand noselect" class="expand noselect"
@click="expanded = !expanded" @click="expanded = !expanded"
> >
@ -195,6 +211,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'theme';
.info { .info {
height: 2.5rem; height: 2.5rem;
display: flex; display: flex;
@ -202,6 +220,7 @@ export default {
padding: 1rem; padding: 1rem;
background: var(--profile); background: var(--profile);
border-bottom: solid 1px var(--lighten-hint); border-bottom: solid 1px var(--lighten-hint);
box-shadow: inset 0 0 3px var(--darken);
.link { .link {
display: flex; display: flex;
@ -337,4 +356,10 @@ export default {
padding: 1rem 1rem 1rem 2rem; padding: 1rem 1rem 1rem 2rem;
background: linear-gradient(to left, var(--profile) 50%, transparent); background: linear-gradient(to left, var(--profile) 50%, transparent);
} }
@media(max-width: $breakpoint) {
.scroll {
display: none;
}
}
</style> </style>

View File

@ -6,7 +6,7 @@
> >
<input <input
v-model="query" v-model="query"
:placeholder="`Find ${siteCount} sites in ${networks.length} networks`" :placeholder="`Find ${channelCount} channels in ${entities.length} networks`"
class="query" class="query"
@input="searchEntities" @input="searchEntities"
> >
@ -35,9 +35,9 @@
class="entity-tiles" class="entity-tiles"
> >
<Entity <Entity
v-for="network in networks" v-for="entity in entities"
:key="`network-tile-${network.slug}`" :key="`entity-tile-${entity.slug}`"
:entity="network" :entity="entity"
/> />
</div> </div>
</div> </div>
@ -54,7 +54,7 @@ async function searchEntities() {
} }
async function mounted() { async function mounted() {
this.networks = await this.$store.dispatch('fetchEntities', { this.entities = await this.$store.dispatch('fetchEntities', {
type: 'network', type: 'network',
entitySlugs: [ entitySlugs: [
'bamvisions', 'bamvisions',
@ -62,11 +62,12 @@ async function mounted() {
'legalporno', 'legalporno',
], ],
}); });
this.pageTitle = 'Networks'; this.pageTitle = 'Networks';
} }
function siteCount() { function channelCount() {
return this.networks.map(network => network.children).flat().length; return this.entities.reduce((acc, entity) => acc + entity.childrenTotal, 0);
} }
export default { export default {
@ -77,12 +78,12 @@ export default {
return { return {
query: '', query: '',
pageTitle: null, pageTitle: null,
networks: [], entities: [],
searchResults: [], searchResults: [],
}; };
}, },
computed: { computed: {
siteCount, channelCount,
}, },
mounted, mounted,
methods: { methods: {

View File

@ -146,7 +146,7 @@ export default {
.tiles { .tiles {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(20rem, .33fr)); grid-template-columns: repeat(auto-fill, minmax(23rem, .33fr));
grid-gap: 1rem; grid-gap: 1rem;
margin: 0 0 1.5rem 0; margin: 0 0 1.5rem 0;
} }

View File

@ -122,8 +122,15 @@ function curateEntity(entity, parent, releases) {
children: [], children: [],
}; };
if (entity.children) {
if (entity.children.nodes) {
curatedEntity.children = entity.children.nodes.map(childEntity => curateEntity(childEntity, curatedEntity));
}
curatedEntity.childrenTotal = entity.children.totalCount;
}
if (entity.parent || parent) curatedEntity.parent = curateEntity(entity.parent || parent); if (entity.parent || parent) curatedEntity.parent = curateEntity(entity.parent || parent);
if (entity.children) curatedEntity.children = entity.children.map(childEntity => curateEntity(childEntity, curatedEntity));
if (releases) curatedEntity.releases = releases.map(release => curateRelease(release)); if (releases) curatedEntity.releases = releases.map(release => curateRelease(release));
return curatedEntity; return curatedEntity;

View File

@ -33,16 +33,18 @@ function initEntitiesActions(store, _router) {
slug slug
url url
hasLogo hasLogo
children: childEntities( children: childEntitiesConnection(
orderBy: [PRIORITY_DESC, NAME_ASC], orderBy: [PRIORITY_DESC, NAME_ASC],
) { ) {
id nodes {
name id
slug name
url slug
type url
priority type
hasLogo priority
hasLogo
}
} }
parent { parent {
id id
@ -147,6 +149,9 @@ function initEntitiesActions(store, _router) {
type type
url url
hasLogo hasLogo
children: childEntitiesConnection {
totalCount
}
} }
} }
`, { `, {