feat(client): collapse sub note automatically

This commit is contained in:
syuilo 2021-11-19 18:56:30 +09:00
parent 1cf5198372
commit 1c6463e66f
2 changed files with 43 additions and 1 deletions

View File

@ -10,6 +10,7 @@
## 12.x.x (unreleased)
### Improvements
- クライアント: 返信先やRenoteに対しても自動折りたたみされるように
- クライアント: 長いスレッドの表示を改善
- クライアント: アカウント削除に確認ダイアログを出すように

View File

@ -1,5 +1,5 @@
<template>
<div class="wrmlmaau">
<div class="wrmlmaau" :class="{ collapsed }">
<div class="body">
<span v-if="note.isHidden" style="opacity: 0.5">({{ $ts.private }})</span>
<span v-if="note.deletedAt" style="opacity: 0.5">({{ $ts.deleted }})</span>
@ -15,6 +15,9 @@
<summary>{{ $ts.poll }}</summary>
<XPoll :note="note"/>
</details>
<button v-if="collapsed" class="fade _button" @click="collapsed = false">
<span>{{ $ts.showMore }}</span>
</button>
</div>
</template>
@ -37,7 +40,14 @@ export default defineComponent({
},
data() {
return {
collapsed: false,
};
},
created() {
this.collapsed = this.note.cw == null && this.note.text && (
(this.note.text.split('\n').length > 9) ||
(this.note.text.length > 500)
);
}
});
</script>
@ -58,5 +68,36 @@ export default defineComponent({
color: var(--renote);
}
}
&.collapsed {
position: relative;
max-height: 9em;
overflow: hidden;
> .fade {
display: block;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 64px;
background: linear-gradient(0deg, var(--panel), var(--X15));
> span {
display: inline-block;
background: var(--panel);
padding: 6px 10px;
font-size: 0.8em;
border-radius: 999px;
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
}
&:hover {
> span {
background: var(--panelHighlight);
}
}
}
}
}
</style>