traxxx/assets/components/networks/network.vue

294 lines
5.9 KiB
Vue
Raw Normal View History

<template>
<div
v-if="network"
class="content"
>
2020-01-02 23:59:02 +00:00
<FilterBar :fetch-releases="fetchNetwork" />
<div
class="network"
:class="{ nosites: sites.length === 0 }"
>
<div
v-show="sites.length > 0"
class="sidebar"
>
<a
v-tooltip.bottom="`Go to ${network.url}`"
:href="network.url"
target="_blank"
rel="noopener noreferrer"
class="title"
>
<img
:src="`/img/logos/${network.slug}/network.png`"
class="logo"
>
</a>
<p
v-if="network.description"
class="description"
>{{ network.description }}</p>
<Sites
v-if="sites.length"
:sites="sites"
/>
</div>
<div
class="header"
:class="{ hideable: sites.length > 0 }"
>
<a
v-tooltip.bottom="`Go to ${network.url}`"
:href="network.url"
target="_blank"
rel="noopener noreferrer"
class="title"
>
<img
:src="`/img/logos/${network.slug}/network.png`"
class="logo"
>
</a>
</div>
<div class="content-inner">
<span
v-show="expanded"
class="expand collapse-sites noselect"
@click="expanded = false"
><Icon icon="arrow-up3" /></span>
<Sites
v-if="sites.length"
:sites="sites"
class="compact"
:class="{ expanded }"
/>
<span
v-show="!expanded"
class="expand expand-sites noselect"
@click="expanded = true"
><Icon icon="arrow-down3" /></span>
<span
v-show="expanded"
class="expand expand-sites noselect"
@click="expanded = false"
><Icon icon="arrow-up3" /></span>
<Releases :releases="releases" />
</div>
</div>
</div>
</template>
<script>
import FilterBar from '../header/filter-bar.vue';
import Releases from '../releases/releases.vue';
import Sites from '../sites/sites.vue';
2020-01-02 23:59:02 +00:00
async function fetchNetwork() {
this.network = await this.$store.dispatch('fetchNetworks', this.$route.params.networkSlug);
if (this.network.studios) {
this.studios = this.network.studios.map(studio => ({
...studio,
network: this.network,
}));
}
this.sites = this.network.sites
.filter(site => !site.independent)
// .concat(this.studios)
.sort(({ name: nameA }, { name: nameB }) => nameA.localeCompare(nameB));
this.releases = this.network.releases;
2020-01-02 23:59:02 +00:00
}
async function mounted() {
await this.fetchNetwork();
this.pageTitle = this.network.name;
}
export default {
components: {
FilterBar,
Releases,
Sites,
},
data() {
return {
network: null,
sites: [],
studios: [],
2020-01-02 23:59:02 +00:00
releases: [],
pageTitle: null,
2020-01-05 01:50:55 +00:00
expanded: false,
};
},
mounted,
methods: {
2020-01-02 23:59:02 +00:00
fetchNetwork,
},
};
</script>
<style lang="scss" scoped>
@import 'theme';
.network {
display: flex;
flex-direction: row;
flex-grow: 1;
justify-content: stretch;
overflow-y: auto;
&.nosites {
flex-direction: column;
}
}
2020-01-05 01:50:55 +00:00
.content-inner {
padding: 0;
}
.releases {
padding: 1rem;
}
.sidebar {
2020-01-05 02:02:02 +00:00
background: $profile;
height: 100%;
width: 18rem;
display: flex;
flex-direction: column;
flex-shrink: 0;
2020-01-05 01:50:55 +00:00
color: $text-contrast;
overflow: hidden;
}
.sidebar .title {
2020-01-05 02:02:02 +00:00
border-bottom: solid 1px $highlight-hint;
}
.logo {
width: 100%;
max-height: 8rem;
display: flex;
justify-content: center;
object-fit: contain;
box-sizing: border-box;
padding: 1rem;
filter: $logo-highlight;
}
.header {
width: 100%;
height: 3rem;
display: flex;
justify-content: center;
2020-01-09 00:59:30 +00:00
flex-shrink: 0;
border-bottom: solid 1px $shadow-hint;
background: $profile;
&.hideable {
display: none;
}
.logo {
max-width: 20rem;
height: 100%;
padding: .5rem;
}
}
.expand {
display: flex;
justify-content: center;
align-items: center;
padding: .5rem 0 0 0;
font-weight: bold;
font-size: .9rem;
cursor: pointer;
.icon {
margin: 0 .5rem;
}
}
.expand-sites {
color: $shadow;
2020-01-05 01:50:55 +00:00
display: none;
.icon {
fill: $shadow;
}
&:hover {
color: $shadow-strong;
.icon {
fill: $shadow-strong;
}
}
}
.collapse-sites {
2020-01-05 02:02:02 +00:00
background: $profile;
color: $highlight;
.icon {
fill: $highlight;
}
&:hover {
color: $text-contrast;
.icon {
fill: $text-contrast;
}
}
2020-01-05 01:50:55 +00:00
}
.sites.compact {
2020-01-05 01:50:55 +00:00
display: none;
2020-01-05 02:02:02 +00:00
background: $profile;
grid-row: 1;
2020-01-05 01:50:55 +00:00
}
@media(max-width: $breakpoint3) {
.header,
.header.hideable {
display: flex;
}
.sites.compact {
display: flex;
2020-01-05 01:50:55 +00:00
&.expanded {
display: grid;
}
}
.expand-sites {
display: flex;
}
.network {
flex-direction: column;
}
.sidebar {
display: none;
height: auto;
width: 100%;
overflow: hidden;
}
}
</style>