-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7076 from nextcloud/feature/1577/conversation-sha…
…red-items 🗃️ Shared Items tab
- Loading branch information
Showing
10 changed files
with
496 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
src/components/RightSidebar/SharedItems/SharedItems.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
<!-- | ||
- @copyright Copyright (c) 2022 Marco Ambrosini <[email protected]> | ||
- | ||
- @author Marco Ambrosini <[email protected]> | ||
- | ||
- @license GNU AGPL version 3 or any later version | ||
- | ||
- 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/>. | ||
--> | ||
|
||
<template> | ||
<div class="shared-items"> | ||
<AppNavigationCaption :title="title" /> | ||
<div class="files" :class="{'files__list' : isList}"> | ||
<template v-for="file in filesToDisplay"> | ||
<FilePreview :key="file.id" | ||
:small-preview="isList" | ||
:row-layout="isList" | ||
:is-shared-items-tab="true" | ||
v-bind="file.messageParameters.file" /> | ||
</template> | ||
</div> | ||
<Button v-if="hasMore" | ||
type="tertiary" | ||
class="shared-items__more" | ||
:wide="true" | ||
@click="handleCaptionClick"> | ||
<template #icon> | ||
<DotsHorizontal :size="20" | ||
decorative | ||
title="" /> | ||
</template> | ||
{{ buttonTitle }} | ||
</Button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Button from '@nextcloud/vue/dist/Components/Button' | ||
import FilePreview from '../../MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue' | ||
import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue' | ||
import AppNavigationCaption from '@nextcloud/vue/dist/Components/AppNavigationCaption' | ||
import { showMessage } from '@nextcloud/dialogs' | ||
export default { | ||
name: 'SharedItems', | ||
components: { | ||
Button, | ||
FilePreview, | ||
DotsHorizontal, | ||
AppNavigationCaption, | ||
}, | ||
props: { | ||
type: { | ||
type: String, | ||
required: true, | ||
}, | ||
items: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
filesToDisplay() { | ||
return Object.values(this.items).reverse().slice(0, 6) | ||
}, | ||
title() { | ||
switch (this.type) { | ||
case 'media': | ||
return t('spreed', 'Media') | ||
case 'file': | ||
return t('spreed', 'Files') | ||
case 'deck-card': | ||
return t('spreed', 'Deck cards') | ||
case 'voice': | ||
return t('spreed', 'Voice messages') | ||
case 'location': | ||
return t('spreed', 'Locations') | ||
case 'audio': | ||
return t('spreed', 'Audio') | ||
case 'other': | ||
return t('spreed', 'Other') | ||
default: | ||
return '' | ||
} | ||
}, | ||
buttonTitle() { | ||
switch (this.type) { | ||
case 'media': | ||
return t('spreed', 'Show all media') | ||
case 'file': | ||
return t('spreed', 'Show all files') | ||
case 'deck-card': | ||
return t('spreed', 'Show all deck cards') | ||
case 'voice': | ||
return t('spreed', 'Show all voice messages') | ||
case 'location': | ||
return t('spreed', 'Show all locations') | ||
case 'audio': | ||
return t('spreed', 'Show all audio') | ||
case 'other': | ||
return t('spreed', 'Show all other') | ||
default: | ||
return '' | ||
} | ||
}, | ||
isList() { | ||
switch (this.type) { | ||
case 'media': | ||
return false | ||
case 'locations': | ||
return false | ||
default: | ||
return true | ||
} | ||
}, | ||
hasMore() { | ||
return Object.values(this.items).length > 6 | ||
}, | ||
}, | ||
methods: { | ||
handleCaptionClick() { | ||
showMessage('Screenshot feature only. Implementation of the real feature will come soon! 😎') | ||
console.debug('Show more') | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.files { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
grid-template-rows: 1fr 1fr; | ||
grid-gap: 4px; | ||
&__list { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
} | ||
.shared-items { | ||
margin-bottom: 16px; | ||
&__more { | ||
margin-top: 8px; | ||
} | ||
} | ||
</style> |
Oops, something went wrong.