1. License table creation: - dbDelta requires separate calls per CREATE TABLE - Split into sql_licenses and sql_activations - Added 'PRIMARY KEY (id)' with two spaces (dbDelta requirement) 2. Page titles: - Added SEOHead to Cart page (title: Shopping Cart) - Added SEOHead to Checkout page (title: Checkout) - Shop already had SEOHead 3. usePageTitle hook created (alternative to SEOHead for non-Helmet usage)
23 lines
719 B
TypeScript
23 lines
719 B
TypeScript
import { useEffect } from 'react';
|
|
|
|
/**
|
|
* Hook to set the document title dynamically
|
|
* @param title - The page title to set
|
|
* @param suffix - Optional suffix (default: store name from settings)
|
|
*/
|
|
export function usePageTitle(title: string, suffix?: string) {
|
|
useEffect(() => {
|
|
const storeName = (window as any).woonoowCustomer?.storeName || 'Store';
|
|
const finalSuffix = suffix ?? storeName;
|
|
|
|
document.title = title ? `${title} | ${finalSuffix}` : finalSuffix;
|
|
|
|
// Cleanup: restore original title when component unmounts
|
|
return () => {
|
|
// Don't restore - let the next page set its own title
|
|
};
|
|
}, [title, suffix]);
|
|
}
|
|
|
|
export default usePageTitle;
|