mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
GO-5279 New welcome page
This commit is contained in:
parent
05e5843426
commit
3349007072
4 changed files with 31 additions and 1 deletions
|
@ -400,10 +400,36 @@ func (b *builtinObjects) createWidgets(ctx session.Context, spaceId string, useC
|
|||
}
|
||||
}
|
||||
|
||||
var welcomePageId string
|
||||
if useCase == pb.RpcObjectImportUseCaseRequest_GET_STARTED {
|
||||
welcomePageId, err = b.getNewObjectID(spaceId, "bafyreidbxbw522cupdbxgzdpqayqb33ttvhyhlquprnbcgvpfp2p7pd4tq")
|
||||
if err != nil {
|
||||
log.Errorf("failed to get welcome page: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(widgetTargetsToCreate) == 0 {
|
||||
return
|
||||
}
|
||||
if err = cache.DoStateCtx(b.objectGetter, ctx, widgetObjectID, func(s *state.State, w widget.Widget) error {
|
||||
|
||||
if useCase == pb.RpcObjectImportUseCaseRequest_GET_STARTED && welcomePageId != "" {
|
||||
if _, err = w.CreateBlock(s, &pb.RpcBlockCreateWidgetRequest{
|
||||
ContextId: s.RootId(),
|
||||
WidgetLayout: model.BlockContentWidget_Link,
|
||||
Position: model.Block_InnerFirst,
|
||||
TargetId: s.RootId(),
|
||||
Block: &model.Block{
|
||||
Id: "welcome",
|
||||
Content: &model.BlockContentOfLink{Link: &model.BlockContentLink{
|
||||
TargetBlockId: welcomePageId,
|
||||
}},
|
||||
},
|
||||
}); err != nil {
|
||||
log.Errorf("failed to add welcome page widget: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, targetId := range widgetTargetsToCreate {
|
||||
if err := w.AddAutoWidget(s, targetId, "", addr.ObjectTypeAllViewId, model.BlockContentWidget_View, ""); err != nil {
|
||||
log.Errorf("failed to create widget block for type '%s': %v", targetId, err)
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue