Skip to content

Commit e494aa9

Browse files
committed
feat: improve data display for dev tools and templates
1 parent cb45e9c commit e494aa9

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/extension.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
fetchData,
1010
getCommandToRun,
1111
getCompatibilityList,
12+
getEntryTypeLabel,
1213
getPlatformsList,
1314
KEYWORD_REGEX,
1415
numberFormatter,
@@ -98,7 +99,7 @@ export async function activate(context: ExtensionContext) {
9899
`$(eye) ${numberFormatter.format(selectedEntry.github.stats.subscribers)}`
99100
].join(' ')
100101
},
101-
{
102+
!selectedEntry.template && {
102103
label: ENTRY_OPTION.VISIT_NPM,
103104
description: selectedEntry.npm?.downloads
104105
? `$(arrow-circle-down) ${numberFormatter.format(selectedEntry.npm.downloads)}`
@@ -116,7 +117,7 @@ export async function activate(context: ExtensionContext) {
116117
label: ENTRY_OPTION.VIEW_DEPENDENCIES,
117118
description: `$(package) ${numberFormatter.format(selectedEntry.github.stats.dependencies)} ${selectedEntry.github.stats.dependencies === 1 ? 'dependency' : 'dependencies'}`
118119
},
119-
{ label: ENTRY_OPTION.VIEW_BUNDLEPHOBIA },
120+
!selectedEntry.template && { label: ENTRY_OPTION.VIEW_BUNDLEPHOBIA },
120121
{ label: 'details', kind: QuickPickItemKind.Separator },
121122
{
122123
label: ENTRY_OPTION.PLATFORMS,
@@ -132,15 +133,15 @@ export async function activate(context: ExtensionContext) {
132133
},
133134
...examplesActions,
134135
{ label: 'copy data', kind: QuickPickItemKind.Separator },
135-
{ label: ENTRY_OPTION.COPY_NAME },
136+
!selectedEntry.template && { label: ENTRY_OPTION.COPY_NAME },
136137
{ label: ENTRY_OPTION.COPY_REPO_URL },
137-
{ label: ENTRY_OPTION.COPY_NPM_URL },
138+
!selectedEntry.template && { label: ENTRY_OPTION.COPY_NPM_URL },
138139
{ label: '', kind: QuickPickItemKind.Separator },
139140
{ label: ENTRY_OPTION.GO_BACK }
140141
].filter((option) => !!option && typeof option === 'object');
141142

142143
const optionPick = window.createQuickPick();
143-
optionPick.title = `Actions for "${selectedEntry.label}"`;
144+
optionPick.title = `Actions for "${selectedEntry.label}" ${getEntryTypeLabel(selectedEntry)}`;
144145
optionPick.placeholder = 'Select an action';
145146
optionPick.items = possibleActions;
146147
optionPick.show();

src/utils.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@ export const VALID_KEYWORDS_MAP = {
5858
export type ValidKeyword = keyof typeof VALID_KEYWORDS_MAP;
5959

6060
function getDetailLabel(item: PackageData) {
61+
const platforms = getPlatformsList(item);
6162
return [
6263
`$(star) ${numberFormatter.format(item.github.stats.stars)}`,
6364
`$(gist-fork) ${numberFormatter.format(item.github.stats.forks)}`,
6465
item.npm?.downloads && `$(arrow-circle-down) ${numberFormatter.format(item.npm.downloads)}`,
65-
'•',
66-
getPlatformsList(item).join(', '),
66+
(item.dev || item.template) && '•',
67+
item.dev && '$(tools) Dev Tool',
68+
item.template && '$(folder-library) Template',
69+
platforms.length && '•',
70+
platforms.join(', '),
6771
(item.newArchitecture || item.expoGo || item.github.hasTypes) && '•',
6872
(item.newArchitecture || item.expoGo) &&
6973
`$(verified) New Architecture${item.newArchitecture === 'new-arch-only' ? ' only' : ''}`,
@@ -169,3 +173,12 @@ export async function openListWithSearch(packagesPick: QuickPick<DirectoryEntry>
169173
packagesPick.placeholder = STRINGS.PLACEHOLDER;
170174
packagesPick.busy = false;
171175
}
176+
177+
export function getEntryTypeLabel(entry: DirectoryEntry): string {
178+
if (entry.template) {
179+
return ' template';
180+
} else if (entry.dev) {
181+
return ' development tool';
182+
}
183+
return 'library';
184+
}

0 commit comments

Comments
 (0)