-
Notifications
You must be signed in to change notification settings - Fork 109
feat: unify header #2808
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
Closed
Closed
feat: unify header #2808
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,126 @@ | ||
| <template> | ||
| <div class="right-side-actions"> | ||
| <div class="user-avatar__icon user-avatar__icon--with-avatar" | ||
| :style="avatarUrl ? { backgroundImage: `url(${avatarUrl})` } : null"> | ||
| </div> | ||
| <a :download="basename" | ||
| :href="fullPathToFile"> | ||
| <NcButton class="download__button" | ||
| type="primary"> | ||
| Download | ||
| </NcButton> | ||
| </a> | ||
| <NcActions> | ||
| <NcActionButton icon="icon-edit" | ||
| :close-after-click="true" | ||
| @click="showSidebar"> | ||
| Open sidebar | ||
| </NcActionButton> | ||
| <NcActionButton icon="icon-delete" | ||
| :close-after-click="true" | ||
| @click="onDelete"> | ||
| Delete | ||
| </NcActionButton> | ||
| </NcActions> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
|
|
||
| import axios from '@nextcloud/axios' | ||
| import { getCurrentUser } from '@nextcloud/auth' | ||
| import NcActions from '@nextcloud/vue/dist/Components/NcActions' | ||
| import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton' | ||
| import NcButton from '@nextcloud/vue/dist/Components/NcButton' | ||
| import { getRootPath } from '../../helpers/files.js' | ||
| import { getAvatarUrl } from '../../helpers' | ||
|
|
||
| export default { | ||
| name: 'RightSideActions', | ||
|
|
||
| components: { | ||
| NcActions, | ||
| NcActionButton, | ||
| NcButton, | ||
| }, | ||
|
|
||
| props: { | ||
| basename: { | ||
| type: String, | ||
| default: null, | ||
| }, | ||
| relativePath: { | ||
| type: String, | ||
| default: '', | ||
| }, | ||
| }, | ||
|
|
||
| computed: { | ||
| avatarUrl() { | ||
| let currentUser = getCurrentUser() | ||
| return currentUser ? getAvatarUrl(currentUser?.uid, 44) : null | ||
| }, | ||
| fullPathToFile() { | ||
| return getRootPath() + this.relativePath | ||
| } | ||
| }, | ||
|
|
||
| methods: { | ||
| async onDelete() { | ||
| try { | ||
| const url = this.fullPathToFile | ||
| await axios.delete(url) | ||
| this.closeEditor() | ||
| } catch (error) { | ||
| showError(error) | ||
| } | ||
| }, | ||
| async showSidebar() { | ||
| // Open the sidebar sharing tab | ||
| if (OCA?.Files?.Sidebar) { | ||
| await OCA.Files.Sidebar.open(this.relativePath) | ||
| } | ||
| }, | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style scoped lang="scss"> | ||
| $clickable-area: 35px; | ||
| $usericon-padding: 10px; | ||
|
|
||
| .right-side-actions { | ||
| display: flex; | ||
| } | ||
|
|
||
| .user-avatar__icon { | ||
| position: relative; | ||
| top: 5px; | ||
| width: $clickable-area; | ||
| min-width: $clickable-area; | ||
| height: $clickable-area; | ||
| margin: 0 5px !important; | ||
| border-radius: $clickable-area; | ||
| background-color: var(--color-background-darker); | ||
| background-repeat: no-repeat; | ||
| background-position: center; | ||
| background-size: $clickable-area - 2 * $usericon-padding; | ||
| &--with-avatar { | ||
| color: inherit; | ||
| background-size: cover; | ||
| } | ||
| } | ||
|
|
||
| .download__button { | ||
| border: 1px solid white !important; | ||
| } | ||
| </style> | ||
|
|
||
| <style lang="scss"> | ||
| // It makes the app right sidebar appear under the Menubar instead | ||
| // of Hiding a part of it | ||
| // The value used is the max-length of the Menubar | ||
| #app-sidebar-vue { | ||
| top: 44px !important; | ||
| } | ||
| </style> | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.