enhance: チャンネルに新規の投稿がある場合にバッジを表示させる (#12690)
* 多分できたかも * 不要なpropsを削除 * 不要なimportを削除 * 縁を付けた * 枠線の位置を端に寄せた * やっぱり内側へ寄せることにした * できたかも * 修正 * 修正 * クラスにまとめた * 微調整 * 直せたかも * importを付け足し * 多分できたかも * Update channel.vue * Update MkMenu.vue * Update channel.vue * Update CHANGELOG.md --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
3d4af18327
commit
5eb944ecde
6 changed files with 159 additions and 65 deletions
|
@ -48,6 +48,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|||
import { antennasCache, userListsCache } from '@/cache.js';
|
||||
import { deviceKind } from '@/scripts/device-kind.js';
|
||||
import { MenuItem } from '@/types/menu.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
|
||||
provide('shouldOmitHeaderTitle', true);
|
||||
|
||||
|
@ -125,12 +126,17 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
|
|||
limit: 100,
|
||||
});
|
||||
const items: MenuItem[] = [
|
||||
...channels.map(channel => ({
|
||||
type: 'link' as const,
|
||||
text: channel.name,
|
||||
indicate: channel.hasUnreadNote,
|
||||
to: `/channels/${channel.id}`,
|
||||
})),
|
||||
...channels.map(channel => {
|
||||
const lastReadedAt = miLocalStorage.getItemAsJson(`channelLastReadedAt:${channel.id}`) ?? null;
|
||||
const hasUnreadNote = (lastReadedAt && channel.lastNotedAt) ? Date.parse(channel.lastNotedAt) > lastReadedAt : !!(!lastReadedAt && channel.lastNotedAt);
|
||||
|
||||
return {
|
||||
type: 'link' as const,
|
||||
text: channel.name,
|
||||
indicate: hasUnreadNote,
|
||||
to: `/channels/${channel.id}`,
|
||||
};
|
||||
}),
|
||||
(channels.length === 0 ? undefined : { type: 'divider' }),
|
||||
{
|
||||
type: 'link' as const,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue