import LocalizedClientLink from "@modules/common/components/localized-client-link" import { convertToLocale } from "@lib/util/money" import { HttpTypes } from "@medusajs/types" import { ArrowRight } from "lucide-react" type OverviewProps = { customer: HttpTypes.StoreCustomer | null orders: HttpTypes.StoreOrder[] | null } const formatDate = (value: string | Date) => new Date(value).toLocaleDateString("bs-BA", { day: "numeric", month: "long", year: "numeric" }) const Overview = ({ customer, orders }: OverviewProps) => { const stats = [ { value: `${getProfileCompletion(customer)}%`, label: "Profil popunjen", href: "/account/profile", testId: "customer-profile-completion" }, { value: String(customer?.addresses?.length ?? 0), label: "Sačuvane adrese", href: "/account/addresses", testId: "addresses-count" }, { value: String(orders?.length ?? 0), label: "Narudžbe", href: "/account/orders", testId: "orders-count" }, ] return (
Pozdrav {customer?.first_name} {customer?.email}
{stats.map((s) => (

{s.value}

{s.label}

))}

Nedavne narudžbe

Sve narudžbe
) } const getProfileCompletion = (customer: HttpTypes.StoreCustomer | null) => { if (!customer) return 0 let count = 0 if (customer.email) count++ if (customer.first_name && customer.last_name) count++ if (customer.phone) count++ if (customer.addresses?.find((addr) => addr.is_default_billing)) count++ return (count / 4) * 100 } export default Overview