Moves AlbumsList component to metadata tab, changes album picker behaviour (click to add, click checkmark icon to select)
Signed-off-by: Alexander Saltykov <temp.kroogi@gmail.com>pull/752/head
parent
67da46f6dd
commit
9c883b5584
24
src/App.vue
24
src/App.vue
|
@ -79,7 +79,6 @@ import Settings from './components/Settings.vue';
|
||||||
import FirstStart from './components/FirstStart.vue';
|
import FirstStart from './components/FirstStart.vue';
|
||||||
import Viewer from './components/viewer/Viewer.vue';
|
import Viewer from './components/viewer/Viewer.vue';
|
||||||
import Metadata from './components/Metadata.vue';
|
import Metadata from './components/Metadata.vue';
|
||||||
import AlbumsList from './components/AlbumsList.vue';
|
|
||||||
import Sidebar from './components/Sidebar.vue';
|
import Sidebar from './components/Sidebar.vue';
|
||||||
import EditMetadataModal from './components/modal/EditMetadataModal.vue';
|
import EditMetadataModal from './components/modal/EditMetadataModal.vue';
|
||||||
import NodeShareModal from './components/modal/NodeShareModal.vue';
|
import NodeShareModal from './components/modal/NodeShareModal.vue';
|
||||||
|
@ -145,7 +144,6 @@ export default defineComponent({
|
||||||
data: () => ({
|
data: () => ({
|
||||||
navItems: [] as NavItem[],
|
navItems: [] as NavItem[],
|
||||||
metadataComponent: null as any,
|
metadataComponent: null as any,
|
||||||
albumsListComponent: null as any,
|
|
||||||
settingsOpen: false,
|
settingsOpen: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -275,28 +273,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
// Register sidebar albums tab
|
|
||||||
globalThis.OCA?.Files?.Sidebar?.registerTab(
|
|
||||||
new globalThis.OCA.Files.Sidebar.Tab({
|
|
||||||
id: 'memories-albums',
|
|
||||||
name: this.t('memories', 'Albums'),
|
|
||||||
icon: 'icon-details',
|
|
||||||
|
|
||||||
mount(el, fileInfo, context) {
|
|
||||||
this.albumsListComponent?.$destroy?.();
|
|
||||||
this.albumsListComponent = new Vue(AlbumsList as any);
|
|
||||||
this.albumsListComponent.$mount(el);
|
|
||||||
this.albumsListComponent.update(fileInfo);
|
|
||||||
},
|
|
||||||
update(fileInfo) {
|
|
||||||
this.albumsListComponent.update(fileInfo);
|
|
||||||
},
|
|
||||||
destroy() {
|
|
||||||
this.albumsListComponent?.$destroy?.();
|
|
||||||
this.albumsListComponent = null;
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check for native interface
|
// Check for native interface
|
||||||
if (this.native) {
|
if (this.native) {
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
<div class="loading-icon fill-block" v-if="loadingAlbums">
|
<div class="loading-icon fill-block" v-if="loadingAlbums">
|
||||||
<XLoadingIcon />
|
<XLoadingIcon />
|
||||||
</div>
|
</div>
|
||||||
|
<NcButton
|
||||||
|
:aria-label="t('memories', 'Add to album.')"
|
||||||
|
class="new-album-button"
|
||||||
|
type="tertiary"
|
||||||
|
@click="addToAlbum"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<Plus />
|
||||||
|
</template>
|
||||||
|
{{ t('memories', 'Add to album') }}
|
||||||
|
</NcButton>
|
||||||
<span class="empty-state" v-if="albums.length === 0">{{ t('memories', 'No albums') }}</span>
|
<span class="empty-state" v-if="albums.length === 0">{{ t('memories', 'No albums') }}</span>
|
||||||
<ul v-else class="albums-container">
|
<ul v-else class="albums-container">
|
||||||
<NcListItem
|
<NcListItem
|
||||||
|
@ -22,17 +33,6 @@
|
||||||
|
|
||||||
</NcListItem>
|
</NcListItem>
|
||||||
</ul>
|
</ul>
|
||||||
<NcButton
|
|
||||||
:aria-label="t('memories', 'Add to album.')"
|
|
||||||
class="new-album-button"
|
|
||||||
type="tertiary"
|
|
||||||
@click="addToAlbum"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<Plus />
|
|
||||||
</template>
|
|
||||||
{{ t('memories', 'Add to album') }}
|
|
||||||
</NcButton>
|
|
||||||
<AddToAlbumModal ref="addToAlbumModal" @added="loadAlbums" />
|
<AddToAlbumModal ref="addToAlbumModal" @added="loadAlbums" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -62,8 +62,18 @@
|
||||||
AddToAlbumModal,
|
AddToAlbumModal,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
fileid: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
filename: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
fileid: -1,
|
|
||||||
photo: {} as { id: number, name: string },
|
photo: {} as { id: number, name: string },
|
||||||
albums: [] as IAlbum[],
|
albums: [] as IAlbum[],
|
||||||
loadingAlbums: false,
|
loadingAlbums: false,
|
||||||
|
@ -71,6 +81,7 @@
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
subscribe('files:file:updated', this.handleFileUpdated);
|
subscribe('files:file:updated', this.handleFileUpdated);
|
||||||
|
this.update({ id: this.$props.fileid, name: this.$props.filename });
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -185,5 +196,9 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.new-album-button {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
<div v-if="lat && lon" class="map">
|
<div v-if="lat && lon" class="map">
|
||||||
<iframe class="fill-block" :src="mapUrl" />
|
<iframe class="fill-block" :src="mapUrl" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AlbumsList :fileid="fileid" :filename="filename" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="loading-icon fill-block" v-else>
|
<div class="loading-icon fill-block" v-else>
|
||||||
|
@ -65,6 +67,7 @@ import ImageIcon from 'vue-material-design-icons/Image.vue';
|
||||||
import InfoIcon from 'vue-material-design-icons/InformationOutline.vue';
|
import InfoIcon from 'vue-material-design-icons/InformationOutline.vue';
|
||||||
import LocationIcon from 'vue-material-design-icons/MapMarker.vue';
|
import LocationIcon from 'vue-material-design-icons/MapMarker.vue';
|
||||||
import TagIcon from 'vue-material-design-icons/Tag.vue';
|
import TagIcon from 'vue-material-design-icons/Tag.vue';
|
||||||
|
import AlbumsList from './AlbumsList.vue';
|
||||||
import { API } from '../services/API';
|
import { API } from '../services/API';
|
||||||
import type { IImageInfo, IPhoto } from '../types';
|
import type { IImageInfo, IPhoto } from '../types';
|
||||||
|
|
||||||
|
@ -82,10 +85,12 @@ export default defineComponent({
|
||||||
NcActions,
|
NcActions,
|
||||||
NcActionButton,
|
NcActionButton,
|
||||||
EditIcon,
|
EditIcon,
|
||||||
|
AlbumsList,
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
fileid: null as number | null,
|
fileid: null as number | null,
|
||||||
|
filename: '',
|
||||||
exif: {} as { [prop: string]: any },
|
exif: {} as { [prop: string]: any },
|
||||||
baseInfo: {} as IImageInfo,
|
baseInfo: {} as IImageInfo,
|
||||||
state: 0,
|
state: 0,
|
||||||
|
@ -330,6 +335,7 @@ export default defineComponent({
|
||||||
if (state !== this.state) return res.data;
|
if (state !== this.state) return res.data;
|
||||||
|
|
||||||
this.fileid = res.data.fileid;
|
this.fileid = res.data.fileid;
|
||||||
|
this.filename = res.data.basename;
|
||||||
this.exif = res.data.exif || {};
|
this.exif = res.data.exif || {};
|
||||||
this.baseInfo = res.data;
|
this.baseInfo = res.data;
|
||||||
return this.baseInfo;
|
return this.baseInfo;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
albumName: album.name,
|
albumName: album.name,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
@click.prevent="pickAlbum(album)"
|
@click.prevent="() => {}"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<XImg v-if="album.last_added_photo !== -1" class="album__image" :src="toCoverUrl(album.last_added_photo)" />
|
<XImg v-if="album.last_added_photo !== -1" class="album__image" :src="toCoverUrl(album.last_added_photo)" />
|
||||||
|
@ -23,11 +23,24 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #subtitle>
|
<template #subtitle>
|
||||||
|
<div @click.prevent="pickAlbum(album)">
|
||||||
{{ getSubtitle(album) }}
|
{{ getSubtitle(album) }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<div v-if="selectedAlbums.has(album)" class="check-circle-icon">
|
<div
|
||||||
|
v-if="!selectedAlbums.has(album)"
|
||||||
|
class="check-circle-icon check-circle-icon--inactive"
|
||||||
|
@click.prevent="toggleAlbumSelection(album)"
|
||||||
|
>
|
||||||
|
<XImg :src="checkmarkIcon" />
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="selectedAlbums.has(album)"
|
||||||
|
class="check-circle-icon"
|
||||||
|
@click.prevent="toggleAlbumSelection(album)"
|
||||||
|
>
|
||||||
<XImg :src="checkmarkIcon" />
|
<XImg :src="checkmarkIcon" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -175,7 +188,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
pickAlbum(album: IAlbum) {
|
toggleAlbumSelection(album: IAlbum) {
|
||||||
if (this.selectedAlbums.has(album)) {
|
if (this.selectedAlbums.has(album)) {
|
||||||
this.selectedAlbums.delete(album);
|
this.selectedAlbums.delete(album);
|
||||||
this.unselectedAlbums.add(album)
|
this.unselectedAlbums.add(album)
|
||||||
|
@ -195,6 +208,10 @@ export default defineComponent({
|
||||||
this.selectedCount = this.selectedAlbums.size;
|
this.selectedCount = this.selectedAlbums.size;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
pickAlbum(album: IAlbum) {
|
||||||
|
this.$emit('select', [album], []);
|
||||||
|
},
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
this.$emit('select', Array.from(this.selectedAlbums), Array.from(this.unselectedAlbums));
|
this.$emit('select', Array.from(this.selectedAlbums), Array.from(this.unselectedAlbums));
|
||||||
}
|
}
|
||||||
|
@ -259,6 +276,7 @@ export default defineComponent({
|
||||||
|
|
||||||
.check-circle-icon {
|
.check-circle-icon {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
border: 1px solid rgba(0, 255, 0, 0.1882352941);
|
||||||
background-color: rgba(0, 255, 0, 0.1882352941);
|
background-color: rgba(0, 255, 0, 0.1882352941);
|
||||||
height: 34px;
|
height: 34px;
|
||||||
width: 34px;
|
width: 34px;
|
||||||
|
@ -266,6 +284,11 @@ export default defineComponent({
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
&--inactive {
|
||||||
|
border: 1px solid rgba($color: black, $alpha: 0.1);
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
& img {
|
& img {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
|
|
Loading…
Reference in New Issue