"use client" import * as React from "react" import type { EmailBrand } from "@/components/templates/email-composer" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { ExxatProductLogo } from "@/components/exxat-product-logo" import { useActiveScope } from "@/hooks/use-active-scope" import { useProduct } from "@/contexts/product-context" import { brandForProduct } from "@/lib/product-brand" /** * The email brand, drawn with what the shell already shows: the active school's avatar (the * one beside the profile menu) for the header and footer, and the Exxat product lock-up for * the footer. Nothing here is a copy of either. */ export function useEmailBrand(address?: { unit?: string; address?: string; contact?: string }): EmailBrand { const { product } = useProduct() const { parent, child } = useActiveScope(product) const productName = brandForProduct(product, null).suffix return React.useMemo( () => ({ name: parent?.name ?? "Your school", unit: address?.unit ?? child?.name, address: address?.address, contact: address?.contact, logo: parent ? ( {parent.initials} ) : undefined, // The shell's own lock-up (mark + "Exxat" + product name), sized down for an email footer. productLogo: ( ), }), [parent, child, product, productName, address?.unit, address?.address, address?.contact], ) }