forked from Archives/Athou_commafeed
bring back "refresh all my feeds" (#1036)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { t } from "@lingui/macro"
|
||||
import { ActionIcon, Center, Divider, Indicator, Popover, TextInput } from "@mantine/core"
|
||||
import { useForm } from "@mantine/form"
|
||||
import { reloadEntries, search } from "app/slices/entries"
|
||||
import { search } from "app/slices/entries"
|
||||
import { changeReadingMode, changeReadingOrder } from "app/slices/user"
|
||||
import { useAppDispatch, useAppSelector } from "app/store"
|
||||
import { ActionButton } from "components/ActionButtton"
|
||||
@@ -11,6 +11,7 @@ import { useEffect } from "react"
|
||||
import { TbArrowDown, TbArrowUp, TbEye, TbEyeOff, TbRefresh, TbSearch, TbUser, TbX } from "react-icons/tb"
|
||||
import { MarkAllAsReadButton } from "./MarkAllAsReadButton"
|
||||
import { ProfileMenu } from "./ProfileMenu"
|
||||
import { RefreshMenu } from "./RefreshMenu"
|
||||
|
||||
function HeaderDivider() {
|
||||
return <Divider orientation="vertical" />
|
||||
@@ -40,7 +41,7 @@ export function Header() {
|
||||
return (
|
||||
<Center>
|
||||
<ButtonToolbar>
|
||||
<ActionButton icon={<TbRefresh size={iconSize} />} label={t`Refresh`} onClick={() => dispatch(reloadEntries())} />
|
||||
<RefreshMenu control={<ActionButton icon={<TbRefresh size={iconSize} />} label={t`Refresh`} />} />
|
||||
<MarkAllAsReadButton iconSize={iconSize} />
|
||||
|
||||
<HeaderDivider />
|
||||
|
||||
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