traxxx/assets/components/releases/releases.vue

181 lines
3.3 KiB
Vue
Raw Normal View History

<template>
2020-05-17 23:22:56 +00:00
<div class="releases">
<h3
v-if="context"
class="heading"
><span class="range">{{ range }}</span> releases for '{{ context }}'</h3>
<Ellipsis v-if="!done" />
2020-05-17 23:22:56 +00:00
<ul
v-else-if="releases.length > 0"
2020-05-17 23:22:56 +00:00
:key="sfw"
class="nolist tiles"
>
2023-07-02 03:07:38 +00:00
<template v-for="(item, index) in items">
<li
v-if="item === 'campaign'"
:key="`campaign-${index}`"
class="campaign"
>
<Campaign
v-if="item === 'campaign'"
:entity="entity"
:min-ratio="0.75"
:max-ratio="1.25"
:allow-generic="true"
/>
</li>
<li
v-else
:key="`release-${item.id}`"
>
<SceneTile
:release="item"
:referer="referer"
:index="index"
:stash="stash"
@stash="isStashed => $emit('stash', isStashed)"
/>
</li>
</template>
2020-05-17 23:22:56 +00:00
</ul>
2020-05-17 23:22:56 +00:00
<span
v-else-if="releases.length === 0 && range !== 'all'"
2020-05-17 23:22:56 +00:00
class="empty"
>No {{ range }} releases</span>
2020-05-17 23:22:56 +00:00
<span
v-else-if="releases.length === 0"
class="empty"
>No recent or upcoming releases</span>
</div>
</template>
2023-07-02 03:07:38 +00:00
<script setup>
2023-07-02 03:13:40 +00:00
import config from 'config';
2023-07-02 03:07:38 +00:00
import { defineProps, defineEmits, computed } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';
import Campaign from '../campaigns/campaign.vue';
import Ellipsis from '../loading/ellipsis.vue';
import SceneTile from './scene-tile.vue';
2023-07-02 03:07:38 +00:00
const router = useRouter();
const store = useStore();
2023-07-02 03:07:38 +00:00
defineEmits(['stash']);
2023-07-02 03:07:38 +00:00
const props = defineProps({
releases: {
type: Array,
default: () => [],
},
entity: {
type: Object,
default: null,
},
context: {
type: String,
default: null,
},
done: {
type: Boolean,
default: true,
2020-05-17 23:22:56 +00:00
},
2023-07-02 03:07:38 +00:00
referer: {
type: String,
default: null,
2020-05-17 23:22:56 +00:00
},
2023-07-02 03:07:38 +00:00
stash: {
type: Object,
default: null,
2020-05-17 23:22:56 +00:00
},
2023-07-02 03:07:38 +00:00
});
const campaignIndex = computed(() => Math.floor(Math.random() * props.releases.length - 5) + 5);
2023-07-02 03:13:40 +00:00
const items = computed(() => props.releases.flatMap((release, index) => (config.campaigns.tiles && props.releases.length > 10 && index === campaignIndex.value ? ['campaign', release] : release)));
2023-07-02 03:07:38 +00:00
const range = computed(() => router.route?.params.range);
const sfw = computed(() => store.state.ui.sfw);
</script>
<style lang="scss" scoped>
@import 'breakpoints';
.heading {
padding: 0;
margin: 0 0 1rem 0;
.range {
text-transform: capitalize;
}
}
2020-06-28 02:22:19 +00:00
.releases {
flex-grow: 1;
2020-06-28 02:22:19 +00:00
border-top: solid 1px var(--crease);
&.embedded {
border: none;
.tiles {
padding: 0;
}
}
2020-06-28 02:22:19 +00:00
}
.tiles {
width: 100%;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
grid-gap: .5rem;
2020-06-27 02:50:13 +00:00
box-sizing: border-box;
padding: 1rem;
}
.empty {
2020-06-28 02:22:19 +00:00
display: inline-block;
2020-06-27 02:50:13 +00:00
padding: 1rem;
2020-03-23 00:43:49 +00:00
color: var(--shadow-strong);
font-weight: bold;
}
2023-07-02 03:07:38 +00:00
.campaign {
display: flex;
align-items: flex-start;
justify-content: center;
}
2021-10-30 23:00:12 +00:00
@media(max-width: $breakpoint-mega) {
.tiles {
grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}
}
@media(max-width: $breakpoint-kilo) {
.tiles {
2021-10-30 23:00:12 +00:00
grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr));
grid-gap: .5rem;
padding: .5rem;
}
}
2021-10-30 23:00:12 +00:00
@media(max-width: $breakpoint) {
.tiles {
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
}
@media(max-width: $breakpoint-micro) {
.tiles {
grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}
}
</style>