mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
bring back "refresh all my feeds" (#1036)
This commit is contained in:
41
commafeed-client/src/components/header/RefreshMenu.tsx
Normal file
41
commafeed-client/src/components/header/RefreshMenu.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { t, Trans } from "@lingui/macro"
|
||||
import { Menu } from "@mantine/core"
|
||||
import { showNotification } from "@mantine/notifications"
|
||||
import { client } from "app/client"
|
||||
import { reloadEntries } from "app/slices/entries"
|
||||
import { useAppDispatch } from "app/store"
|
||||
import { TbRotateClockwise, TbWorldDownload } from "react-icons/tb"
|
||||
|
||||
interface RefreshMenuProps {
|
||||
control: React.ReactElement
|
||||
}
|
||||
|
||||
const iconSize = 16
|
||||
|
||||
export function RefreshMenu(props: RefreshMenuProps) {
|
||||
const dispatch = useAppDispatch()
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<Menu.Target>{props.control}</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Menu.Item icon={<TbRotateClockwise size={iconSize} />} onClick={() => dispatch(reloadEntries())}>
|
||||
<Trans>Reload</Trans>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
icon={<TbWorldDownload size={iconSize} />}
|
||||
onClick={() =>
|
||||
client.feed.refreshAll().then(() =>
|
||||
showNotification({
|
||||
message: t`Your feeds have been queued for refresh.`,
|
||||
color: "green",
|
||||
})
|
||||
)
|
||||
}
|
||||
>
|
||||
<Trans>Fetch all my feeds now</Trans>
|
||||
</Menu.Item>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user