File size: 2,183 Bytes
3a1d71c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
import { Button, Input, Modal, message } from 'ant-design-vue'
import { ref } from 'vue'
import * as Path from '@/util/path'
import { FileNodeInfo, mkdirs } from '@/api/files'
import { t } from '@/i18n'
import { downloadFiles, globalEvents, toRawFileUrl } from '@/util'
import { DownloadOutlined } from '@/icon'
import { isStandalone } from '@/util/env'
import { rebuildImageIndex } from '@/api/db'
export const openCreateFlodersModal = (base: string) => {
const floderName = ref('')
return new Promise<void>((resolve) => {
Modal.confirm({
title: t('inputFolderName'),
content: () => <Input v-model:value={floderName.value} />,
async onOk() {
if (!floderName.value) {
return
}
const dest = Path.join(base, floderName.value)
await mkdirs(dest)
resolve()
}
})
})
}
export const MultiSelectTips = () => (
<p
style={{
background: 'var(--zp-secondary-background)',
padding: '8px',
borderLeft: '4px solid var(--primary-color)'
}}
>
Tips: {t('multiSelectTips')}
</p>
)
export const openVideoModal = (file: FileNodeInfo) => {
Modal.confirm({
width: '80vw',
title: file.name,
icon: null,
content: () => (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column'
}}
>
<video style={{ maxHeight: isStandalone ? '80vh' : '60vh' }} src={toRawFileUrl(file)} controls autoplay></video>
<div class="actions" style={{ marginTop: '16px' }}>
<Button onClick={() => downloadFiles([toRawFileUrl(file, true)])}>
{{
icon: <DownloadOutlined/>,
default: t('download')
}}
</Button>
</div>
</div>
),
maskClosable: true,
wrapClassName: 'hidden-antd-btns-modal'
})
}
export const openRebuildImageIndexModal = () => {
Modal.confirm({
title: t('confirmRebuildImageIndex'),
onOk: async () => {
await rebuildImageIndex()
globalEvents.emit('searchIndexExpired')
message.success(t('rebuildComplete'))
}
})
}
|