Skip to content

Commit 4eaa871

Browse files
authored
Merge pull request #71 from nextmcloud/nmc/5377-web-safari-mobile-ui-bug-collection
zooming out will retain the shared folder icon without breaking
2 parents bf3eaf5 + 5fa2a5c commit 4eaa871

1 file changed

Lines changed: 48 additions & 51 deletions

File tree

src/views/SharingTab.vue

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -50,52 +50,32 @@
5050
</p>
5151

5252
<!-- add new share input -->
53-
<SharingInput v-if="!loading && false"
54-
:can-reshare="canReshare"
55-
:file-info="fileInfo"
56-
:link-shares="linkShares"
57-
:reshare="reshare"
58-
:shares="shares"
59-
:is-shared-with-me="isSharedWithMe"
60-
@open-sharing-details="toggleShareDetailsView"
61-
@open-sharing-details-all="toggleShareDetailsViewAll" />
53+
<SharingInput v-if="!loading && false" :can-reshare="canReshare" :file-info="fileInfo"
54+
:link-shares="linkShares" :reshare="reshare" :shares="shares" :is-shared-with-me="isSharedWithMe"
55+
@open-sharing-details="toggleShareDetailsView" @open-sharing-details-all="toggleShareDetailsViewAll" />
6256

6357
<!-- link shares list -->
64-
<SharingLinkList v-if="!loading"
65-
ref="linkShareList"
66-
:can-reshare="canReshare"
67-
:file-info="fileInfo"
68-
:shares="linkShares"
69-
@open-sharing-details="toggleShareDetailsView" />
58+
<SharingLinkList v-if="!loading" ref="linkShareList" :can-reshare="canReshare" :file-info="fileInfo"
59+
:shares="linkShares" @open-sharing-details="toggleShareDetailsView" />
7060

7161
<!-- other shares list -->
72-
<SharingList v-if="!loading && canReshare"
73-
ref="shareList"
74-
:shares="shares"
75-
:file-info="fileInfo"
62+
<SharingList v-if="!loading && canReshare" ref="shareList" :shares="shares" :file-info="fileInfo"
7663
@open-sharing-details="toggleShareDetailsView" />
7764

7865
<OpenSharingButton v-if="canReshare" :file-info="fileInfo" />
7966
</div>
8067

8168
<!-- share details -->
8269
<div v-else>
83-
<SharingDetailsTab :file-info="shareDetailsData.fileInfo"
84-
:share="shareDetailsData.share"
85-
:share-all="shareDetailsDataAll"
86-
:resharing-allowed-global="config.isResharingAllowed"
87-
@close-sharing-details="toggleShareDetailsView"
88-
@add:share="addShare"
89-
@remove:share="removeShare" />
70+
<SharingDetailsTab :file-info="shareDetailsData.fileInfo" :share="shareDetailsData.share"
71+
:share-all="shareDetailsDataAll" :resharing-allowed-global="config.isResharingAllowed"
72+
@close-sharing-details="toggleShareDetailsView" @add:share="addShare" @remove:share="removeShare" />
9073
</div>
9174

9275
<!-- additional entries, use it with cautious -->
93-
<div v-for="(section, index) in sections"
94-
:ref="'section-' + index"
95-
:key="index"
76+
<div v-for="(section, index) in sections" :ref="'section-' + index" :key="index"
9677
class="sharingTab__additionalContent">
97-
<component :is="section($refs['section-' + index], fileInfo)"
98-
:file-info="fileInfo" />
78+
<component :is="section($refs['section-' + index], fileInfo)" :file-info="fileInfo" />
9979
</div>
10080
</div>
10181
</template>
@@ -186,41 +166,57 @@ export default {
186166
return
187167
}
188168
189-
const figureDiv = document.querySelector('.app-sidebar-header__figure')
169+
const figureDiv = document.getElementsByClassName('app-sidebar-header__figure')[0]
190170
if (!figureDiv) {
191171
return
192172
}
193173
194-
const rawFolderImage = figureDiv.style.backgroundImage || getComputedStyle(figureDiv).backgroundImage
195-
let folderUrl = (rawFolderImage && rawFolderImage !== 'none')
196-
? (rawFolderImage.trim().startsWith('url(') ? rawFolderImage.trim() : `url("${rawFolderImage.trim()}")`)
197-
: null
198-
199-
if (folderUrl && folderUrl.includes('folder-shared.svg')) {
200-
folderUrl = folderUrl.replace('folder-shared.svg', 'folder.svg')
201-
}
202-
203174
const overlayLinkIcon = getComputedStyle(document.documentElement)
204175
.getPropertyValue('--original-icon-folder-overlay-share-white')
205176
.trim()
206177
207-
const applyOverlay = () => {
208-
const composed = folderUrl ? `${overlayLinkIcon}, ${folderUrl}` : overlayLinkIcon
209-
figureDiv.style.setProperty('background-image', composed, 'important')
210-
figureDiv.style.setProperty('background-repeat', 'no-repeat, no-repeat', 'important')
211-
figureDiv.style.setProperty('background-position', 'center, center', 'important')
212-
figureDiv.style.setProperty('background-size', '2.1rem 2.5rem, contain', 'important')
178+
const overlayClass = 'nmcsharing-share-overlay'
179+
let overlayElement = figureDiv.querySelector(`.${overlayClass}`)
180+
181+
const ensureOverlayElement = () => {
182+
if (!overlayElement) {
183+
overlayElement = document.createElement('span')
184+
overlayElement.className = overlayClass
185+
overlayElement.style.position = 'absolute'
186+
overlayElement.style.inset = '0'
187+
overlayElement.style.pointerEvents = 'none'
188+
overlayElement.style.display = 'block'
189+
overlayElement.style.zIndex = '1'
190+
figureDiv.appendChild(overlayElement)
191+
}
192+
193+
const figurePosition = getComputedStyle(figureDiv).position
194+
if (figurePosition === 'static') {
195+
figureDiv.style.setProperty('position', 'relative', 'important')
196+
}
197+
198+
overlayElement.style.setProperty('background-image', overlayLinkIcon, 'important')
199+
overlayElement.style.setProperty('background-repeat', 'no-repeat', 'important')
200+
overlayElement.style.setProperty('background-position', 'center', 'important')
201+
overlayElement.style.setProperty('background-size', '2.1rem 2.5rem', 'important')
202+
return overlayElement
203+
}
204+
205+
const folderUrl = 'url("/customapps/nmctheme/img/filetypes/folder.svg")'
206+
207+
const restoreOriginalBackground = () => {
208+
figureDiv.style.setProperty('background-image', folderUrl, 'important')
213209
}
214210
215-
// applyOverlay()
216-
// window.requestAnimationFrame(applyOverlay)
217211
setTimeout(() => {
218212
if (file.mimetype === 'httpd/unix-directory') {
219-
applyOverlay()
213+
restoreOriginalBackground()
214+
ensureOverlayElement()
220215
}
221216
}, 50)
222217
},
223218
219+
224220
/**
225221
* Update current fileInfo and fetch new data
226222
*
@@ -474,7 +470,8 @@ export default {
474470
&__content {
475471
padding: 0px;
476472
477-
p, .sharing-entry__noshare {
473+
p,
474+
.sharing-entry__noshare {
478475
margin-bottom: 1rem
479476
}
480477
}

0 commit comments

Comments
 (0)