refs #1714 Add bookmark menu in side menu

This commit is contained in:
AkiraFukushima 2020-08-24 17:23:37 +09:00
parent daa334e45c
commit 375fb34873
7 changed files with 16 additions and 1 deletions

View File

@ -101,6 +101,7 @@ const sideMenuState = (): SideMenuState => {
mention: true, mention: true,
direct: true, direct: true,
favourite: true, favourite: true,
bookmark: true,
local: true, local: true,
public: true, public: true,
tag: true, tag: true,

View File

@ -57,6 +57,7 @@ const state = (): SideMenuState => {
mention: true, mention: true,
direct: true, direct: true,
favourite: true, favourite: true,
bookmark: true,
local: true, local: true,
public: true, public: true,
tag: true, tag: true,

View File

@ -53,6 +53,7 @@
"direct": "Direct messages", "direct": "Direct messages",
"follow_requests": "Follow Requests", "follow_requests": "Follow Requests",
"favourite": "Favourite", "favourite": "Favourite",
"bookmark": "Bookmark",
"local": "Local timeline", "local": "Local timeline",
"public": "Public timeline", "public": "Public timeline",
"hashtag": "Hashtag", "hashtag": "Hashtag",

View File

@ -12,6 +12,7 @@ const confirm = async (account: LocalAccount, proxy: ProxyConfig | false) => {
mention: true, mention: true,
direct: true, direct: true,
favourite: true, favourite: true,
bookmark: true,
local: true, local: true,
public: true, public: true,
tag: true, tag: true,
@ -33,6 +34,11 @@ const confirm = async (account: LocalAccount, proxy: ProxyConfig | false) => {
timelines = { ...timelines, favourite: false } timelines = { ...timelines, favourite: false }
}) })
} }
const bookmark = async () => {
return client.getBookmarks({ limit: 1 }).catch(() => {
timelines = { ...timelines, bookmark: false }
})
}
const local = async () => { const local = async () => {
return client.getLocalTimeline({ limit: 1 }).catch(() => { return client.getLocalTimeline({ limit: 1 }).catch(() => {
timelines = { ...timelines, local: false } timelines = { ...timelines, local: false }
@ -48,7 +54,7 @@ const confirm = async (account: LocalAccount, proxy: ProxyConfig | false) => {
timelines = { ...timelines, tag: false } timelines = { ...timelines, tag: false }
}) })
} }
await Promise.all([notification(), direct(), favourite(), local(), pub(), tag()]) await Promise.all([notification(), direct(), favourite(), bookmark(), local(), pub(), tag()])
return timelines return timelines
} }

View File

@ -80,6 +80,10 @@
<icon name="star"></icon> <icon name="star"></icon>
<span>{{ $t('side_menu.favourite') }}</span> <span>{{ $t('side_menu.favourite') }}</span>
</el-menu-item> </el-menu-item>
<el-menu-item :index="`/${id()}/bookmarks`" role="menuitem" :title="$t('side_menu.bookmark')" v-if="enabledTimelines.bookmark">
<icon name="bookmark"></icon>
<span>{{ $t('side_menu.bookmark') }}</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/local`" role="menuitem" :title="$t('side_menu.local')" v-if="enabledTimelines.local"> <el-menu-item :index="`/${id()}/local`" role="menuitem" :title="$t('side_menu.local')" v-if="enabledTimelines.local">
<icon name="users"></icon> <icon name="users"></icon>
<span>{{ $t('side_menu.local') }}</span> <span>{{ $t('side_menu.local') }}</span>

View File

@ -39,6 +39,7 @@ const state = (): SideMenuState => ({
mention: true, mention: true,
direct: true, direct: true,
favourite: true, favourite: true,
bookmark: true,
local: true, local: true,
public: true, public: true,
tag: true, tag: true,

View File

@ -4,6 +4,7 @@ export type EnabledTimelines = {
mention: boolean mention: boolean
direct: boolean direct: boolean
favourite: boolean favourite: boolean
bookmark: boolean
local: boolean local: boolean
public: boolean public: boolean
tag: boolean tag: boolean