Merge pull request #4880 from h3poteto/feat/favourites

Add favourites
This commit is contained in:
AkiraFukushima 2024-03-09 00:54:38 +09:00 committed by GitHub
commit 1e3a4e35c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,7 @@
"notifications": "Notifications",
"local": "Local",
"public": "Public",
"favourites": "Favourites",
"bookmarks": "Bookmarks",
"search": "Search",
"status": {

View File

@ -4,7 +4,7 @@ import generator, { Entity } from 'megalodon'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
import { FaBell, FaBookmark, FaGlobe, FaHouse, FaList, FaUsers } from 'react-icons/fa6'
import { FaBell, FaBookmark, FaGlobe, FaHouse, FaList, FaStar, FaUsers } from 'react-icons/fa6'
import { useIntl } from 'react-intl'
import Jump from '../Jump'
import { useUnreads } from '@/provider/unreads'
@ -77,6 +77,12 @@ export default function Layout({ children }: LayoutProps) {
icon: <FaGlobe />,
path: `/accounts/${router.query.id}/public`
},
{
id: 'favourites',
title: formatMessage({ id: 'timeline.favourites' }),
icon: <FaStar />,
path: `/accounts/${router.query.id}/favourites`
},
{
id: 'bookmarks',
title: formatMessage({ id: 'timeline.bookmarks' }),

View File

@ -145,6 +145,11 @@ export default function Timeline(props: Props) {
const res = await client.getPublicTimeline(options)
return res.data
}
case 'favourites': {
const res = await client.getFavourites(options)
// TODO: handle next_id in link header to get more posts
return res.data
}
case 'bookmarks': {
const res = await client.getBookmarks(options)
return res.data