Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: show page list when opening files without pages
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed May 24, 2018
1 parent fc98fb2 commit b57515b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/electron/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ Sender.receive(message => {
const newProject = Project.from(message.payload.contents);
newProject.setPath(message.payload.path);
store.setProject(newProject);
store.setActiveView(Types.AlvaView.PageDetail);

const view =
newProject.getPages().length === 0 ? Types.AlvaView.Pages : Types.AlvaView.PageDetail;

store.setActiveView(view);

const patternLibrary = newProject.getPatternLibrary();

Expand Down
10 changes: 10 additions & 0 deletions src/store/view-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ export class ViewStore {
return;
}

const pages = this.project.getPages();

if (pages.length === 0) {
return;
}

if (pages.length - 1 < this.activePage) {
return;
}

return this.project.getPages()[this.activePage];
}

Expand Down

0 comments on commit b57515b

Please sign in to comment.