@visns-studio/visns-components 5.11.7 → 5.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,7 +76,10 @@ const categoryColors = {
76
76
  footer: 'footer-category'
77
77
  };
78
78
 
79
- const SectionTypeSelector = ({ onSelect, onCancel }) => {
79
+ const SectionTypeSelector = ({ onSelect, onCancel, existingSections = [] }) => {
80
+ // Get list of existing section types
81
+ const existingSectionTypes = existingSections.map(section => section.section_type);
82
+
80
83
  const groupedSections = sectionTypes.reduce((acc, section) => {
81
84
  if (!acc[section.category]) {
82
85
  acc[section.category] = [];
@@ -110,11 +113,15 @@ const SectionTypeSelector = ({ onSelect, onCancel }) => {
110
113
  <div className="section-types-grid">
111
114
  {sections.map((section) => {
112
115
  const IconComponent = section.icon;
116
+ const isAlreadyUsed = existingSectionTypes.includes(section.id);
117
+
113
118
  return (
114
119
  <button
115
120
  key={section.id}
116
- onClick={() => onSelect(section.id)}
117
- className={`section-type-card ${categoryColors[category]}`}
121
+ onClick={() => !isAlreadyUsed && onSelect(section.id)}
122
+ className={`section-type-card ${categoryColors[category]} ${isAlreadyUsed ? 'disabled' : ''}`}
123
+ disabled={isAlreadyUsed}
124
+ title={isAlreadyUsed ? `${section.name} section already exists in this template` : `Add ${section.name} section`}
118
125
  >
119
126
  <div className="section-type-card-header">
120
127
  <div className="section-type-icon">
@@ -128,6 +135,11 @@ const SectionTypeSelector = ({ onSelect, onCancel }) => {
128
135
  Dynamic
129
136
  </span>
130
137
  )}
138
+ {isAlreadyUsed && (
139
+ <span className="used-badge">
140
+ Already Added
141
+ </span>
142
+ )}
131
143
  </h4>
132
144
  <p className="section-type-description">
133
145
  {section.description}