// Removed Next.js Image import for Electron
import {useContext} from "react";
import {BookContext, BookContextProps} from "@/context/BookContext";
import {useTranslations} from "next-intl";
import OfflineToggle from "@/components/offline/OfflineToggle";

export default function ScribeTopBar() {
    const book: BookContextProps = useContext(BookContext);
    const t = useTranslations();
    return (
        <div className="flex items-center justify-between px-6 py-3 bg-primary shadow-lg border-b border-primary-dark">
            <div className="flex items-center space-x-4 group">
                <div className="transition-transform duration-300 group-hover:scale-110">
                    <img src="/eritors-favicon-white.png" alt={t("scribeTopBar.logoAlt")} style={{width: 24, height: 24}} />
                </div>
                <span
                    className="font-['ADLaM_Display'] text-xl tracking-wide text-white/95">{t("scribeTopBar.scribe")}</span>
            </div>
            {book.book && (
                <div
                    className="flex items-center space-x-3 bg-white/10 backdrop-blur-sm px-4 py-2 rounded-lg border border-white/20">
                    <div className="h-8 w-1 bg-white/40 rounded-full"></div>
                    <div className="text-center">
                        <p className="text-text-primary font-semibold text-base tracking-wide">
                            {book.book.title}
                        </p>
                        {book.book.subTitle && (
                            <p className="text-white/70 text-xs italic mt-0.5">
                                {book.book.subTitle}
                            </p>
                        )}
                    </div>
                    <div className="h-8 w-1 bg-white/40 rounded-full"></div>
                </div>
            )}
            <div className="flex items-center space-x-2 min-w-[120px] justify-end">
                <OfflineToggle />
            </div>
        </div>
    )
}