import { msg } from "@lingui/core/macro" import { useLingui } from "@lingui/react" import { Group, Indicator, Popover, TagsInput } from "@mantine/core" import { TbArrowBarToDown, TbExternalLink, TbMail, TbMailOpened, TbShare, TbStar, TbStarOff, TbTag } from "react-icons/tb" import { markEntriesUpToEntry, markEntry, starEntry, tagEntry } from "@/app/entries/thunks" import { useAppDispatch, useAppSelector } from "@/app/store" import type { Entry } from "@/app/types" import { ActionButton } from "@/components/ActionButton" import { useActionButton } from "@/hooks/useActionButton" import { useMobile } from "@/hooks/useMobile" import { ShareButtons } from "./ShareButtons" interface FeedEntryFooterProps { entry: Entry } export function FeedEntryFooter(props: Readonly) { const tags = useAppSelector(state => state.user.tags) const mobile = useMobile() const { spacing } = useActionButton() const dispatch = useAppDispatch() const { _ } = useLingui() const readStatusButtonClicked = async () => await dispatch( markEntry({ entry: props.entry, read: !props.entry.read, }) ) const onTagsChange = async (values: string[]) => await dispatch( tagEntry({ entryId: +props.entry.id, tags: values, }) ) return ( {props.entry.markable && ( : } label={props.entry.read ? msg`Keep unread` : msg`Mark as read`} onClick={readStatusButtonClicked} /> )} : } label={props.entry.starred ? msg`Unstar` : msg`Star`} onClick={async () => await dispatch( starEntry({ entry: props.entry, starred: !props.entry.starred, }) ) } /> } label={msg`Share`} /> {tags && ( } label={msg`Tags`} /> )} } label={msg`Open link`} /> } label={msg`Mark as read up to here`} onClick={async () => await dispatch(markEntriesUpToEntry(props.entry))} /> ) }