feat: Implement centralized module management system
- Add ModuleRegistry for managing built-in modules (newsletter, wishlist, affiliate, subscription, licensing) - Add ModulesController REST API for module enable/disable - Create Modules settings page with category grouping and toggle controls - Integrate module checks across admin-spa and customer-spa - Add useModules hook for both SPAs to check module status - Hide newsletter from footer builder when module disabled - Hide wishlist features when module disabled (product cards, account menu, wishlist page) - Protect wishlist API endpoints with module checks - Auto-update navigation tree when modules toggled - Clean up obsolete documentation files - Add comprehensive documentation: - MODULE_SYSTEM_IMPLEMENTATION.md - MODULE_INTEGRATION_SUMMARY.md - ADDON_MODULE_INTEGRATION.md (proposal) - ADDON_MODULE_DESIGN_DECISIONS.md (design doc) - FEATURE_ROADMAP.md - SHIPPING_INTEGRATION.md Module system provides: - Centralized enable/disable for all features - Automatic navigation updates - Frontend/backend integration - Foundation for addon-module unification
This commit is contained in:
@@ -6,6 +6,7 @@ import { Button } from './ui/button';
|
||||
import { useLayout } from '@/contexts/ThemeContext';
|
||||
import { useShopSettings } from '@/hooks/useAppearanceSettings';
|
||||
import { useWishlist } from '@/hooks/useWishlist';
|
||||
import { useModules } from '@/hooks/useModules';
|
||||
|
||||
interface ProductCardProps {
|
||||
product: {
|
||||
@@ -28,8 +29,10 @@ export function ProductCard({ product, onAddToCart }: ProductCardProps) {
|
||||
const { isClassic, isModern, isBoutique, isLaunch } = useLayout();
|
||||
const { layout, elements, addToCart, saleBadge, isLoading } = useShopSettings();
|
||||
const { isEnabled: wishlistEnabled, isInWishlist, toggleWishlist } = useWishlist();
|
||||
const { isEnabled: isModuleEnabled } = useModules();
|
||||
|
||||
const inWishlist = wishlistEnabled && isInWishlist(product.id);
|
||||
const showWishlist = isModuleEnabled('wishlist') && wishlistEnabled;
|
||||
const inWishlist = showWishlist && isInWishlist(product.id);
|
||||
|
||||
const handleWishlistClick = async (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
@@ -142,7 +145,7 @@ export function ProductCard({ product, onAddToCart }: ProductCardProps) {
|
||||
)}
|
||||
|
||||
{/* Wishlist Button */}
|
||||
{wishlistEnabled && (
|
||||
{showWishlist && (
|
||||
<div className="absolute top-2 left-2 z-10">
|
||||
<button
|
||||
onClick={handleWishlistClick}
|
||||
@@ -246,7 +249,7 @@ export function ProductCard({ product, onAddToCart }: ProductCardProps) {
|
||||
)}
|
||||
|
||||
{/* Wishlist Button */}
|
||||
{wishlistEnabled && (
|
||||
{showWishlist && (
|
||||
<div className="absolute top-4 right-4 z-10">
|
||||
<button
|
||||
onClick={handleWishlistClick}
|
||||
@@ -366,7 +369,7 @@ export function ProductCard({ product, onAddToCart }: ProductCardProps) {
|
||||
)}
|
||||
|
||||
{/* Wishlist Button */}
|
||||
{wishlistEnabled && (
|
||||
{showWishlist && (
|
||||
<div className="absolute top-6 left-6 z-10">
|
||||
<button
|
||||
onClick={handleWishlistClick}
|
||||
@@ -440,7 +443,7 @@ export function ProductCard({ product, onAddToCart }: ProductCardProps) {
|
||||
)}
|
||||
|
||||
{/* Wishlist Button */}
|
||||
{wishlistEnabled && (
|
||||
{showWishlist && (
|
||||
<div className="absolute top-3 right-3 z-10">
|
||||
<button
|
||||
onClick={handleWishlistClick}
|
||||
|
||||
Reference in New Issue
Block a user