Skip to content

Commit

Permalink
renamed quickLinks to helpAndFeedback and adjusted links
Browse files Browse the repository at this point in the history
  • Loading branch information
miketalley committed Dec 9, 2022
1 parent 3b9b37e commit 4f98299
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 54 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@
"when": "hubspot.versionChecksComplete && hubspot.terminal.versions.installed.npm && !hubspot.terminal.versions.installed.hs || hubspot.updateAvailableForCLI"
},
{
"id": "hubspot.treedata.quickLinks",
"name": "Quick Links"
"id": "hubspot.treedata.helpAndFeedback",
"name": "Help & Feedback"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const EVENTS = {

export const TREE_DATA = {
ACCOUNTS: 'hubspot.treedata.accounts',
QUICK_LINKS: 'hubspot.treedata.quickLinks',
HELP_AND_FEEDBACK: 'hubspot.treedata.helpAndFeedback',
};

export const POLLING_INTERVALS = {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/providers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as vscode from 'vscode';

import { AccountsProvider } from './providers/accounts';
import { QuickLinksProvider } from './providers/quickLinks';
import { HelpAndFeedbackProvider } from './providers/helpAndFeedback';
import { COMMANDS, TREE_DATA } from './constants';

export const initializeProviders = (context: vscode.ExtensionContext) => {
const accountProvider = new AccountsProvider();
const quickLinksProvider = new QuickLinksProvider();
const helpAndFeedbackProvider = new HelpAndFeedbackProvider();

context.subscriptions.push(
vscode.commands.registerCommand(COMMANDS.ACCOUNTS_REFRESH, () => {
Expand All @@ -16,7 +16,7 @@ export const initializeProviders = (context: vscode.ExtensionContext) => {
);
vscode.window.registerTreeDataProvider(TREE_DATA.ACCOUNTS, accountProvider);
vscode.window.registerTreeDataProvider(
TREE_DATA.QUICK_LINKS,
quickLinksProvider
TREE_DATA.HELP_AND_FEEDBACK,
helpAndFeedbackProvider
);
};
34 changes: 34 additions & 0 deletions src/lib/providers/helpAndFeedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as vscode from 'vscode';
import { Link } from '../types';

export class HelpAndFeedbackProvider implements vscode.TreeDataProvider<any> {
getTreeItem(q: Link): vscode.TreeItem {
return new LinkTreeItem(q.label, vscode.Uri.parse(q.url));
}

getChildren(): Thenable<any> {
return Promise.resolve([
{
label: 'CLI Documentation',
url: 'https://developers.hubspot.com/docs/cms/developer-reference/local-development-cli#interacting-with-the-developer-file-system',
},
]);
}
}

export class LinkTreeItem extends vscode.TreeItem {
constructor(
public readonly label: string,
public readonly resourceUri: vscode.Uri
) {
super(label, vscode.TreeItemCollapsibleState.None);
this.tooltip = `Open link: ${resourceUri.toString()}`;
this.iconPath = new vscode.ThemeIcon('link-external');
this.contextValue = 'link';
this.command = {
command: 'vscode.open',
title: '',
arguments: [resourceUri],
};
}
}
46 changes: 0 additions & 46 deletions src/lib/providers/quickLinks.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface HubspotConfig {
useCustomObjectHubFile?: boolean | undefined;
}

export interface QuickLink {
export interface Link {
label: string;
url: string;
}

0 comments on commit 4f98299

Please sign in to comment.