Skip to content

Commit

Permalink
Merge FaceCover and FaceCoverSmall
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Nov 7, 2022
1 parent 521524a commit ef5d31d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 158 deletions.
35 changes: 30 additions & 5 deletions src/components/FaceCover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
-->

<template>
<router-link class="face-cover" :to="`/faces/${baseName}`">
<div :class="['face-cover', small && 'face-cover--small']" @click="$emit('click')">
<div class="face-cover__crop-container">
<img ref="image"
class="face-cover__image"
Expand All @@ -36,11 +36,11 @@
{{ baseName }}
</h2>
</div>
<div v-if="facesFiles[baseName]" class="face-cover__details__second-line">
<div v-if="facesFiles[baseName] && !small" class="face-cover__details__second-line">
{{ n('photos', '%n photos', '%n photos', facesFiles[baseName].length,) }}
</div>
</div>
</router-link>
</div>
</template>

<script>
Expand All @@ -62,6 +62,10 @@ export default {
type: String,
required: true,
},
small: {
type: Boolean,
default: false,
},
},

data() {
Expand Down Expand Up @@ -113,12 +117,16 @@ export default {
})
},

beforeDestroy() {
this.observer.disconnect()
},

methods: {
async fetchFiles() {
await this.fetchFaceContent(this.face.basename)
},
waitForVisible(el, listener) {
const observer = new IntersectionObserver((entries, observer) => {
this.observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.intersectionRatio > 0) {
listener()
Expand All @@ -127,7 +135,7 @@ export default {
})
})

observer.observe(el)
this.observer.observe(el)
},
},
}
Expand Down Expand Up @@ -156,6 +164,14 @@ export default {
}
}

&.face-cover--small {
.face-cover__crop-container {
width: 60px !important;
height: 60px !important;
--photos-face-width: 60px !important;
}
}

&:hover, &:focus {
background: var(--color-background-hover);
}
Expand Down Expand Up @@ -188,5 +204,14 @@ export default {
margin: 0;
}
}

&.face-cover--small {
* {
font-size: 15px !important;
}
.face-cover__details {
width: 60px !important;
}
}
}
</style>
148 changes: 0 additions & 148 deletions src/components/FaceCoverSmall.vue

This file was deleted.

7 changes: 4 additions & 3 deletions src/components/FaceMergeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
-->
<template>
<div class="merge-form face-list">
<FaceCoverSmall v-for="face in filteredFaces"
<FaceCover v-for="face in filteredFaces"
:key="face.basename"
:base-name="face.basename"
small
@click="handleSelect(face.basename)" />
</div>
</template>
Expand All @@ -33,11 +34,11 @@ import { mapGetters } from 'vuex'

import FaceCoverMixin from '../mixins/FaceCoverMixin.js'
import FetchFacesMixin from '../mixins/FetchFacesMixin.js'
import FaceCoverSmall from './FaceCoverSmall.vue'
import FaceCover from './FaceCover.vue'

export default {
name: 'FaceMergeForm',
components: { FaceCoverSmall },
components: { FaceCover },
mixins: [
FaceCoverMixin,
FetchFacesMixin,
Expand Down
6 changes: 4 additions & 2 deletions src/views/Faces.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
</div>

<div v-else-if="!noFaces" class="faces__list">
<FaceCover v-for="face in orderedFaces"
<router-link v-for="face in orderedFaces"
:key="face.basename"
:base-name="face.basename" />
:to="`/faces/${face.basename}`">
<FaceCover :base-name="face.basename" />
</router-link>
</div>
</div>
</template>
Expand Down

0 comments on commit ef5d31d

Please sign in to comment.