Skip to content
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

[stable31] refactor: Sharing sidebar UI redesign #50374

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 8 additions & 2 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,17 @@ export default {
}
return this.share.shareWith
}

if (this.index === null) {
return t('files_sharing', 'Share link')
}
}
if (this.index > 1) {

if (this.index >= 1) {
return t('files_sharing', 'Share link ({index})', { index: this.index })
}
return t('files_sharing', 'Share link')

return t('files_sharing', 'Create public link')
},

/**
Expand Down
47 changes: 33 additions & 14 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@search="asyncFind"
@option:selected="onSelected">
<template #no-options="{ search }">
{{ search ? noResultText : t('files_sharing', 'No recommendations. Start typing.') }}
{{ search ? noResultText : placeholder }}
</template>
</NcSelect>
</div>
Expand Down Expand Up @@ -74,6 +74,14 @@ export default {
type: Boolean,
required: true,
},
isExternal: {
type: Boolean,
default: false,
},
placeholder: {
type: String,
default: '',
},
},

data() {
Expand Down Expand Up @@ -106,6 +114,10 @@ export default {
if (!this.canReshare) {
return t('files_sharing', 'Resharing is not allowed')
}
if (this.placeholder) {
return this.placeholder
}

// We can always search with email addresses for users too
if (!allowRemoteSharing) {
return t('files_sharing', 'Name or email …')
Expand Down Expand Up @@ -168,19 +180,26 @@ export default {
lookup = true
}

const shareType = [
ShareType.User,
ShareType.Group,
ShareType.Remote,
ShareType.RemoteGroup,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
]

if (getCapabilities().files_sharing.public.enabled === true) {
let shareType = []

if (this.isExternal) {
shareType.push(ShareType.Remote)
shareType.push(ShareType.RemoteGroup)
} else {
// Merge shareType array
shareType = shareType.concat([
ShareType.User,
ShareType.Group,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
])

}

if (getCapabilities().files_sharing.public.enabled === true && this.isExternal) {
shareType.push(ShareType.Email)
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/src/views/SharingInherited.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<template>
<ul id="sharing-inherited-shares">
<ul v-if="shares.length" id="sharing-inherited-shares">
<!-- Main collapsible entry -->
<SharingEntrySimple class="sharing-entry__inherited"
:title="mainTitle"
Expand Down
214 changes: 167 additions & 47 deletions apps/files_sharing/src/views/SharingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<div v-show="!showSharingDetailsView"
class="sharingTab__content">
<!-- shared with me information -->
<ul>
<SharingEntrySimple v-if="isSharedWithMe" v-bind="sharedWithMe" class="sharing-entry__reshare">
<ul v-if="isSharedWithMe">
<SharingEntrySimple v-bind="sharedWithMe" class="sharing-entry__reshare">
<template #avatar>
<NcAvatar :user="sharedWithMe.user"
:display-name="sharedWithMe.displayName"
Expand All @@ -25,50 +25,119 @@
</SharingEntrySimple>
</ul>

<!-- add new share input -->
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:reshare="reshare"
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />

<!-- link shares list -->
<SharingLinkList v-if="!loading"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
:shares="linkShares"
@open-sharing-details="toggleShareDetailsView" />

<!-- other shares list -->
<SharingList v-if="!loading"
ref="shareList"
:shares="shares"
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />

<!-- inherited shares -->
<SharingInherited v-if="canReshare && !loading" :file-info="fileInfo" />

<!-- internal link copy -->
<SharingEntryInternal :file-info="fileInfo" />

<!-- projects -->
<CollectionList v-if="projectsEnabled && fileInfo"
:id="`${fileInfo.id}`"
type="file"
:name="fileInfo.name" />
</div>

<!-- additional entries, use it with cautious -->
<div v-for="(section, index) in sections"
v-show="!showSharingDetailsView"
:ref="'section-' + index"
:key="index"
class="sharingTab__additionalContent">
<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
<section>
<div class="section-header">
<h4>{{ t('files_sharing', 'Internal shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'Internal shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ internalSharesHelpText }}
</p>
</NcPopover>
</div>
<!-- add new share input -->
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:reshare="reshare"
:shares="shares"
:placeholder="t('files_sharing', 'Share with accounts and teams')"
@open-sharing-details="toggleShareDetailsView" />

<!-- other shares list -->
<SharingList v-if="!loading"
ref="shareList"
:shares="shares"
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />

<!-- inherited shares -->
<SharingInherited v-if="canReshare && !loading" :file-info="fileInfo" />

<!-- internal link copy -->
<SharingEntryInternal :file-info="fileInfo" />
</section>

<section>
<div class="section-header">
<h4>{{ t('files_sharing', 'External shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'External shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ externalSharesHelpText }}
</p>
</NcPopover>
</div>
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:is-external="true"
:placeholder="t('files_sharing', 'Email, federated cloud id')"
:reshare="reshare"
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />
<!-- link shares list -->
<SharingLinkList v-if="!loading"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
:shares="linkShares"
@open-sharing-details="toggleShareDetailsView" />
</section>

<section v-if="sections.length > 0 && !showSharingDetailsView">
<div class="section-header">
<h4>{{ t('files_sharing', 'Additional shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'Additional shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ additionalSharesHelpText }}
</p>
</NcPopover>
</div>
<!-- additional entries, use it with cautious -->
<div v-for="(section, index) in sections"
:ref="'section-' + index"
:key="index"
class="sharingTab__additionalContent">
<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
</div>

<!-- projects (deprecated as of NC25 (replaced by related_resources) - see instance config "projects.enabled" ; ignore this / remove it / move into own section) -->
<div v-if="projectsEnabled"
v-show="!showSharingDetailsView && fileInfo"
class="sharingTab__additionalContent">
<CollectionList :id="`${fileInfo.id}`"
type="file"
:name="fileInfo.name" />
</div>
</section>
</div>

<!-- share details -->
Expand All @@ -89,9 +158,13 @@ import { generateOcsUrl } from '@nextcloud/router'
import { CollectionList } from 'nextcloud-vue-collections'
import { ShareType } from '@nextcloud/sharing'

import InfoIcon from 'vue-material-design-icons/Information.vue'
import NcPopover from '@nextcloud/vue/dist/Components/NcPopover.js'

import axios from '@nextcloud/axios'
import moment from '@nextcloud/moment'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'

import { shareWithTitle } from '../utils/SharedWithMe.js'

Expand All @@ -106,12 +179,17 @@ import SharingLinkList from './SharingLinkList.vue'
import SharingList from './SharingList.vue'
import SharingDetailsTab from './SharingDetailsTab.vue'

import ShareDetails from '../mixins/ShareDetails.js'

export default {
name: 'SharingTab',

components: {
NcAvatar,
CollectionList,
InfoIcon,
NcAvatar,
NcButton,
NcPopover,
SharingEntryInternal,
SharingEntrySimple,
SharingInherited,
Expand All @@ -120,6 +198,7 @@ export default {
SharingList,
SharingDetailsTab,
},
mixins: [ShareDetails],

data() {
return {
Expand All @@ -142,6 +221,10 @@ export default {
showSharingDetailsView: false,
shareDetailsData: {},
returnFocusElement: null,

internalSharesHelpText: t('files_sharing', 'Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access.'),
externalSharesHelpText: t('files_sharing', 'Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID.'),
additionalSharesHelpText: t('files_sharing', 'Shares that are not part of the internal or external shares. This can be shares from apps or other sources.'),
}
},

Expand Down Expand Up @@ -425,10 +508,47 @@ export default {

&__content {
padding: 0 6px;

section {
padding-bottom: 16px;

.section-header {
margin-top: 2px;
margin-bottom: 2px;
display: flex;
align-items: center;
padding-bottom: 4px;

h4 {
margin: 0;
font-size: 16px;
}

.visually-hidden {
display: none;
}

.hint-icon {
color: var(--color-primary-element);
}

}

}

& > section:not(:last-child) {
border-bottom: 2px solid var(--color-border);
}

}

&__additionalContent {
margin: 44px 0;
}
}

.hint-body {
max-width: 300px;
padding: var(--border-radius-element);
}
</style>
2 changes: 2 additions & 0 deletions dist/1191-1191.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/1191-1191.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/1191-1191.js.map.license
2 changes: 0 additions & 2 deletions dist/4253-4253.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/4253-4253.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/4253-4253.js.map.license

This file was deleted.

2 changes: 2 additions & 0 deletions dist/4813-4813.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/4813-4813.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/4813-4813.js.map.license
2 changes: 0 additions & 2 deletions dist/6244-6244.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/6244-6244.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/6244-6244.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-init.js.map

Large diffs are not rendered by default.

Loading