This commit is contained in:
syuilo 2018-02-17 18:14:23 +09:00
parent 283c64e6f1
commit 61b95e0c26
11 changed files with 179 additions and 121 deletions

View file

@ -1,112 +0,0 @@
<mk-select-folder-from-drive-window>
<mk-window ref="window" is-modal={ true } width={ '800px' } height={ '500px' }>
<yield to="header">
<mk-raw content={ parent.title }/>
</yield>
<yield to="content">
<mk-drive-browser ref="browser"/>
<div>
<button class="cancel" @click="parent.close">キャンセル</button>
<button class="ok" @click="parent.ok">決定</button>
</div>
</yield>
</mk-window>
<style lang="stylus" scoped>
:scope
> mk-window
[data-yield='header']
> mk-raw
> [data-fa]
margin-right 4px
[data-yield='content']
> mk-drive-browser
height calc(100% - 72px)
> div
height 72px
background lighten($theme-color, 95%)
.ok
.cancel
display block
position absolute
bottom 16px
cursor pointer
padding 0
margin 0
width 120px
height 40px
font-size 1em
outline none
border-radius 4px
&:focus
&:after
content ""
pointer-events none
position absolute
top -5px
right -5px
bottom -5px
left -5px
border 2px solid rgba($theme-color, 0.3)
border-radius 8px
&:disabled
opacity 0.7
cursor default
.ok
right 16px
color $theme-color-foreground
background linear-gradient(to bottom, lighten($theme-color, 25%) 0%, lighten($theme-color, 10%) 100%)
border solid 1px lighten($theme-color, 15%)
&:not(:disabled)
font-weight bold
&:hover:not(:disabled)
background linear-gradient(to bottom, lighten($theme-color, 8%) 0%, darken($theme-color, 8%) 100%)
border-color $theme-color
&:active:not(:disabled)
background $theme-color
border-color $theme-color
.cancel
right 148px
color #888
background linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%)
border solid 1px #e2e2e2
&:hover
background linear-gradient(to bottom, #f9f9f9 0%, #ececec 100%)
border-color #dcdcdc
&:active
background #ececec
border-color #dcdcdc
</style>
<script lang="typescript">
this.files = [];
this.title = this.opts.title || '%fa:R folder%フォルダを選択';
this.on('mount', () => {
this.$refs.window.on('closed', () => {
this.$destroy();
});
});
this.close = () => {
this.$refs.window.close();
};
this.ok = () => {
this.$emit('selected', this.$refs.window.refs.browser.folder);
this.$refs.window.close();
};
</script>
</mk-select-folder-from-drive-window>

View file

@ -0,0 +1,17 @@
import MkChooseFolderFromDriveWindow from '../../../common/views/components/choose-folder-from-drive-window.vue';
export default function(this: any, opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new MkChooseFolderFromDriveWindow({
parent: this,
propsData: {
title: o.title
}
}).$mount();
w.$once('selected', folder => {
res(folder);
});
document.body.appendChild(w.$el);
});
}

View file

@ -10,6 +10,8 @@ import fuckAdBlock from './scripts/fuck-ad-block';
import HomeStreamManager from '../common/scripts/streaming/home-stream-manager';
import composeNotification from '../common/scripts/compose-notification';
import chooseDriveFolder from './api/choose-drive-folder';
import MkIndex from './views/pages/index.vue';
/**
@ -27,7 +29,9 @@ init(async (launch) => {
// Register components
require('./views/components');
const app = launch();
const app = launch({
chooseDriveFolder
});
/**
* Init Notification

View file

@ -14,7 +14,7 @@
/>
<div :class="$style.footer">
<button :class="$style.upload" title="PCからドライブにファイルをアップロード" @click="upload">%fa:upload%</button>
<button :class="$style.cancel" @click="close">キャンセル</button>
<button :class="$style.cancel" @click="cancel">キャンセル</button>
<button :class="$style.ok" :disabled="multiple && files.length == 0" @click="ok">決定</button>
</div>
</mk-window>
@ -50,6 +50,9 @@ export default Vue.extend({
ok() {
this.$emit('selected', this.multiple ? this.files : this.files[0]);
(this.$refs.window as any).close();
},
cancel() {
(this.$refs.window as any).close();
}
}
});

View file

@ -0,0 +1,112 @@
<template>
<mk-window ref="window" is-modal width='800px' height='500px' @closed="$destroy">
<span slot="header">
<span v-html="title" :class="$style.title"></span>
</span>
<mk-drive
ref="browser"
:class="$style.browser"
:multiple="false"
/>
<div :class="$style.footer">
<button :class="$style.cancel" @click="close">キャンセル</button>
<button :class="$style.ok" @click="ok">決定</button>
</div>
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: {
title: {
default: '%fa:R folder%フォルダを選択'
}
},
methods: {
ok() {
this.$emit('selected', (this.$refs.browser as any).folder);
(this.$refs.window as any).close();
},
cancel() {
(this.$refs.window as any).close();
}
}
});
</script>
<style lang="stylus" module>
.title
> [data-fa]
margin-right 4px
.browser
height calc(100% - 72px)
.footer
height 72px
background lighten($theme-color, 95%)
.ok
.cancel
display block
position absolute
bottom 16px
cursor pointer
padding 0
margin 0
width 120px
height 40px
font-size 1em
outline none
border-radius 4px
&:focus
&:after
content ""
pointer-events none
position absolute
top -5px
right -5px
bottom -5px
left -5px
border 2px solid rgba($theme-color, 0.3)
border-radius 8px
&:disabled
opacity 0.7
cursor default
.ok
right 16px
color $theme-color-foreground
background linear-gradient(to bottom, lighten($theme-color, 25%) 0%, lighten($theme-color, 10%) 100%)
border solid 1px lighten($theme-color, 15%)
&:not(:disabled)
font-weight bold
&:hover:not(:disabled)
background linear-gradient(to bottom, lighten($theme-color, 8%) 0%, darken($theme-color, 8%) 100%)
border-color $theme-color
&:active:not(:disabled)
background $theme-color
border-color $theme-color
.cancel
right 148px
color #888
background linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%)
border solid 1px #e2e2e2
&:hover
background linear-gradient(to bottom, #f9f9f9 0%, #ececec 100%)
border-color #dcdcdc
&:active
background #ececec
border-color #dcdcdc
</style>

View file

@ -0,0 +1,59 @@
<template>
<div class="mkw-messaging">
<p class="title" v-if="props.design == 0">%fa:comments%%i18n:desktop.tags.mk-messaging-home-widget.title%</p>
<mk-messaging ref="index" compact @navigate="navigate"/>
</div>
</template>
<script lang="ts">
import define from '../../../define-widget';
export default define({
name: 'messaging',
props: {
design: 0
}
}).extend({
methods: {
navigate(user) {
if (this.platform == 'desktop') {
this.wapi_openMessagingRoomWindow(user);
} else {
// TODO: open room page in new tab
}
},
func() {
if (this.props.design == 1) {
this.props.design = 0;
} else {
this.props.design++;
}
}
}
});
</script>
<style lang="stylus" scoped>
.mkw-messaging
overflow hidden
background #fff
border solid 1px rgba(0, 0, 0, 0.075)
border-radius 6px
> .title
z-index 2
margin 0
padding 0 16px
line-height 42px
font-size 0.9em
font-weight bold
color #888
box-shadow 0 1px rgba(0, 0, 0, 0.07)
> [data-fa]
margin-right 4px
> .mk-messaging
max-height 250px
overflow auto
</style>