@dfosco/storyboard-react 1.16.0 → 1.17.1
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.
- package/package.json +1 -1
- package/src/Viewfinder.jsx +8 -3
package/package.json
CHANGED
package/src/Viewfinder.jsx
CHANGED
|
@@ -92,11 +92,15 @@ function getCurrentBranch(basePath) {
|
|
|
92
92
|
* @param {string} [props.title] - Header title (defaults to "Viewfinder")
|
|
93
93
|
* @param {string} [props.subtitle] - Optional subtitle displayed below the title
|
|
94
94
|
* @param {boolean} [props.showThumbnails] - Show thumbnail previews (defaults to false)
|
|
95
|
+
* @param {boolean} [props.hideDefaultScene] - Hide the "default" scene from the list (defaults to false)
|
|
95
96
|
*/
|
|
96
|
-
export default function Viewfinder({ scenes = {}, pageModules = {}, basePath, title = 'Viewfinder', subtitle, showThumbnails = false }) {
|
|
97
|
+
export default function Viewfinder({ scenes = {}, pageModules = {}, basePath, title = 'Viewfinder', subtitle, showThumbnails = false, hideDefaultScene = false }) {
|
|
97
98
|
const [branches, setBranches] = useState(null)
|
|
98
99
|
|
|
99
|
-
const sceneNames = useMemo(() =>
|
|
100
|
+
const sceneNames = useMemo(() => {
|
|
101
|
+
const names = Object.keys(scenes)
|
|
102
|
+
return hideDefaultScene ? names.filter(n => n !== 'default') : names
|
|
103
|
+
}, [scenes, hideDefaultScene])
|
|
100
104
|
|
|
101
105
|
const knownRoutes = useMemo(() =>
|
|
102
106
|
Object.keys(pageModules)
|
|
@@ -176,6 +180,7 @@ export default function Viewfinder({ scenes = {}, pageModules = {}, basePath, ti
|
|
|
176
180
|
<div className={showThumbnails ? styles.grid : styles.list}>
|
|
177
181
|
{sceneNames.map((name) => {
|
|
178
182
|
const meta = getSceneMeta(name)
|
|
183
|
+
const displayName = meta?.name || name
|
|
179
184
|
return (
|
|
180
185
|
<a key={name} href={resolveSceneRoute(name, knownRoutes)} className={showThumbnails ? styles.card : styles.listItem}>
|
|
181
186
|
{showThumbnails && (
|
|
@@ -184,7 +189,7 @@ export default function Viewfinder({ scenes = {}, pageModules = {}, basePath, ti
|
|
|
184
189
|
</div>
|
|
185
190
|
)}
|
|
186
191
|
<div className={styles.cardBody}>
|
|
187
|
-
<p className={styles.sceneName}>{
|
|
192
|
+
<p className={styles.sceneName}>{displayName}</p>
|
|
188
193
|
{meta?.author && (() => {
|
|
189
194
|
const authors = Array.isArray(meta.author) ? meta.author : [meta.author]
|
|
190
195
|
return (
|