traxxx/assets/components/networks/network.vue

302 lines
6.8 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 && networks.length === 0 }"
>
<div
v-show="sites.length > 0 || networks.length > 0"
class="sidebar"
:class="{ expanded }"
>
<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"
:class="{ expanded }"
/>
<Network
v-for="childNetwork in networks"
:key="`network-${childNetwork.id}`"
:network="childNetwork"
/>
<Network
v-if="network.parent"
:network="network.parent"
class="parent"
/>
</div>
<template v-if="sites.length > 0 || networks.length > 0">
<span
v-show="!expanded"
class="expand expand-sidebar noselect"
@click="expanded = true"
><Icon icon="arrow-right3" /></span>
<span
v-show="expanded"
class="expand expand-sidebar noselect"
@click="expanded = false"
><Icon icon="arrow-left3" /></span>
</template>
<div
class="header"
:class="{ hideable: sites.length > 0 || networks.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">
<template v-if="sites.length > 0 || networks.length > 0">
<span
v-show="expanded"
class="expand collapse-header noselect"
@click="expanded = false"
><Icon icon="arrow-up3" /></span>
<Sites
:sites="sites"
:class="{ expanded }"
2020-01-24 22:36:06 +00:00
class="compact"
/>
<span
v-show="!expanded"
class="expand expand-header noselect"
@click="expanded = true"
><Icon icon="arrow-down3" /></span>
<span
v-show="expanded"
class="expand expand-header noselect"
@click="expanded = false"
><Icon icon="arrow-up3" /></span>
</template>
<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';
import Network from '../tile/network.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.networks = this.network.networks;
this.sites = this.network.sites
.filter(site => !site.independent);
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,
Network,
},
data() {
return {
network: null,
sites: [],
networks: [],
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 1rem 1rem .5rem;
2020-01-05 01:50:55 +00:00
}
.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;
.title {
display: flex;
justify-content: center;
border-bottom: solid 1px $highlight-hint;
}
&.expanded {
width: calc(100% - 25rem);
.logo {
max-width: 18rem;
}
}
}
.logo {
width: 100%;
max-height: 8rem;
display: flex;
justify-content: center;
object-fit: contain;
box-sizing: border-box;
padding: 1rem;
filter: $logo-highlight;
}
.parent {
display: inline-block;
height: 3rem;
}
.header {
width: 100%;
display: flex;
flex-direction: column;
align-items: 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;
max-height: 3rem;
padding: .5rem;
}
}
2020-01-24 22:36:06 +00:00
.sites.compact {
display: none;
2020-01-05 02:02:02 +00:00
background: $profile;
2020-01-24 22:36:06 +00:00
grid-row: 1;
2020-01-05 01:50:55 +00:00
}
2020-01-24 22:36:06 +00:00
.collapse-header {
2020-01-05 01:50:55 +00:00
display: none;
}
@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-header,
.collapse-header {
display: flex;
}
.expand-sidebar,
.collapse-sidebar {
display: none;
}
.network {
flex-direction: column;
}
.sidebar {
display: none;
height: auto;
width: 100%;
overflow: hidden;
}
}
</style>