+ {(() => {
+ const sp = gallery.subpages[expandedSubpage];
+ const spIndex = expandedSubpage;
+ return (
+ <>
+
+
+
+
+
+
- updateSection(spIndex, secIndex, { title: e.target.value })
- }
- placeholder="Section title"
+ className="subpage-name-input"
+ value={sp.name}
+ onChange={(e) => updateSubpage(spIndex, { name: e.target.value })}
+ placeholder="Page name (used for URL)"
+ onClick={(e) => e.stopPropagation()}
/>
+
+
+
-
-
- updateSection(spIndex, secIndex, {
- description: e.target.value || undefined,
- })
- }
- placeholder="Section description (optional)"
- className="section-desc-input"
- />
-
-
- {sec.albums.map((album, aIndex) => (
-
removeSectionAlbum(spIndex, secIndex, aIndex)}
- onUpdate={(updates) => {
- setGallery((g) => {
- const subpages = [...g.subpages];
- const sp2 = { ...subpages[spIndex] };
- const sections = [...(sp2.sections || [])];
- const sec2 = { ...sections[secIndex] };
- const albums = [...sec2.albums];
- albums[aIndex] = { ...albums[aIndex], ...updates };
- sec2.albums = albums;
- sections[secIndex] = sec2;
- sp2.sections = sections;
- subpages[spIndex] = sp2;
- return { ...g, subpages };
- });
- markDirty();
- }}
+
+
+ {/* Subpage metadata */}
+
+
+
+
+
+
+ updateSubpage(spIndex, { password: e.target.value || undefined })
+ }
+ placeholder="Leave empty for public"
+ />
+
+
+
+
+ {/* Albums (if no sections) */}
+ {(!sp.sections || sp.sections.length === 0) && (
+
+
+ Albums
+
+
+
+ {sp.albums.map((album, aIndex) => (
+
removeSubpageAlbum(spIndex, aIndex)}
+ onUpdate={(updates) => {
+ setGallery((g) => {
+ const subpages = [...g.subpages];
+ const sp2 = { ...subpages[spIndex] };
+ const albums = [...sp2.albums];
+ albums[aIndex] = { ...albums[aIndex], ...updates };
+ sp2.albums = albums;
+ subpages[spIndex] = sp2;
+ return { ...g, subpages };
+ });
+ markDirty();
+ }}
+ />
+ ))}
+
+
+ )}
+
+ {/* Sections */}
+ {sp.sections && sp.sections.length > 0 && (
+
+ {sp.sections.map((sec, secIndex) => (
+
+
+
+ updateSection(spIndex, secIndex, { title: e.target.value })
+ }
+ placeholder="Section title"
+ />
+
+
+
+
+ updateSection(spIndex, secIndex, {
+ description: e.target.value || undefined,
+ })
+ }
+ placeholder="Section description (optional)"
+ className="section-desc-input"
+ />
+
+
+ {sec.albums.map((album, aIndex) => (
+
removeSectionAlbum(spIndex, secIndex, aIndex)}
+ onUpdate={(updates) => {
+ setGallery((g) => {
+ const subpages = [...g.subpages];
+ const sp2 = { ...subpages[spIndex] };
+ const sections = [...(sp2.sections || [])];
+ const sec2 = { ...sections[secIndex] };
+ const albums = [...sec2.albums];
+ albums[aIndex] = { ...albums[aIndex], ...updates };
+ sec2.albums = albums;
+ sections[secIndex] = sec2;
+ sp2.sections = sections;
+ subpages[spIndex] = sp2;
+ return { ...g, subpages };
+ });
+ markDirty();
+ }}
+ />
+ ))}
+
+
+
))}
+ )}
+
+
+ {sp.sections && sp.sections.length > 0 && (
+
+ )}
- ))}
-