Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
430b86f
chore: Migrate package to use vite for building and use Vue for UI
susnux Oct 11, 2023
5b9f53a
fix: Allow directly navigating to a the filtered app view
susnux Oct 30, 2023
c18aa03
fix: Make the app navigation a second named router-view
susnux Oct 30, 2023
1c2e6ef
fix!: Make the setting for RSS feed to take a real boolean as value
susnux Oct 30, 2023
ad2e221
feat: Implement ActivityFeed view
susnux Nov 5, 2023
a92520c
feat(Activity): Allow to show previews in Activity component
susnux Nov 5, 2023
88787e2
fix: Load and show previews in the Activity app view
susnux Nov 5, 2023
c91d5ea
fix: Adjust icons to Nextcloud default size of 20x20 px
susnux Nov 8, 2023
7472efe
feat: Show loading indicator on activity feed
susnux Nov 8, 2023
29000ec
fix!: Drop legacy scripts
susnux Nov 8, 2023
3e2d69e
chore: Do not introduce too many new stuff, revert css modules to sco…
susnux Nov 8, 2023
a0d917e
fix: Adjusted loading indicator to look like in previous UI version
susnux Nov 8, 2023
2723ddc
fix(Actvitiy): When wraping text keep content within container and do…
susnux Nov 8, 2023
f612016
fix: On Nextcloud GmbH the copyright should be set to author instead …
susnux Nov 8, 2023
58ae402
fix: Allow empty filter and fallback to `all`
susnux Nov 8, 2023
fd0b1bc
fix: Adjust UI for some review comments
susnux Nov 8, 2023
219ec1f
fix(tests): Adjust unit tests
susnux Nov 8, 2023
158bb17
chore(deps): Update to stable nextcloud/vue and nextcloud/dialogs
susnux Nov 8, 2023
b15a83a
fix(tests): Adjust node tests to use vitest
susnux Nov 8, 2023
80d57db
chore: Compile assets
susnux Nov 8, 2023
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
Next Next commit
feat(Activity): Allow to show previews in Activity component
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Nov 8, 2023
commit a92520c3cfa6ece9d5c4496b5ed5839bd646fae2
51 changes: 51 additions & 0 deletions src/components/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@
</div>
<span class="hidden-visually">{{ activity.formattedDate }}</span>
<span :title="activity.formattedDate" class="activity-entry__date">{{ dateFromNow }}</span>
<div v-if="showPreviews" class="activity-entry__preview-wrapper">
<component :is="preview.link ? 'a' : 'span'"
v-for="preview, index in activity.previews"
:key="preview.fileId ?? `preview-${index}`"
class="activity-entry__preview"
:href="preview.link">
<img class="activity-entry__preview-image"
:class="{
'activity-entry__preview-mimetype': preview.isMimeTypeIcon,
}"
:src="preview.source"
:alt="preview.link ? t('activity', 'Open {filename}', preview) : ''">
</component>
</div>
</li>
</template>

Expand Down Expand Up @@ -72,6 +86,13 @@ export default {
type: ActivityModel,
required: true,
},
/**
* Whether to show previews
*/
showPreviews: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down Expand Up @@ -198,6 +219,7 @@ export default {
<style lang="scss" scoped>
.activity-entry {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
width: 100%;
height: var(--height);
Expand Down Expand Up @@ -242,5 +264,34 @@ export default {
margin-left: 5px;
flex-shrink: 0;
}

&__preview-wrapper {
// Force next line
flex: 0 0 100%;
// Proper spacing
gap: 12px;
// align with content
margin-inline-start: 24px;
}

&__preview:hover {
opacity: .75;
}

&__preview-image {
height: 50px;
width: 50px;

// Only add borders for images, not for MIME types
&:not(.activity-entry__preview-mimetype) {
border: 2px solid var(--color-border);
border-radius: var(--border-radius-large);

&:hover {
border-color: var(--color-main-text);
outline: 2px solid var(--color-main-background);
}
}
}
}
</style>
9 changes: 8 additions & 1 deletion src/models/ActivityModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import type { IRawActivity, IRichObject } from './types'
import type { IPreview, IRawActivity, IRichObject } from './types'
import moment from '@nextcloud/moment'

export default class ActivityModel {
Expand Down Expand Up @@ -275,4 +275,11 @@ export default class ActivityModel {
return moment(this._activity.datetime).unix()
}

/**
* Get previews of affected files
*/
get previews(): IPreview[] {
return this._activity.previews ?? []
}

}
27 changes: 26 additions & 1 deletion src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ export interface IRichObject {
[key: string]: unknown
}

export interface IPreview {
/**
* The URL of the link target
*/
link?: string
/**
* The URL of the preview image
*/
source: string
/**
* MIME type of the file
*/
mimeType: string
/**
* Whether this is a MIME type icon or a real preview of the file
*/
isMimeTypeIcon: boolean
/**
* The file ID
*/
fileId: number
view: string
filename: string
}

export interface IRawActivity {
activity_id: number
app: string
Expand All @@ -68,5 +93,5 @@ export interface IRawActivity {
link: string
icon: string
datetime: string
previews: unknown[]
previews?: IPreview[]
}