This commit is contained in:
syuilo 2021-02-16 13:13:42 +09:00
parent 70826d326b
commit 5cdd9d2027
6 changed files with 78 additions and 48 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="mfcuwfyp"> <div class="mfcuwfyp _noGap_">
<XList class="notifications" :items="items" v-slot="{ item: notification }"> <XList class="notifications" :items="items" v-slot="{ item: notification }">
<XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :note="notification.note" @update:note="noteUpdated(notification.note, $event)" :key="notification.id"/> <XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :note="notification.note" @update:note="noteUpdated(notification.note, $event)" :key="notification.id"/>
<XNotification v-else :notification="notification" :with-time="true" :full="true" class="_panel notification" :key="notification.id"/> <XNotification v-else :notification="notification" :with-time="true" :full="true" class="_panel notification" :key="notification.id"/>

View File

@ -9,11 +9,6 @@ export default defineComponent({
type: Array, type: Array,
required: true, required: true,
}, },
direction: {
type: String,
required: false,
default: 'down'
},
reversed: { reversed: {
type: Boolean, type: Boolean,
required: false, required: false,
@ -37,14 +32,10 @@ export default defineComponent({
}); });
} }
return h(!this.reversed ? TransitionGroup : 'div', !this.reversed ? { return h(TransitionGroup, {
class: 'hmjzthxl', class: 'hmjzthxl',
name: 'list', name: this.reversed ? 'list-reversed' : 'list',
tag: 'div', tag: 'div',
'data-direction': this.direction,
'data-reversed': this.reversed ? 'true' : 'false',
} : {
class: 'hmjzthxl',
}, this.items.map((item, i) => { }, this.items.map((item, i) => {
const el = this.$slots.default({ const el = this.$slots.default({
item: item item: item
@ -95,23 +86,20 @@ export default defineComponent({
> .list-move { > .list-move {
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1); transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
} }
> .list-enter-active { > .list-enter-active {
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1); transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1);
} }
&[data-direction="up"] {
> .list-enter-from {
opacity: 0;
transform: translateY(64px);
}
}
&[data-direction="down"] {
> .list-enter-from { > .list-enter-from {
opacity: 0; opacity: 0;
transform: translateY(-64px); transform: translateY(-64px);
} }
> .list-reversed-enter-active, > .list-reversed-leave-active {
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}
> .list-reversed-enter-from {
opacity: 0;
transform: translateY(64px);
} }
} }
</style> </style>

View File

@ -36,7 +36,7 @@
</div> </div>
</div> </div>
<div class="container" v-if="followedChannels"> <div class="container" v-if="followedChannels">
<div class="header">{{ $ts.channel }}<button class="_button add"><Fa :icon="faPlus"/></button></div> <div class="header">{{ $ts.channel }} ({{ $ts.following }})<button class="_button add"><Fa :icon="faPlus"/></button></div>
<div class="body"> <div class="body">
<MkA v-for="channel in followedChannels" :key="channel.id" :to="`/channels/${ channel.id }`" class="item" :class="{ active: tl === `channel:${ channel.id }`, read: !channel.hasUnreadNote }"><Fa :icon="faSatelliteDish" class="icon"/>{{ channel.name }}</MkA> <MkA v-for="channel in followedChannels" :key="channel.id" :to="`/channels/${ channel.id }`" class="item" :class="{ active: tl === `channel:${ channel.id }`, read: !channel.hasUnreadNote }"><Fa :icon="faSatelliteDish" class="icon"/>{{ channel.name }}</MkA>
</div> </div>
@ -81,14 +81,17 @@
</template> </template>
<template v-else-if="tl.startsWith('channel:')"> <template v-else-if="tl.startsWith('channel:')">
<Fa :icon="faSatelliteDish" class="icon"/> <Fa :icon="faSatelliteDish" class="icon"/>
<div class="title" v-if="currentChannel">{{ currentChannel.name }}</div> <div class="title" v-if="currentChannel">{{ currentChannel.name }}<div class="description">{{ currentChannel.description }}</div></div>
<div class="description" v-if="currentChannel">{{ currentChannel.description }}</div>
</template> </template>
</div> </div>
<div class="right"> <div class="right">
<XHeaderClock/> <XHeaderClock class="clock"/>
<button class="_button search"> <button class="_button button follow" v-if="tl.startsWith('channel:') && currentChannel" :class="{ followed: currentChannel.isFollowing }" @click="toggleChannelFollow">
<Fa v-if="currentChannel.isFollowing" :icon="faStar"/>
<Fa v-else :icon="farStar"/>
</button>
<button class="_button button search" @click="search">
<Fa :icon="faSearch"/> <Fa :icon="faSearch"/>
</button> </button>
</div> </div>
@ -111,8 +114,8 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, defineAsyncComponent } from 'vue'; import { defineComponent, defineAsyncComponent } from 'vue';
import { faLayerGroup, faBars, faHome, faCircle, faWindowMaximize, faColumns, faPencilAlt, faShareAlt, faSatelliteDish, faListUl, faSatellite, faCog, faSearch, faPlus } from '@fortawesome/free-solid-svg-icons'; import { faLayerGroup, faBars, faHome, faCircle, faWindowMaximize, faColumns, faPencilAlt, faShareAlt, faSatelliteDish, faListUl, faSatellite, faCog, faSearch, faPlus, faStar } from '@fortawesome/free-solid-svg-icons';
import { faBell } from '@fortawesome/free-regular-svg-icons'; import { faBell, faStar as farStar } from '@fortawesome/free-regular-svg-icons';
import { instanceName } from '@/config'; import { instanceName } from '@/config';
import XSidebar from '@/components/sidebar.vue'; import XSidebar from '@/components/sidebar.vue';
import XCommon from '../_common_/common.vue'; import XCommon from '../_common_/common.vue';
@ -121,7 +124,9 @@ import XTimeline from './timeline.vue';
import XPostForm from './post-form.vue'; import XPostForm from './post-form.vue';
import XHeaderClock from './header-clock.vue'; import XHeaderClock from './header-clock.vue';
import * as os from '@/os'; import * as os from '@/os';
import { router } from '@/router';
import { sidebarDef } from '@/sidebar'; import { sidebarDef } from '@/sidebar';
import { search } from '@/scripts/search';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -167,11 +172,17 @@ export default defineComponent({
featuredChannels: null, featuredChannels: null,
currentChannel: null, currentChannel: null,
menuDef: sidebarDef, menuDef: sidebarDef,
faLayerGroup, faBars, faBell, faHome, faCircle, faPencilAlt, faShareAlt, faSatelliteDish, faListUl, faSatellite, faCog, faSearch, faPlus, faLayerGroup, faBars, faBell, faHome, faCircle, faPencilAlt, faShareAlt, faSatelliteDish, faListUl, faSatellite, faCog, faSearch, faPlus, faStar, farStar,
}; };
}, },
created() { created() {
router.beforeEach((to, from) => {
this.$refs.side.navigate(to.fullPath);
// search?q=foo return false
//return false;
});
os.api('users/lists/list').then(lists => { os.api('users/lists/list').then(lists => {
this.lists = lists; this.lists = lists;
}); });
@ -206,10 +217,28 @@ export default defineComponent({
os.post(); os.post();
}, },
search() {
search();
},
top() { top() {
window.scroll({ top: 0, behavior: 'smooth' }); window.scroll({ top: 0, behavior: 'smooth' });
}, },
async toggleChannelFollow() {
if (this.currentChannel.isFollowing) {
await os.apiWithDialog('channels/unfollow', {
channelId: this.currentChannel.id
});
this.currentChannel.isFollowing = false;
} else {
await os.apiWithDialog('channels/follow', {
channelId: this.currentChannel.id
});
this.currentChannel.isFollowing = true;
}
},
onTransition() { onTransition() {
if (window._scroll) window._scroll(); if (window._scroll) window._scroll();
}, },
@ -397,13 +426,13 @@ export default defineComponent({
height: $header-height; height: $header-height;
padding: $padding; padding: $padding;
box-sizing: border-box; box-sizing: border-box;
line-height: ($header-height - ($padding * 2));
background-color: var(--panel); background-color: var(--panel);
border-bottom: solid 1px var(--divider); border-bottom: solid 1px var(--divider);
user-select: none; user-select: none;
> .left { > .left {
display: flex; display: flex;
align-items: center;
flex: 1; flex: 1;
min-width: 0; min-width: 0;
@ -416,44 +445,49 @@ export default defineComponent({
opacity: 0.6; opacity: 0.6;
} }
> .title, > .description { > .title {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
min-width: 0; min-width: 0;
}
> .title {
flex-shrink: 0;
font-weight: bold; font-weight: bold;
}
> .description { > .description {
margin-left: 16px; opacity: 0.6;
opacity: 0.7; font-size: 0.8em;
font-size: 0.9em; font-weight: noraml;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
} }
} }
> .right { > .right {
display: flex; display: flex;
align-items: center;
min-width: 0; min-width: 0;
margin-left: auto; margin-left: auto;
padding-left: 8px; padding-left: 8px;
> .search { > .clock {
margin-right: 8px;
}
> .button {
height: ($header-height - ($padding * 2)); height: ($header-height - ($padding * 2));
width: ($header-height - ($padding * 2)); width: ($header-height - ($padding * 2));
padding: 10px;
box-sizing: border-box; box-sizing: border-box;
margin-left: 8px;
position: relative; position: relative;
line-height: initial;
border-radius: 5px; border-radius: 5px;
&:hover { &:hover {
background: rgba(0, 0, 0, 0.05); background: rgba(0, 0, 0, 0.05);
} }
&.follow.followed {
color: var(--accent);
}
} }
} }
} }

View File

@ -1074,8 +1074,13 @@ export default defineComponent({
} }
} }
> .files {
max-width: 500px;
}
> .url-preview { > .url-preview {
margin-top: 8px; margin-top: 8px;
max-width: 500px;
} }
> .poll { > .poll {

View File

@ -108,7 +108,7 @@ export default defineComponent({
autofocus: { autofocus: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: false
}, },
}, },

View File

@ -192,5 +192,8 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.dbiokgaf { .dbiokgaf {
padding: 16px 0; padding: 16px 0;
// TODO: position sticky
overflow: hidden;
} }
</style> </style>