Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] Various fix from 30 #2517

Merged
merged 10 commits into from
Jul 4, 2024
4 changes: 2 additions & 2 deletions js/photos-dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-dashboard.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_Folders_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_Folders_vue.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_SharedAlbumContent_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_SharedAlbumContent_vue.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Collection/CollectionContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<slot v-if="sortedCollectionFileIds.length === 0 && !loading" name="empty-content" />

<!-- Media list -->
<FilesListViewer v-if="collection !== undefined"
<FilesListViewer v-if="collection !== undefined && sortedCollectionFileIds.length > 0 "
:container-element="appContent"
class="collection__media"
:file-ids="sortedCollectionFileIds"
Expand Down
28 changes: 17 additions & 11 deletions src/components/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,26 +163,19 @@ export default {
},

watch: {
file() {
async file() {
this.initialized = false
this.loadedSmall = false
this.errorSmall = false
this.loadedLarge = false
this.errorLarge = false

await this.init()
},
},

async mounted() {
[this.loadedSmall, this.loadedLarge] = await Promise.all([
await isCachedPreview(this.srcSmall),
await isCachedPreview(this.srcLarge),
])

this.initialized = true

await this.$nextTick() // Wait for next tick to have the canvas in the DOM

this.drawBlurhash()
await this.init()
},

beforeDestroy() {
Expand All @@ -196,6 +189,19 @@ export default {
},

methods: {
async init() {
[this.loadedSmall, this.loadedLarge] = await Promise.all([
await isCachedPreview(this.srcSmall),
await isCachedPreview(this.srcLarge),
])

this.initialized = true

await this.$nextTick() // Wait for next tick to have the canvas in the DOM

this.drawBlurhash()
},

emitClick() {
this.$emit('click', this.file.fileid)
},
Expand Down
7 changes: 4 additions & 3 deletions src/components/PhotosPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export default defineComponent({
...mapGetters([
'files',
]),

photosLocationFolder() {
return this.$store.state.userConfig.photosLocationFolder
},
},

watch: {
Expand Down Expand Up @@ -241,9 +245,6 @@ export default defineComponent({
}
return moment(date, 'YYYYMM').format('MMMM YYYY')
},
photosLocationFolder() {
return this.$store.state.userConfig.photosLocationFolder
},
},
})
</script>
Expand Down
6 changes: 3 additions & 3 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const router = new Router({
{
path: '/albums/:albumName*',
component: AlbumContent,
name: 'albums',
name: 'albumsContent',
props: route => ({
albumName: route.params.albumName,
}),
Expand All @@ -150,7 +150,7 @@ const router = new Router({
{
path: '/sharedalbums/:albumName*',
component: SharedAlbumContent,
name: 'sharedAlbums',
name: 'sharedAlbumsContent',
props: route => ({
albumName: route.params.albumName,
}),
Expand Down Expand Up @@ -181,7 +181,7 @@ const router = new Router({
{
path: '/places/:placeName*',
component: PlaceContent,
name: 'places',
name: 'placesContent',
props: route => ({
placeName: route.params.placeName,
}),
Expand Down
19 changes: 16 additions & 3 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@ import folders from './folders.js'
import systemtags from './systemtags.js'
import userConfig, { getFolder } from './userConfig.js'

/**
* Get the information of photosLocation and store it as photosLocationFolder
* @param store
* @param state
*/
async function initPhotosLocationFolder(store, state) {
const photosLocationFolder = await getFolder(state.userConfig.photosLocation)
store.commit('updateUserConfig', { key: 'photosLocationFolder', value: photosLocationFolder })
}

Vue.use(Vuex)
export default new Store({
const photosStore = new Store({
modules: {
files,
folders,
Expand All @@ -51,14 +61,17 @@ export default new Store({

plugins: [
(store) => {
initPhotosLocationFolder(store, store.state)

store.subscribe(async (mutation, state) => {
if (mutation.type === 'updateUserConfig' && mutation.payload.key === 'photosLocation') {
const photosLocationFolder = await getFolder(state.userConfig.photosLocation)
store.commit('updateUserConfig', { key: 'photosLocationFolder', value: photosLocationFolder })
initPhotosLocationFolder(store, state)
}
})
},
],

strict: process.env.NODE_ENV !== 'production',
})

export default photosStore
43 changes: 25 additions & 18 deletions src/views/AlbumContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
-
-->
<template>
<div>
<CollectionContent v-if="true"
ref="collectionContent"
<div class="album-container">
<CollectionContent ref="collectionContent"
:collection="album"
:collection-file-ids="albumFileIds"
:loading="loadingCollection || loadingCollectionFiles"
Expand Down Expand Up @@ -53,8 +52,7 @@
</template>

<template v-if="album !== undefined" slot="right">
<UploadPicker v-if="album.nbItems !== 0"
:accept="allowedMimes"
<UploadPicker :accept="allowedMimes"
:context="uploadContext"
:destination="albumAsFolder"
:root="uploadContext.root"
Expand Down Expand Up @@ -127,7 +125,8 @@
</NcEmptyContent>
</CollectionContent>

<PhotosPicker :open.sync="showAddPhotosModal"
<PhotosPicker v-if="album !== undefined"
:open.sync="showAddPhotosModal"
:blacklist-ids="albumFileIds"
:destination="album.basename"
:name="t('photos', 'Add photos to {albumName}', {albumName: albumName})"
Expand Down Expand Up @@ -400,6 +399,14 @@ export default {
}
</script>
<style lang="scss" scoped>
.album-container {
height: 100%;

:deep(.collection) {
height: 100%;
}
}

.album {
&__title {
width: 100%;
Expand All @@ -424,19 +431,19 @@ export default {
&--uploading {
margin-bottom: 30px;
}
}

:deep(.upload-picker) {
.upload-picker__progress {
position: absolute;
bottom: -30px;
left: 64px;
margin: 0;
}
.upload-picker__cancel {
position: absolute;
bottom: -24px;
right: 50px;
:deep(.upload-picker) {
.upload-picker__progress {
position: absolute;
bottom: -30px;
left: 64px;
margin: 0;
}
.upload-picker__cancel {
position: absolute;
bottom: -24px;
right: 50px;
}
}
}
</style>
25 changes: 12 additions & 13 deletions src/views/Folders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,21 +321,20 @@ export default {
&--uploading {
margin-bottom: 30px;
}
}

:deep(.upload-picker) {
.upload-picker__progress {
position: absolute;
bottom: -30px;
left: 64px;
margin: 0;
}
:deep(.upload-picker) {
.upload-picker__progress {
position: absolute;
bottom: -30px;
left: 64px;
margin: 0;
}

.upload-picker__cancel {
position: absolute;
bottom: -24px;
right: 50px;
.upload-picker__cancel {
position: absolute;
bottom: -24px;
right: 50px;
}
}
}

</style>
Loading