updates
This commit is contained in:
@@ -31,11 +31,6 @@ const TOOLS: ToolDefinition[] = [
|
||||
description: 'Check MRAID requirements and best practices',
|
||||
beta: true,
|
||||
},
|
||||
{
|
||||
command: 'hplToolbox.openDailyUpdate',
|
||||
title: 'Daily Update',
|
||||
description: 'Compose & copy a daily status',
|
||||
},
|
||||
{
|
||||
command: 'hplToolbox.openSendToMobile',
|
||||
title: 'Send To Mobile',
|
||||
@@ -45,11 +40,12 @@ const TOOLS: ToolDefinition[] = [
|
||||
command: 'hplToolbox.openPlayworksConverter',
|
||||
title: 'Playworks Converter',
|
||||
description: 'Convert Playworks HTML to per-network variants',
|
||||
beta: true,
|
||||
},
|
||||
];
|
||||
|
||||
export class LauncherViewProvider implements vscode.WebviewViewProvider {
|
||||
constructor(private readonly context: vscode.ExtensionContext) {}
|
||||
constructor(private readonly context: vscode.ExtensionContext) { }
|
||||
|
||||
resolveWebviewView(view: vscode.WebviewView) {
|
||||
view.webview.options = { enableScripts: true };
|
||||
@@ -68,7 +64,7 @@ export class LauncherViewProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
|
||||
function getHtml(version: string, betaToolsEnabled: boolean): string {
|
||||
const visibleTools = TOOLS.filter(tool => betaToolsEnabled || !tool.beta);
|
||||
const visibleTools = sortToolsForDisplay(TOOLS.filter(tool => betaToolsEnabled || !tool.beta));
|
||||
const hiddenBetaCount = TOOLS.filter(tool => tool.beta).length - visibleTools.filter(tool => tool.beta).length;
|
||||
const toolButtons = visibleTools.map(renderToolButton).join('\n');
|
||||
return `<!DOCTYPE html>
|
||||
@@ -155,6 +151,10 @@ ${toolButtons}
|
||||
</html>`;
|
||||
}
|
||||
|
||||
function sortToolsForDisplay(tools: ToolDefinition[]): ToolDefinition[] {
|
||||
return [...tools].sort((a, b) => Number(Boolean(a.beta)) - Number(Boolean(b.beta)));
|
||||
}
|
||||
|
||||
function renderToolButton(tool: ToolDefinition): string {
|
||||
return ` <button class="tool-btn" data-cmd="${escapeHtml(tool.command)}">
|
||||
<span class="tool-title">${escapeHtml(tool.title)}${tool.beta ? ' <span class="beta-badge">Beta</span>' : ''}</span>
|
||||
|
||||
Reference in New Issue
Block a user