Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix OnThisDay section headers
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr authored and skjnldsv committed Jan 14, 2022
commit 2a2a06d461a82cb3d41ecc87b59586eb69d7d3e6
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.

Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
Expand Down

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/components/SeparatorVirtualGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
-->

<template>
<h2 class="grid-title" :style="{height: item.height + 'px'}">
<span v-if="item.injected.onThisDay">{{ n('photos', '{years} year ago', '{years} years ago', item.injected.onThisDay, {years: item.injected.onThisDay}) }}</span>
<h2 v-if="item.injected.onThisDay" class="grid-title" :style="{height: item.height + 'px'}">
{{ n('photos', '{years} year ago', '{years} years ago', item.injected.onThisDay, {years: item.injected.onThisDay}) }}<span> · {{ item.injected.month }} {{ item.injected.year }}</span>
</h2>
<h2 v-else class="grid-title" :style="{height: item.height + 'px'}">
{{ item.injected.month }}
<span>{{ item.injected.year }}</span>
</h2>
Expand Down
1 change: 1 addition & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import { generateUrl } from '@nextcloud/router'
Expand Down
4 changes: 2 additions & 2 deletions src/services/PhotoSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import moment from '@nextcloud/moment'
* List files from a folder and filter out unwanted mimes
*
* @param {boolean} [onlyFavorites=false] not used
* @param {Object} [options] used for the cancellable requests
* @param {object} [options] used for the cancellable requests
* @param {number} [options.page=0] which page to start (starts at 0)
* @param {number} [options.perPage] how many to display per page default is 5 times the max number per line from the grid-sizes config file
* @param {boolean} [options.full=false] get full data of the files
* @param {boolean} [options.onThisDay=false] get only items from this day of year
* @returns {Array} the file list
* @return {Array} the file list
*/
export default async function(onlyFavorites = false, options = {}) {

Expand Down
1 change: 1 addition & 0 deletions src/store/systemtags.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import Vue from 'vue'
import { sortCompare } from '../utils/fileUtils'
Expand Down
8 changes: 4 additions & 4 deletions src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export default {
done: false,
error: null,
page: 0,
lastSection: '',
loaderComponent: Loader,
}
},
Expand Down Expand Up @@ -142,23 +141,24 @@ export default {
* In our case injected could be an image/video (aka file) or a title (year/month)
* Note2: titles are rendered full width and images are rendered on 1 column and 256x256 ratio
*/
let lastSection = ''
return this.fileList.flatMap((file, index) => {
const finalArray = []
const currentSection = this.getFormatedDate(file.lastmod, 'YYYY MMMM')
if (this.lastSection !== currentSection) {
if (lastSection !== currentSection) {
finalArray.push({
id: `title-${index}`,
injected: {
year: this.getFormatedDate(file.lastmod, 'YYYY'),
month: this.getFormatedDate(file.lastmod, 'MMMM'),
...(this.onThisDay && { onThisDay: Math.round(moment(Date.now()).diff(moment(file.lastmod), 'years', true)) }),
onThisDay: this.onThisDay ? Math.round(moment(Date.now()).diff(moment(file.lastmod), 'years', true)) : false,
},
height: 90,
columnSpan: 0, // means full width
newRow: true,
renderComponent: SeparatorVirtualGrid,
})
this.lastSection = currentSection // we keep track of the last section for the next batch
lastSection = currentSection // we keep track of the last section for the next batch
}
finalArray.push({
id: `img-${file.fileid}`,
Expand Down