diff --git a/server/e2e/gql_storytelling_test.go b/server/e2e/gql_storytelling_test.go index a6fab1d602..3caa4d946e 100644 --- a/server/e2e/gql_storytelling_test.go +++ b/server/e2e/gql_storytelling_test.go @@ -1037,7 +1037,7 @@ func TestStoryPublishing(t *testing.T) { _, err = buf.ReadFrom(rc) assert.NoError(t, err) - pub := regexp.MustCompile(fmt.Sprintf(`{"schemaVersion":1,"id":"%s","publishedAt":".*","property":{"tiles":\[{"id":".*"}]},"plugins":{},"layers":null,"widgets":\[],"widgetAlignSystem":null,"tags":\[],"clusters":\[],"story":{"id":"%s","property":{},"pages":\[{"id":"%s","property":{},"blocks":\[{"id":"%s","property":{"default":{"text":"test value"},"panel":{"padding":{"top":2,"bottom":3,"left":0,"right":1}}},"plugins":null,"extensionId":"%s","pluginId":"%s"}],"swipeable":true,"swipeableLayers":\[],"layers":\[]}]},"nlsLayers":null,"layerStyles":null,"coreSupport":true}`, sID, storyID, pageID, blockID, extensionId, pluginId)) + pub := regexp.MustCompile(fmt.Sprintf(`{"schemaVersion":1,"id":"%s","publishedAt":".*","property":{"tiles":\[{"id":".*"}]},"plugins":{},"layers":null,"widgets":\[],"widgetAlignSystem":null,"tags":\[],"clusters":\[],"story":{"id":"%s","property":{},"pages":\[{"id":"%s","property":{},"title":"test","blocks":\[{"id":"%s","property":{"default":{"text":"test value"},"panel":{"padding":{"top":2,"bottom":3,"left":0,"right":1}}},"plugins":null,"extensionId":"%s","pluginId":"%s"}],"swipeable":true,"swipeableLayers":\[],"layers":\[]}],"position":"left","bgColor":""},"nlsLayers":null,"layerStyles":null,"coreSupport":true}`, sID, storyID, pageID, blockID, extensionId, pluginId)) assert.Regexp(t, pub, buf.String()) resString := e.GET("/p/test-alias/data.json"). diff --git a/server/pkg/scene/builder/story.go b/server/pkg/scene/builder/story.go index 77fcf4f72f..78d2ceed20 100644 --- a/server/pkg/scene/builder/story.go +++ b/server/pkg/scene/builder/story.go @@ -9,14 +9,17 @@ import ( ) type storyJSON struct { - ID string `json:"id"` - Property propertyJSON `json:"property"` - Pages []pageJSON `json:"pages"` + ID string `json:"id"` + Property propertyJSON `json:"property"` + Pages []pageJSON `json:"pages"` + PanelPosition string `json:"position"` + BgColor string `json:"bgColor"` } type pageJSON struct { ID string `json:"id"` Property propertyJSON `json:"property"` + Title string `json:"title"` Blocks []blockJSON `json:"blocks"` Swipeable bool `json:"swipeable"` SwipeableLayers []string `json:"swipeableLayers"` @@ -45,6 +48,8 @@ func (b *Builder) storyJSON(ctx context.Context, p []*property.Property) (*story } return b.pageJSON(ctx, *page, p), true }), + PanelPosition: string(b.story.PanelPosition()), + BgColor: b.story.BgColor(), }, nil } @@ -52,6 +57,7 @@ func (b *Builder) pageJSON(ctx context.Context, page storytelling.Page, p []*pro return pageJSON{ ID: page.Id().String(), Property: b.property(ctx, findProperty(p, page.Property())), + Title: page.Title(), Blocks: lo.FilterMap(page.Blocks(), func(block *storytelling.Block, _ int) (blockJSON, bool) { if block == nil { return blockJSON{}, false diff --git a/server/pkg/storytelling/story.go b/server/pkg/storytelling/story.go index a918951a64..7f6ce1d3a5 100644 --- a/server/pkg/storytelling/story.go +++ b/server/pkg/storytelling/story.go @@ -165,6 +165,10 @@ func (s *Story) PanelPosition() Position { return s.panelPosition } +func (s *Story) BgColor() string { + return s.bgColor +} + func (s *Story) ValidateProperties(pm property.Map) error { if pm == nil { return nil