import { Heart, LogIn, MessageSquare } from "lucide-react"; import { useTranslation } from "react-i18next"; import { SUPPORT_PAGE } from "~/utils/urls"; import { LinkButton, SendouButton } from "../elements/Button"; import { AnythingAdder } from "./AnythingAdder"; import { GlobalSearch } from "./GlobalSearch"; import { LogInButtonContainer } from "./LogInButtonContainer"; import styles from "./TopRightButtons.module.css"; export function TopRightButtons({ showSupport, showSearch, isLoggedIn, onChatToggle, onChatModalToggle, chatUnreadCount, }: { showSupport: boolean; showSearch: boolean; isLoggedIn: boolean; onChatToggle?: () => void; onChatModalToggle?: () => void; chatUnreadCount?: number; }) { const { t } = useTranslation(["common", "front"]); // xxx: anti-pattern? probablty just extract this const chatButton = (variant: "outlined" | "primary", onPress: () => void) => ( <> } variant={variant} onPress={onPress} /> {chatUnreadCount ? ( {chatUnreadCount} ) : null} ); return (
{showSupport ? ( } variant="outlined" > {t("common:pages.support")} ) : null} {isLoggedIn ? ( <>
{showSearch ? (
) : null}
{onChatToggle ? (
{chatButton("outlined", onChatToggle)}
) : null} {onChatModalToggle ? (
{chatButton("outlined", onChatModalToggle)}
) : null} ) : ( }> {t("front:mobileNav.login")} )}
); }