Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve UX Further
  • Loading branch information
shanalikhan authored Jul 22, 2019
2 parents 76f64a6 + df7554d commit c91cba3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/service/webview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,14 @@ export class WebviewService {
} else {
gistSelectionPanel.dispose();
}
});
webview.webview = gistSelectionPanel;
gistSelectionPanel.onDidDispose(() => {
webview.webview = null;
if (cmd) {
vscode.commands.executeCommand(cmd);
}
});
webview.webview = gistSelectionPanel;
gistSelectionPanel.onDidDispose(() => (webview.webview = null));
return gistSelectionPanel;
}

Expand Down
10 changes: 9 additions & 1 deletion ui/gist-selection/gist-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ appendHTML(skipContainer, skip);
const selectionTemplate = `
<button type="button" onclick="saveGistId('@id')" class="list-group-item list-group-item-action">@description (@id) – Updated @timestamp ago</button>`;

gists
if (!gists.length) {
appendHTML(
selectionContainer,
"<p>No Gists found on your account. Skip this window and upload the settings to create a new Gist.</p>"
);
} else {
gists
.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at))
.forEach(gist => {
const html = selectionTemplate
Expand All @@ -79,3 +85,5 @@ gists
);
appendHTML(selectionContainer, html);
});
}

0 comments on commit c91cba3

Please sign in to comment.