Compare commits
5 Commits
24fdaa2326
...
30704fdfbc
Author | SHA1 | Date |
---|---|---|
Derek | 30704fdfbc | |
Derek | cd37bfe423 | |
Derek | 5ac76c3fa2 | |
Derek | 415174c662 | |
Derek | 1e0134e61b |
|
@ -18,6 +18,7 @@ import { defineComponent } from 'vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import MkAvatars from '@/components/avatars.vue';
|
import MkAvatars from '@/components/avatars.vue';
|
||||||
|
import makeList from '@/scripts/new-list.ts';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
|
|
||||||
|
@ -48,13 +49,11 @@ export default defineComponent({
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async create() {
|
async create() {
|
||||||
const { canceled, result: name } = await os.inputText({
|
const created = await makeList();
|
||||||
title: this.$ts.enterListName,
|
if (created) {
|
||||||
});
|
|
||||||
if (canceled) return;
|
|
||||||
await os.api('users/lists/create', { name: name });
|
|
||||||
this.$refs.list.reload();
|
this.$refs.list.reload();
|
||||||
os.success();
|
os.success();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
|
export default async function makeList() {
|
||||||
|
const { canceled, result: name } = await os.inputText({
|
||||||
|
title: i18n.locale.enterListName,
|
||||||
|
});
|
||||||
|
if (canceled) return false;
|
||||||
|
await os.api('users/lists/create', { name: name });
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-app" @contextmenu.self.prevent="onContextmenu">
|
<div class="mk-app" @contextmenu.self.prevent="onContextmenu">
|
||||||
<XSidebar ref="menu" class="menu" :default-hidden="true"/>
|
|
||||||
|
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
|
@ -41,13 +39,13 @@
|
||||||
<div v-if="lists" class="container">
|
<div v-if="lists" class="container">
|
||||||
<div class="header">{{ $ts.lists }}<button class="_button add" @click="addList"><i class="fas fa-plus"></i></button></div>
|
<div class="header">{{ $ts.lists }}<button class="_button add" @click="addList"><i class="fas fa-plus"></i></button></div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<MkA v-for="list in lists" :key="list.id" :to="`/my/list/${ list.id }`" class="item" :class="{ active: tl === `list:${ list.id }` }"><i class="fas fa-list-ul icon"></i>{{ list.name }}</MkA>
|
<MkA v-for="list in lists" :key="list.id" :to="`/timeline/list/${ list.id }`" class="item" :class="{ active: tl === `list:${ list.id }` }"><i class="fas fa-list-ul icon"></i>{{ list.name }}</MkA>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="antennas" class="container">
|
<div v-if="antennas" class="container">
|
||||||
<div class="header">{{ $ts.antennas }}<button class="_button add" @click="addAntenna"><i class="fas fa-plus"></i></button></div>
|
<div class="header">{{ $ts.antennas }}<button class="_button add" @click="addAntenna"><i class="fas fa-plus"></i></button></div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<MkA v-for="antenna in antennas" :key="antenna.id" :to="`/my/antenna/${ antenna.id }`" class="item" :class="{ active: tl === `antenna:${ antenna.id }` }"><i class="fas fa-satellite icon"></i>{{ antenna.name }}</MkA>
|
<MkA v-for="antenna in antennas" :key="antenna.id" :to="`/timeline/antenna/${ antenna.id }`" class="item" :class="{ active: tl === `antenna:${ antenna.id }` }"><i class="fas fa-satellite icon"></i>{{ antenna.name }}</MkA>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -90,6 +88,18 @@
|
||||||
<XWidgets/>
|
<XWidgets/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<transition name="menu-back">
|
||||||
|
<div v-if="drawerMenuShowing"
|
||||||
|
class="menuDrawer-back _modalBg"
|
||||||
|
@click="hideMenu"
|
||||||
|
@touchstart.passive="hideMenu"
|
||||||
|
></div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<transition name="menu">
|
||||||
|
<XDrawerMenu v-if="drawerMenuShowing" class="menuDrawer"/>
|
||||||
|
</transition>
|
||||||
|
|
||||||
<XCommon/>
|
<XCommon/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -97,7 +107,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, defineAsyncComponent } from 'vue';
|
import { defineComponent, defineAsyncComponent } from 'vue';
|
||||||
import { instanceName, url } from '@/config';
|
import { instanceName, url } from '@/config';
|
||||||
import XSidebar from '@/ui/_common_/sidebar.vue';
|
import XDrawerMenu from '@/ui/_common_/sidebar-for-mobile.vue';
|
||||||
import XWidgets from './widgets.vue';
|
import XWidgets from './widgets.vue';
|
||||||
import XCommon from '../_common_/common.vue';
|
import XCommon from '../_common_/common.vue';
|
||||||
import XSide from './side.vue';
|
import XSide from './side.vue';
|
||||||
|
@ -106,6 +116,7 @@ import * as os from '@/os';
|
||||||
import { router } from '@/router';
|
import { router } from '@/router';
|
||||||
import { menuDef } from '@/menu';
|
import { menuDef } from '@/menu';
|
||||||
import { search } from '@/scripts/search';
|
import { search } from '@/scripts/search';
|
||||||
|
import makeList from '@/scripts/new-list.ts';
|
||||||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||||
import { store } from './store';
|
import { store } from './store';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
|
@ -114,7 +125,7 @@ import { openAccountMenu } from '@/account';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XCommon,
|
XCommon,
|
||||||
XSidebar,
|
XDrawerMenu,
|
||||||
XWidgets,
|
XWidgets,
|
||||||
XSide, // NOTE: dynamic importするとAsyncComponentWrapperが間に入るせいでref取得できなくて面倒になる
|
XSide, // NOTE: dynamic importするとAsyncComponentWrapperが間に入るせいでref取得できなくて面倒になる
|
||||||
XHeaderClock,
|
XHeaderClock,
|
||||||
|
@ -138,6 +149,7 @@ export default defineComponent({
|
||||||
currentChannel: null,
|
currentChannel: null,
|
||||||
menuDef: menuDef,
|
menuDef: menuDef,
|
||||||
sideViewOpening: false,
|
sideViewOpening: false,
|
||||||
|
drawerMenuShowing: false,
|
||||||
instanceName,
|
instanceName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -160,12 +172,38 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
$route() {
|
||||||
|
this.drawerMenuShowing = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (window.innerWidth < 1024) {
|
if (window.innerWidth < 1024) {
|
||||||
localStorage.setItem('ui', 'default');
|
localStorage.setItem('ui', 'default');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
this.getSidebarContent();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addChannel() {
|
||||||
|
this.$router.push('/channels/new');
|
||||||
|
},
|
||||||
|
|
||||||
|
addAntenna() {
|
||||||
|
this.$router.push('/my/antennas/create');
|
||||||
|
},
|
||||||
|
|
||||||
|
async addList() {
|
||||||
|
const success = await makeList();
|
||||||
|
if (success) {
|
||||||
|
os.success();
|
||||||
|
this.getSidebarContent();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getSidebarContent() {
|
||||||
os.api('users/lists/list').then(lists => {
|
os.api('users/lists/list').then(lists => {
|
||||||
this.lists = lists;
|
this.lists = lists;
|
||||||
});
|
});
|
||||||
|
@ -184,9 +222,7 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
|
||||||
changePage(page) {
|
changePage(page) {
|
||||||
console.log(page);
|
|
||||||
if (page == null) return;
|
if (page == null) return;
|
||||||
if (page[symbols.PAGE_INFO]) {
|
if (page[symbols.PAGE_INFO]) {
|
||||||
this.pageInfo = page[symbols.PAGE_INFO];
|
this.pageInfo = page[symbols.PAGE_INFO];
|
||||||
|
@ -195,7 +231,11 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
showMenu() {
|
showMenu() {
|
||||||
this.$refs.menu.show();
|
this.drawerMenuShowing = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
hideMenu() {
|
||||||
|
this.drawerMenuShowing = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
post() {
|
post() {
|
||||||
|
@ -257,6 +297,28 @@ export default defineComponent({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.menu-enter-active,
|
||||||
|
.menu-leave-active {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0);
|
||||||
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
||||||
|
}
|
||||||
|
.menu-enter-from,
|
||||||
|
.menu-leave-active {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-240px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-back-enter-active,
|
||||||
|
.menu-back-leave-active {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
||||||
|
}
|
||||||
|
.menu-back-enter-from,
|
||||||
|
.menu-back-leave-active {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.mk-app {
|
.mk-app {
|
||||||
$header-height: 54px; // TODO: どこかに集約したい
|
$header-height: 54px; // TODO: どこかに集約したい
|
||||||
$ui-font-size: 1em; // TODO: どこかに集約したい
|
$ui-font-size: 1em; // TODO: どこかに集約したい
|
||||||
|
@ -459,5 +521,23 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .menuDrawer-back {
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .menuDrawer {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1005;
|
||||||
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
||||||
|
height: calc(var(--vh, 1vh) * 100);
|
||||||
|
width: 240px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -95,9 +95,28 @@ export default defineComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
watch: {
|
||||||
this.channel = await os.api('channels/show', { channelId: this.channelId });
|
channelId() {
|
||||||
|
this.connection.dispose();
|
||||||
|
this.$refs.tl.reload();
|
||||||
|
this.setup();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.setup();
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeUnmount() {
|
||||||
|
this.connection.dispose();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async setup() {
|
||||||
const prepend = note => {
|
const prepend = note => {
|
||||||
(this.$refs.tl as any).prepend(note);
|
(this.$refs.tl as any).prepend(note);
|
||||||
|
|
||||||
|
@ -124,17 +143,9 @@ export default defineComponent({
|
||||||
...this.baseQuery
|
...this.baseQuery
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.channel = await os.api('channels/show', { channelId: this.channelId });
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeUnmount() {
|
|
||||||
this.connection.dispose();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
focus() {
|
focus() {
|
||||||
this.$refs.body.focus();
|
this.$refs.body.focus();
|
||||||
},
|
},
|
||||||
|
@ -165,12 +176,12 @@ export default defineComponent({
|
||||||
async toggleChannelFollow() {
|
async toggleChannelFollow() {
|
||||||
if (this.channel.isFollowing) {
|
if (this.channel.isFollowing) {
|
||||||
await os.apiWithDialog('channels/unfollow', {
|
await os.apiWithDialog('channels/unfollow', {
|
||||||
channelId: this.channel.id
|
channelId: this.channelId
|
||||||
});
|
});
|
||||||
this.channel.isFollowing = false;
|
this.channel.isFollowing = false;
|
||||||
} else {
|
} else {
|
||||||
await os.apiWithDialog('channels/follow', {
|
await os.apiWithDialog('channels/follow', {
|
||||||
channelId: this.channel.id
|
channelId: this.channelId
|
||||||
});
|
});
|
||||||
this.channel.isFollowing = true;
|
this.channel.isFollowing = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,7 +536,7 @@ export default defineComponent({
|
||||||
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
||||||
replyId: this.reply ? this.reply.id : undefined,
|
replyId: this.reply ? this.reply.id : undefined,
|
||||||
renoteId: this.renote ? this.renote.id : this.quoteId ? this.quoteId : undefined,
|
renoteId: this.renote ? this.renote.id : this.quoteId ? this.quoteId : undefined,
|
||||||
channelId: this.channel ? this.channel : undefined,
|
channelId: this.channel ? this.channel.id : undefined,
|
||||||
poll: this.poll,
|
poll: this.poll,
|
||||||
cw: this.useCw ? this.cw || '' : undefined,
|
cw: this.useCw ? this.cw || '' : undefined,
|
||||||
localOnly: this.localOnly,
|
localOnly: this.localOnly,
|
||||||
|
|
Loading…
Reference in New Issue