async load dialogs

This commit is contained in:
Nolan Lawson 2018-02-14 22:02:54 -08:00
parent 72e287acd0
commit 4d58c8cc2d
4 changed files with 19 additions and 10 deletions

View File

@ -0,0 +1,3 @@
export * from './showConfirmationDialog'
export * from './showImageDialog'
export * from './showVideoDialog'

View File

@ -116,8 +116,7 @@
<script> <script>
import { DEFAULT_MEDIA_WIDTH, DEFAULT_MEDIA_HEIGHT } from '../../_static/media' import { DEFAULT_MEDIA_WIDTH, DEFAULT_MEDIA_HEIGHT } from '../../_static/media'
import { imgLoad, imgLoadError } from '../../_utils/events' import { imgLoad, imgLoadError } from '../../_utils/events'
import { showVideoDialog } from '../dialog/showVideoDialog' import { importDialogs } from '../../_utils/asyncModules'
import { showImageDialog } from '../dialog/showImageDialog'
import { mouseover } from '../../_utils/events' import { mouseover } from '../../_utils/events'
import NonAutoplayGifv from '../NonAutoplayGifv.html' import NonAutoplayGifv from '../NonAutoplayGifv.html'
@ -139,17 +138,19 @@
noNativeWidthHeight: (smallWidth, smallHeight) => typeof smallWidth !== 'number' || typeof smallHeight !== 'number' noNativeWidthHeight: (smallWidth, smallHeight) => typeof smallWidth !== 'number' || typeof smallHeight !== 'number'
}, },
methods: { methods: {
onClickPlayVideoButton() { async onClickPlayVideoButton() {
let media = this.get('media') let media = this.get('media')
let width = this.get('modalWidth') let width = this.get('modalWidth')
let height = this.get('modalHeight') let height = this.get('modalHeight')
showVideoDialog(media.preview_url, media.url, width, height, media.description) let dialogs = await importDialogs()
dialogs.showVideoDialog(media.preview_url, media.url, width, height, media.description)
}, },
onClickShowImageButton() { async onClickShowImageButton() {
let media = this.get('media') let media = this.get('media')
let width = this.get('modalWidth') let width = this.get('modalWidth')
let height = this.get('modalHeight') let height = this.get('modalHeight')
showImageDialog(media.preview_url, media.url, media.type, width, height, media.description) let dialogs = await importDialogs()
dialogs.showImageDialog(media.preview_url, media.url, media.type, width, height, media.description)
} }
}, },
data: () => ({ data: () => ({

View File

@ -32,3 +32,7 @@ export const importWebSocketClient = () => import(
export const importPseudoVirtualList = () => import( export const importPseudoVirtualList = () => import(
/* webpackChunkName: 'PseudoVirtualList' */ '../_components/pseudoVirtualList/PseudoVirtualList.html' /* webpackChunkName: 'PseudoVirtualList' */ '../_components/pseudoVirtualList/PseudoVirtualList.html'
).then(mod => mod.default) ).then(mod => mod.default)
export const importDialogs = () => import(
/* webpackChunkName: 'dialogs' */ '../_components/dialog/dialogs.js'
)

View File

@ -99,7 +99,7 @@
import SettingsLayout from '../_components/SettingsLayout.html' import SettingsLayout from '../_components/SettingsLayout.html'
import ExternalLink from '../../_components/ExternalLink.html' import ExternalLink from '../../_components/ExternalLink.html'
import Avatar from '../../_components/Avatar.html' import Avatar from '../../_components/Avatar.html'
import { showConfirmationDialog } from '../../_components/dialog/showConfirmationDialog' import { importDialogs } from '../../_utils/asyncModules'
import { import {
changeTheme, changeTheme,
switchToInstance, switchToInstance,
@ -139,11 +139,12 @@
let instanceName = this.get('instanceName') let instanceName = this.get('instanceName')
switchToInstance(instanceName) switchToInstance(instanceName)
}, },
onLogOut(e) { async onLogOut(e) {
e.preventDefault() e.preventDefault()
let instanceName = this.get('instanceName') let instanceName = this.get('instanceName')
showConfirmationDialog({ let dialogs = await importDialogs()
dialogs.showConfirmationDialog({
text: `Log out of ${instanceName}?`, text: `Log out of ${instanceName}?`,
onPositive() { onPositive() {
logOutOfInstance(instanceName) logOutOfInstance(instanceName)