-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No refresh on reconnection setting added. (Experimental Tab only)
- Loading branch information
1 parent
b7f0f3e
commit cc4ad0d
Showing
3 changed files
with
48 additions
and
42 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { confirmDialog } from '../../molecules/confirm-dialog/ConfirmDialog'; | ||
|
||
export const handleBannerUpload = async (url, roomId) => { | ||
const mx = initMatrix.matrixClient; | ||
|
||
const spaceHeaderBody = $('.space-drawer-body'); | ||
const spaceHeader = spaceHeaderBody.find('> .navbar'); | ||
|
||
const bannerPlace = $('.space-banner .avatar__border'); | ||
const bannerImg = $('.space-banner img'); | ||
|
||
if (url === null) { | ||
const isConfirmed = await confirmDialog( | ||
'Remove space banner', | ||
'Are you sure that you want to remove room banner?', | ||
'Remove', | ||
'warning', | ||
); | ||
|
||
if (isConfirmed) { | ||
await mx.sendStateEvent(roomId, 'pony.house.settings', { url }, 'banner'); | ||
|
||
spaceHeaderBody.removeClass('drawer-with-banner'); | ||
spaceHeader.removeClass('banner-mode').css('background-image', ''); | ||
|
||
bannerPlace.css('background-image', '').removeClass('banner-added'); | ||
bannerImg.attr('src', ''); | ||
} | ||
} else { | ||
await mx.sendStateEvent(roomId, 'pony.house.settings', { url }, 'banner'); | ||
|
||
spaceHeaderBody.addClass('drawer-with-banner'); | ||
spaceHeader | ||
.addClass('banner-mode') | ||
.css('background-image', `url("${mx.mxcUrlToHttp(url, 960, 540)}")`); | ||
|
||
bannerPlace | ||
.css('background-image', `url('${mx.mxcUrlToHttp(url, 400, 227)}')`) | ||
.addClass('banner-added'); | ||
bannerImg.attr('src', mx.mxcUrlToHttp(url, 400, 227)); | ||
} | ||
}; |