From 829d3ed94f70a916f06d5286e3b546e41520731b Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sat, 9 Mar 2024 00:51:13 +0900
Subject: [PATCH] Add favourites
---
locales/en/translation.json | 1 +
renderer/components/layouts/timelines.tsx | 8 +++++++-
renderer/components/timelines/Timeline.tsx | 5 +++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/locales/en/translation.json b/locales/en/translation.json
index 430ab79a..44f1d4dd 100644
--- a/locales/en/translation.json
+++ b/locales/en/translation.json
@@ -4,6 +4,7 @@
"notifications": "Notifications",
"local": "Local",
"public": "Public",
+ "favourites": "Favourites",
"bookmarks": "Bookmarks",
"search": "Search",
"status": {
diff --git a/renderer/components/layouts/timelines.tsx b/renderer/components/layouts/timelines.tsx
index bbb5246d..6f87be4a 100644
--- a/renderer/components/layouts/timelines.tsx
+++ b/renderer/components/layouts/timelines.tsx
@@ -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: ,
path: `/accounts/${router.query.id}/public`
},
+ {
+ id: 'favourites',
+ title: formatMessage({ id: 'timeline.favourites' }),
+ icon: ,
+ path: `/accounts/${router.query.id}/favourites`
+ },
{
id: 'bookmarks',
title: formatMessage({ id: 'timeline.bookmarks' }),
diff --git a/renderer/components/timelines/Timeline.tsx b/renderer/components/timelines/Timeline.tsx
index 2086d6f7..5f15170e 100644
--- a/renderer/components/timelines/Timeline.tsx
+++ b/renderer/components/timelines/Timeline.tsx
@@ -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