Using navigation for toggling album. Using album for tag photos. Fixed portrait albums.

This commit is contained in:
DebaucheryLibrarian 2021-02-03 19:21:47 +01:00
parent e3dc989798
commit 11ad5f8bad
8 changed files with 146 additions and 47 deletions

View File

@ -319,15 +319,14 @@
v-if="showAlbum" v-if="showAlbum"
:items="actor.photos" :items="actor.photos"
:title="actor.name" :title="actor.name"
class="portrait" :portrait="true"
@close="showAlbum = false" @close="$router.go(-1)"
/> />
<div class="actor-content"> <div class="actor-content">
<Scroll <Scroll
v-if="actor.avatar || (actor.photos && actor.photos.length > 0)" v-if="actor.avatar || (actor.photos && actor.photos.length > 0)"
v-slot="scroll" v-slot="scroll"
:expandable="false"
> >
<Photos <Photos
:actor="actor" :actor="actor"
@ -339,7 +338,7 @@
<button <button
v-if="actor.photos && actor.photos.length > 2" v-if="actor.photos && actor.photos.length > 2"
class="album-toggle" class="album-toggle"
@click="showAlbum = true" @click="$router.push({ hash: '#album' })"
><Icon icon="grid3" />View album</button> ><Icon icon="grid3" />View album</button>
<FilterBar <FilterBar
@ -398,6 +397,16 @@ function sfw() {
return this.$store.state.ui.sfw; return this.$store.state.ui.sfw;
} }
function showAlbum() {
return this.actor.photos?.length > 0 && this.$route.hash === '#album';
}
async function watchRoute(to, from) {
if (to.params.pageNumber !== from.params.pageNumber) {
await this.fetchActor();
}
}
async function mounted() { async function mounted() {
await this.fetchActor(); await this.fetchActor();
@ -423,7 +432,6 @@ export default {
actor: null, actor: null,
releases: null, releases: null,
totalCount: 0, totalCount: 0,
showAlbum: false,
limit: 20, limit: 20,
pageTitle: null, pageTitle: null,
bioExpanded: false, bioExpanded: false,
@ -432,9 +440,10 @@ export default {
}, },
computed: { computed: {
sfw, sfw,
showAlbum,
}, },
watch: { watch: {
$route: fetchActor, $route: watchRoute,
'$store.state.ui.tagFilter': fetchActor, '$store.state.ui.tagFilter': fetchActor,
}, },
mounted, mounted,
@ -710,30 +719,6 @@ export default {
border-bottom: solid 1px var(--shadow-hint); border-bottom: solid 1px var(--shadow-hint);
} }
.album-toggle {
height: fit-content;
display: inline-flex;
align-items: center;
justify-content: center;
padding: .5rem 1rem;
border: none;
border-bottom: solid 1px var(--shadow-hint);
color: var(--shadow);
background: var(--background-dim);
font-size: 1rem;
font-weight: bold;
.icon {
fill: var(--shadow);
margin: -.1rem .5rem 0 0;
}
&:hover {
background: var(--shadow-hint);
cursor: pointer;
}
}
@media(max-width: $breakpoint4) { @media(max-width: $breakpoint4) {
.descriptions-container { .descriptions-container {
display: none; display: none;

View File

@ -11,22 +11,31 @@
/> />
</div> </div>
<div class="album-items"> <div
class="album-items"
:class="{ portrait }"
>
<div <div
v-for="item in items" v-for="item in items"
:key="item.id" :key="item.id"
class="item-container" class="item-container"
> >
<a <a
:href="`/media/${item.path}`" :href="`${path}/${item.path}`"
class="item-link" class="item-link"
target="_blank" target="_blank"
> >
<img <img
:src="`/media/${item.thumbnail}`" :src="`${path}/${item.thumbnail}`"
:title="item.comment"
loading="lazy" loading="lazy"
class="item image" class="item image"
> >
<span
v-if="comments && item.comment"
class="item-comment"
>{{ item.comment }}</span>
</a> </a>
</div> </div>
</div> </div>
@ -45,6 +54,18 @@ export default {
type: String, type: String,
default: null, default: null,
}, },
path: {
type: String,
default: '/media',
},
portrait: {
type: Boolean,
default: false,
},
comments: {
type: Boolean,
default: true,
},
}, },
emits: ['close'], emits: ['close'],
}; };
@ -82,6 +103,7 @@ export default {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
text-align: center; text-align: center;
text-transform: capitalize;
} }
.close { .close {
@ -105,6 +127,10 @@ export default {
padding: 1rem; padding: 1rem;
margin: auto 0; margin: auto 0;
overflow-y: auto; overflow-y: auto;
&.portrait {
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
} }
.item-container { .item-container {
@ -114,14 +140,50 @@ export default {
} }
.item-link { .item-link {
position: relative;
height: 100%; height: 100%;
width: 100%;
margin: 0 0 1rem 0; margin: 0 0 1rem 0;
overflow: hidden;
&:hover .item-comment {
transform: translateY(0);
}
} }
.item { .item {
width: 100%; width: 100%;
} }
.item-comment {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
box-sizing: border-box;
padding: .5rem;
color: var(--text-light);
background: var(--shadow);
font-size: .9rem;
text-shadow: 0 0 3px var(--shadow);
white-space: normal;
line-height: 1.25;
transform: translateY(100%);
transition: transform .25s ease;
}
@media(max-width: $breakpoint-giga) {
.album-items.portrait {
grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
}
@media(max-width: $breakpoint-mega) {
.album-items.portrait {
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
}
@media(max-width: $breakpoint-kilo) { @media(max-width: $breakpoint-kilo) {
.album-items { .album-items {
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
@ -134,12 +196,6 @@ export default {
} }
} }
@media(max-width: $breakpoint-small) {
.album-items.portrait {
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
}
}
@media(max-width: $breakpoint-micro) { @media(max-width: $breakpoint-micro) {
.album-items { .album-items {
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));

View File

@ -79,6 +79,7 @@
<Scroll <Scroll
v-if="entity.children.length > 0" v-if="entity.children.length > 0"
v-slot="scroll" v-slot="scroll"
:expandable="true"
:expanded="expanded" :expanded="expanded"
class="scroll-light" class="scroll-light"
@expand="(state) => expanded = state" @expand="(state) => expanded = state"

View File

@ -22,14 +22,14 @@
<button <button
v-if="release.photos.length > 0" v-if="release.photos.length > 0"
class="album-toggle" class="album-toggle"
@click="showAlbum = true" @click="$router.push({ hash: '#album' })"
><Icon icon="grid3" />View album</button> ><Icon icon="grid3" />View album</button>
<Album <Album
v-if="showAlbum" v-if="showAlbum"
:items="release.photos" :items="release.photos"
:title="release.title" :title="release.title"
@close="showAlbum = false" @close="$router.go(-1)"
/> />
<div class="info column"> <div class="info column">
@ -233,6 +233,10 @@ function pageTitle() {
|| (this.release.actors.length > 0 ? `${this.release.actors.map(actor => actor.name).join(', ')} for ${this.release.entity.name}` : null)); || (this.release.actors.length > 0 ? `${this.release.actors.map(actor => actor.name).join(', ')} for ${this.release.entity.name}` : null));
} }
function showAlbum() {
return this.release.photos?.length > 0 && this.$route.hash === '#album';
}
export default { export default {
components: { components: {
Actor, Actor,
@ -247,12 +251,12 @@ export default {
data() { data() {
return { return {
release: null, release: null,
showAlbum: false,
}; };
}, },
computed: { computed: {
pageTitle, pageTitle,
bannerBackground, bannerBackground,
showAlbum,
}, },
watch: { watch: {
$route: fetchRelease, $route: fetchRelease,

View File

@ -111,7 +111,7 @@ export default {
}, },
expandable: { expandable: {
type: Boolean, type: Boolean,
default: true, default: false,
}, },
expanded: { expanded: {
type: Boolean, type: Boolean,

View File

@ -83,10 +83,11 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.photos { .photos {
width: 100%; width: 100%;
padding: .5rem 1rem 0 1rem; padding: .5rem 1rem;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
font-size: 0; font-size: 0;
border-bottom: solid 1px var(--shadow-hint);
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;

View File

@ -20,9 +20,7 @@
<Scroll <Scroll
v-if="hasMedia" v-if="hasMedia"
v-slot="scroll" v-slot="scroll"
:expanded="expanded"
class="scroll-dark" class="scroll-dark"
@expand="(state) => expanded = state"
> >
<Photos <Photos
:tag="tag" :tag="tag"
@ -31,6 +29,21 @@
/> />
</Scroll> </Scroll>
<button
v-if="tag.photos && tag.photos.length > 2"
class="album-toggle"
@click="$router.push({ hash: '#album' })"
><Icon icon="grid3" />View album</button>
<Album
v-if="showAlbum"
:items="[tag.poster, ...tag.photos]"
:title="tag.name"
path="/img"
class="portrait"
@close="$router.go(-1)"
/>
<FilterBar <FilterBar
ref="filter" ref="filter"
:fetch-releases="fetchReleases" :fetch-releases="fetchReleases"
@ -57,6 +70,7 @@ import escapeHtml from '../../../src/utils/escape-html';
import FilterBar from '../filters/filter-bar.vue'; import FilterBar from '../filters/filter-bar.vue';
import Photos from './photos.vue'; import Photos from './photos.vue';
import Album from '../album/album.vue';
import Releases from '../releases/releases.vue'; import Releases from '../releases/releases.vue';
import Pagination from '../pagination/pagination.vue'; import Pagination from '../pagination/pagination.vue';
import Scroll from '../scroll/scroll.vue'; import Scroll from '../scroll/scroll.vue';
@ -83,6 +97,16 @@ async function fetchReleases() {
} }
} }
function showAlbum() {
return this.tag.photos?.length > 0 && this.$route.hash === '#album';
}
async function watchRoute(to, from) {
if (to.params.pageNumber !== from.params.pageNumber) {
await this.fetchReleases();
}
}
async function mounted() { async function mounted() {
await this.fetchReleases(); await this.fetchReleases();
this.pageTitle = this.tag.name; this.pageTitle = this.tag.name;
@ -92,6 +116,7 @@ export default {
components: { components: {
FilterBar, FilterBar,
Releases, Releases,
Album,
Photos, Photos,
Pagination, Pagination,
Scroll, Scroll,
@ -108,8 +133,11 @@ export default {
expanded: false, expanded: false,
}; };
}, },
computed: {
showAlbum,
},
watch: { watch: {
$route: fetchReleases, $route: watchRoute,
'$store.state.ui.tagFilter': fetchReleases, '$store.state.ui.tagFilter': fetchReleases,
}, },
mounted, mounted,

View File

@ -6,3 +6,27 @@
border: solid 1px var(--shadow-weak); border: solid 1px var(--shadow-weak);
cursor: pointer; cursor: pointer;
} }
.album-toggle {
height: fit-content;
display: inline-flex;
align-items: center;
justify-content: center;
padding: .5rem 1rem;
border: none;
border-bottom: solid 1px var(--shadow-hint);
color: var(--shadow);
background: var(--background-dim);
font-size: 1rem;
font-weight: bold;
.icon {
fill: var(--shadow);
margin: -.1rem .5rem 0 0;
}
&:hover {
background: var(--shadow-hint);
cursor: pointer;
}
}