summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
author1STEP621 <86859447+1STEP621@users.noreply.github.com>2023-12-12 12:19:49 +0900
committerGitHub <noreply@github.com>2023-12-12 12:19:49 +0900
commit7f85d7a1f9b05e1d918dff189ccdfbfa219f2008 (patch)
tree3628fd61e214a62a56bbabdc9b7527fa029c21d0 /packages
parentfix type (diff)
downloadsharkey-7f85d7a1f9b05e1d918dff189ccdfbfa219f2008.tar.gz
sharkey-7f85d7a1f9b05e1d918dff189ccdfbfa219f2008.tar.bz2
sharkey-7f85d7a1f9b05e1d918dff189ccdfbfa219f2008.zip
Enhance(frontend): リスト/アンテナ/チャンネルをタイムラインから新規作成できるように (#12629)
* add short leads to lists, antennas, and channels * remove unused import * add CHANGELOG.md * hide separator when there is no item * fix mistakes * Update timeline.vue --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages')
-rw-r--r--packages/frontend/src/pages/timeline.vue62
1 files changed, 45 insertions, 17 deletions
diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue
index 942061efe3..f3213ad273 100644
--- a/packages/frontend/src/pages/timeline.vue
+++ b/packages/frontend/src/pages/timeline.vue
@@ -48,6 +48,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { miLocalStorage } from '@/local-storage.js';
import { antennasCache, userListsCache } from '@/cache.js';
import { deviceKind } from '@/scripts/device-kind.js';
+import { MenuItem } from '@/types/menu.js';
provide('shouldOmitHeaderTitle', true);
@@ -83,22 +84,40 @@ function top(): void {
async function chooseList(ev: MouseEvent): Promise<void> {
const lists = await userListsCache.fetch();
- const items = lists.map(list => ({
- type: 'link' as const,
- text: list.name,
- to: `/timeline/list/${list.id}`,
- }));
+ const items: MenuItem[] = [
+ ...lists.map(list => ({
+ type: 'link' as const,
+ text: list.name,
+ to: `/timeline/list/${list.id}`,
+ })),
+ (lists.length === 0 ? undefined : { type: 'divider' }),
+ {
+ type: 'link' as const,
+ icon: 'ti ti-plus',
+ text: i18n.ts.createNew,
+ to: '/my/lists',
+ },
+ ];
os.popupMenu(items, ev.currentTarget ?? ev.target);
}
async function chooseAntenna(ev: MouseEvent): Promise<void> {
const antennas = await antennasCache.fetch();
- const items = antennas.map(antenna => ({
- type: 'link' as const,
- text: antenna.name,
- indicate: antenna.hasUnreadNote,
- to: `/timeline/antenna/${antenna.id}`,
- }));
+ const items: MenuItem[] = [
+ ...antennas.map(antenna => ({
+ type: 'link' as const,
+ text: antenna.name,
+ indicate: antenna.hasUnreadNote,
+ to: `/timeline/antenna/${antenna.id}`,
+ })),
+ (antennas.length === 0 ? undefined : { type: 'divider' }),
+ {
+ type: 'link' as const,
+ icon: 'ti ti-plus',
+ text: i18n.ts.createNew,
+ to: '/my/antennas',
+ },
+ ];
os.popupMenu(items, ev.currentTarget ?? ev.target);
}
@@ -106,12 +125,21 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
const channels = await os.api('channels/my-favorites', {
limit: 100,
});
- const items = channels.map(channel => ({
- type: 'link' as const,
- text: channel.name,
- indicate: channel.hasUnreadNote,
- to: `/channels/${channel.id}`,
- }));
+ const items = [
+ ...channels.map(channel => ({
+ type: 'link' as const,
+ text: channel.name,
+ indicate: channel.hasUnreadNote,
+ to: `/channels/${channel.id}`,
+ })),
+ (channels.length === 0 ? undefined : null),
+ {
+ type: 'link' as const,
+ icon: 'ti ti-plus',
+ text: i18n.ts.createNew,
+ to: '/channels',
+ },
+ ];
os.popupMenu(items, ev.currentTarget ?? ev.target);
}