Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving stripe samples to it's own menu #262

Merged
merged 5 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,22 @@
"name": "Logs",
"when": "stripe.isNotCLIInstalled == false"
},
{
"id": "stripeSamplesView",
"name": "Samples",
"when": "stripe.isNotCLIInstalled == false"
},
{
"id": "stripeQuickLinksView",
"name": "Quick Links",
"when": "stripe.isNotCLIInstalled == false"
"when": "stripe.isNotCLIInstalled == false",
"visibility": "collapsed"
},
{
"id": "stripeHelpView",
"name": "Help and feedback",
"when": "stripe.isNotCLIInstalled == false"
"when": "stripe.isNotCLIInstalled == false",
"visibility": "collapsed"
}
]
},
Expand Down Expand Up @@ -274,6 +281,10 @@
{
"command": "stripe.openDashboardLogFromTreeItemContextMenu",
"when": "viewItem == logItem"
},
{
"command": "stripe.openSamples",
"when": "viewItem == samplesItem"
}
],
"commandPalette": [
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {StripeLinter} from './stripeLinter';
import {StripeLogsViewProvider} from './stripeLogsView';
import {StripeQuickLinksViewProvider} from './stripeQuickLinksView';
import {StripeSamples} from './stripeSamples';
import {StripeSamplesViewProvider} from './stripeSamplesView';
import {StripeTerminal} from './stripeTerminal';
import {SurveyPrompt} from './surveyPrompt';
import {TelemetryPrompt} from './telemetryPrompt';
Expand Down Expand Up @@ -48,6 +49,11 @@ export function activate(this: any, context: ExtensionContext) {
showCollapseAll: true,
});

window.createTreeView('stripeSamplesView', {
treeDataProvider: new StripeSamplesViewProvider(),
showCollapseAll: false,
});

window.createTreeView('stripeQuickLinksView', {
treeDataProvider: new StripeQuickLinksViewProvider(),
showCollapseAll: false,
Expand Down
7 changes: 0 additions & 7 deletions src/stripeHelpView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ export class StripeHelpViewProvider extends StripeTreeViewDataProvider {
});
items.push(docsItem);

const samplesItem = new StripeTreeItem('Find code samples', {
ctrudeau-stripe marked this conversation as resolved.
Show resolved Hide resolved
commandString: 'openSamples',
iconPath: new ThemeIcon('code'),
tooltip: 'Sample integrations built by Stripe',
});
items.push(samplesItem);

const reportItem = new StripeTreeItem('Report issue', {
commandString: 'openReportIssue',
iconPath: new ThemeIcon('report'),
Expand Down
8 changes: 0 additions & 8 deletions src/stripeQuickLinksView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ export class StripeQuickLinksViewProvider extends StripeTreeViewDataProvider {
buildTree(): Promise<StripeTreeItem[]> {
const items = [];

const samplesItem = new StripeTreeItem('Start with a Stripe sample', {
commandString: 'createStripeSample',
iconPath: new ThemeIcon('repo-clone'),
tooltip: 'Clone a sample integration built by Stripe',
});

items.push(samplesItem);

const apiKeysItem = new StripeTreeItem('Open API keys page', {
commandString: 'openDashboardApikeys',
iconPath: new ThemeIcon('link-external'),
Expand Down
20 changes: 20 additions & 0 deletions src/stripeSamplesView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {StripeTreeItem} from './stripeTreeItem';
import {StripeTreeViewDataProvider} from './stripeTreeViewDataProvider';
import {ThemeIcon} from 'vscode';

export class StripeSamplesViewProvider extends StripeTreeViewDataProvider {
buildTree(): Promise<StripeTreeItem[]> {
const items = [];

const samplesItem = new StripeTreeItem('Start with a Stripe Sample', {
commandString: 'createStripeSample',
iconPath: new ThemeIcon('repo-clone'),
tooltip: 'Clone a sample integration built by Stripe',
contextValue: 'samplesItem',
});

items.push(samplesItem);

return Promise.resolve(items);
}
}