1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-30 07:49:02 +09:00
This commit is contained in:
syuilo 2018-02-22 02:37:04 +09:00
parent 0c092b8050
commit 52c2d7c794
6 changed files with 47 additions and 28 deletions

View File

@ -0,0 +1,5 @@
import Vue from 'vue';
import ui from './ui.vue';
Vue.component('mk-ui', ui);

View File

@ -3,27 +3,27 @@
<header> <header>
<button class="cancel" @click="cancel">%fa:times%</button> <button class="cancel" @click="cancel">%fa:times%</button>
<div> <div>
<span v-if="refs.text" class="text-count { over: refs.text.value.length > 1000 }">{ 1000 - refs.text.value.length }</span> <span v-if="refs.text" class="text-count" :class="{ over: refs.text.value.length > 1000 }">{{ 1000 - refs.text.value.length }}</span>
<button class="submit" @click="post">%i18n:mobile.tags.mk-post-form.submit%</button> <button class="submit" @click="post">%i18n:mobile.tags.mk-post-form.submit%</button>
</div> </div>
</header> </header>
<div class="form"> <div class="form">
<mk-post-preview v-if="opts.reply" post={ opts.reply }/> <mk-post-preview v-if="reply" :post="reply"/>
<textarea ref="text" disabled={ wait } oninput={ update } onkeydown={ onkeydown } onpaste={ onpaste } placeholder={ opts.reply ? '%i18n:mobile.tags.mk-post-form.reply-placeholder%' : '%i18n:mobile.tags.mk-post-form.post-placeholder%' }></textarea> <textarea v-model="text" :disabled="wait" :placeholder="reply ? '%i18n:mobile.tags.mk-post-form.reply-placeholder%' : '%i18n:mobile.tags.mk-post-form.post-placeholder%'"></textarea>
<div class="attaches" show={ files.length != 0 }> <div class="attaches" v-show="files.length != 0">
<ul class="files" ref="attaches"> <ul class="files" ref="attaches">
<li class="file" each={ files } data-id={ id }> <li class="file" v-for="file in files">
<div class="img" style="background-image: url({ url + '?thumbnail&size=128' })" @click="removeFile"></div> <div class="img" :style="`background-image: url(${file.url}?thumbnail&size=128)`" @click="removeFile(file)"></div>
</li> </li>
</ul> </ul>
</div> </div>
<mk-poll-editor v-if="poll" ref="poll" ondestroy={ onPollDestroyed }/> <mk-poll-editor v-if="poll" ref="poll"/>
<mk-uploader @uploaded="attachMedia" @change="onChangeUploadings"/> <mk-uploader @uploaded="attachMedia" @change="onChangeUploadings"/>
<button ref="upload" @click="selectFile">%fa:upload%</button> <button ref="upload" @click="selectFile">%fa:upload%</button>
<button ref="drive" @click="selectFileFromDrive">%fa:cloud%</button> <button ref="drive" @click="selectFileFromDrive">%fa:cloud%</button>
<button class="kao" @click="kao">%fa:R smile%</button> <button class="kao" @click="kao">%fa:R smile%</button>
<button class="poll" @click="addPoll">%fa:chart-pie%</button> <button class="poll" @click="addPoll">%fa:chart-pie%</button>
<input ref="file" type="file" accept="image/*" multiple="multiple" onchange={ changeFile }/> <input ref="file" type="file" accept="image/*" multiple="multiple" @change="onChangeFile"/>
</div> </div>
</div> </div>
</template> </template>
@ -31,9 +31,10 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import getKao from '../../common/scripts/get-kao'; import getKao from '../../../common/scripts/get-kao';
export default Vue.extend({ export default Vue.extend({
props: ['reply'],
data() { data() {
return { return {
posting: false, posting: false,
@ -77,6 +78,9 @@ export default Vue.extend({
cancel() { cancel() {
this.$emit('cancel'); this.$emit('cancel');
this.$destroy(); this.$destroy();
},
kao() {
this.text += getKao();
} }
} }
}); });

View File

@ -9,7 +9,9 @@
<h1> <h1>
<slot>Misskey</slot> <slot>Misskey</slot>
</h1> </h1>
<button v-if="func" @click="func" v-html="funcIcon"></button> <button v-if="func" @click="func">
<slot name="funcIcon"></slot>
</button>
</div> </div>
</div> </div>
</div> </div>
@ -19,11 +21,10 @@
import Vue from 'vue'; import Vue from 'vue';
export default Vue.extend({ export default Vue.extend({
props: ['func', 'funcIcon'], props: ['func'],
data() { data() {
return { return {
func: null, func: null,
funcIcon: null,
hasUnreadNotifications: false, hasUnreadNotifications: false,
hasUnreadMessagingMessages: false, hasUnreadMessagingMessages: false,
connection: null, connection: null,

View File

@ -2,28 +2,28 @@
<div class="mk-ui-nav" :style="{ display: isOpen ? 'block' : 'none' }"> <div class="mk-ui-nav" :style="{ display: isOpen ? 'block' : 'none' }">
<div class="backdrop" @click="parent.toggleDrawer"></div> <div class="backdrop" @click="parent.toggleDrawer"></div>
<div class="body"> <div class="body">
<a class="me" v-if="os.isSignedIn" href={ '/' + I.username }> <router-link class="me" v-if="os.isSignedIn" :to="`/${os.i.username}`">
<img class="avatar" src={ I.avatar_url + '?thumbnail&size=128' } alt="avatar"/> <img class="avatar" :src="`${os.i.avatar_url}?thumbnail&size=128`" alt="avatar"/>
<p class="name">{ I.name }</p> <p class="name">{{ os.i.name }}</p>
</a> </router-link>
<div class="links"> <div class="links">
<ul> <ul>
<li><a href="/">%fa:home%%i18n:mobile.tags.mk-ui-nav.home%%fa:angle-right%</a></li> <li><router-link href="/">%fa:home%%i18n:mobile.tags.mk-ui-nav.home%%fa:angle-right%</router-link></li>
<li><a href="/i/notifications">%fa:R bell%%i18n:mobile.tags.mk-ui-nav.notifications%<template v-if="hasUnreadNotifications">%fa:circle%</template>%fa:angle-right%</a></li> <li><router-link href="/i/notifications">%fa:R bell%%i18n:mobile.tags.mk-ui-nav.notifications%<template v-if="hasUnreadNotifications">%fa:circle%</template>%fa:angle-right%</router-link></li>
<li><a href="/i/messaging">%fa:R comments%%i18n:mobile.tags.mk-ui-nav.messaging%<template v-if="hasUnreadMessagingMessages">%fa:circle%</template>%fa:angle-right%</a></li> <li><router-link href="/i/messaging">%fa:R comments%%i18n:mobile.tags.mk-ui-nav.messaging%<template v-if="hasUnreadMessagingMessages">%fa:circle%</template>%fa:angle-right%</router-link></li>
</ul> </ul>
<ul> <ul>
<li><a href={ _CH_URL_ } target="_blank">%fa:tv%%i18n:mobile.tags.mk-ui-nav.ch%%fa:angle-right%</a></li> <li><a :href="chUrl" target="_blank">%fa:tv%%i18n:mobile.tags.mk-ui-nav.ch%%fa:angle-right%</a></li>
<li><a href="/i/drive">%fa:cloud%%i18n:mobile.tags.mk-ui-nav.drive%%fa:angle-right%</a></li> <li><router-link href="/i/drive">%fa:cloud%%i18n:mobile.tags.mk-ui-nav.drive%%fa:angle-right%</router-link></li>
</ul> </ul>
<ul> <ul>
<li><a @click="search">%fa:search%%i18n:mobile.tags.mk-ui-nav.search%%fa:angle-right%</a></li> <li><a @click="search">%fa:search%%i18n:mobile.tags.mk-ui-nav.search%%fa:angle-right%</a></li>
</ul> </ul>
<ul> <ul>
<li><a href="/i/settings">%fa:cog%%i18n:mobile.tags.mk-ui-nav.settings%%fa:angle-right%</a></li> <li><router-link href="/i/settings">%fa:cog%%i18n:mobile.tags.mk-ui-nav.settings%%fa:angle-right%</router-link></li>
</ul> </ul>
</div> </div>
<a href={ aboutUrl }><p class="about">%i18n:mobile.tags.mk-ui-nav.about%</p></a> <a :href="aboutUrl"><p class="about">%i18n:mobile.tags.mk-ui-nav.about%</p></a>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,9 +1,10 @@
<template> <template>
<div class="mk-ui"> <div class="mk-ui">
<mk-ui-header :func="func" :func-icon="funcIcon"> <x-header :func="func">
<template slot="funcIcon"><slot name="funcIcon"></slot></template>
<slot name="header"></slot> <slot name="header"></slot>
</mk-ui-header> </x-header>
<mk-ui-nav :is-open="isDrawerOpening"/> <x-nav :is-open="isDrawerOpening"/>
<div class="content"> <div class="content">
<slot></slot> <slot></slot>
</div> </div>
@ -13,8 +14,15 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import XHeader from './ui.header.vue';
import XNav from './ui.nav.vue';
export default Vue.extend({ export default Vue.extend({
props: ['title', 'func', 'funcIcon'], components: {
XHeader,
XNav
},
props: ['title', 'func'],
data() { data() {
return { return {
isDrawerOpening: false, isDrawerOpening: false,

View File

@ -1,10 +1,11 @@
<template> <template>
<mk-ui :func="fn" func-icon="%fa:ellipsis-h%"> <mk-ui :func="fn">
<span slot="header"> <span slot="header">
<template v-if="folder">%fa:R folder-open%{{ folder.name }}</template> <template v-if="folder">%fa:R folder-open%{{ folder.name }}</template>
<template v-if="file"><mk-file-type-icon class="icon"/>{{ file.name }}</template> <template v-if="file"><mk-file-type-icon class="icon"/>{{ file.name }}</template>
<template v-else>%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%</template> <template v-else>%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%</template>
</span> </span>
<template slot="funcIcon">%fa:ellipsis-h%</template>
<mk-drive <mk-drive
ref="browser" ref="browser"
:init-folder="folder" :init-folder="folder"