Skip to content

Commit 807405f

Browse files
committed
feat: improve modules view
1 parent 161e847 commit 807405f

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

packages/devtools/client/components/ModuleItem.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const terminalId = useCurrentTerminalId()
2020
<ModuleItemBase :mod="mod" :info="staticInfo">
2121
<template #items>
2222
<div v-if="mod.entryPath" flex="~ gap-2" title="Open on filesystem">
23-
<span i-carbon-folder-move-to text-lg op50 />
23+
<span i-carbon-folder-move-to flex-none text-lg op50 />
2424
<FilepathItem :filepath="mod.entryPath" text-sm op50 hover="text-primary op100" />
2525
</div>
2626

@@ -33,7 +33,7 @@ const terminalId = useCurrentTerminalId()
3333
:to="id ? '/modules/terminals' : undefined"
3434
@click="id ? terminalId = id : undefined"
3535
>
36-
<span i-carbon-circle-dash animate-spin text-lg op50 />
36+
<span i-carbon-circle-dash flex-none animate-spin text-lg op50 />
3737
<code text-sm op50>Upgrading...</code>
3838
</NuxtLink>
3939
<div v-else-if="state === 'updated'" mx--2>
@@ -43,7 +43,7 @@ const terminalId = useCurrentTerminalId()
4343
items-center rounded bg-primary:10 px2 text-sm text-primary
4444
@click="restart"
4545
>
46-
<span i-carbon-intent-request-active text-lg text-primary />
46+
<span i-carbon-intent-request-active flex-none text-lg text-primary />
4747
<code text-xs>Update installed, click to restart</code>
4848
</button>
4949
</div>
@@ -53,14 +53,14 @@ const terminalId = useCurrentTerminalId()
5353
hover="bg-active"
5454
@click="update()"
5555
>
56-
<span i-carbon-intent-request-upgrade text-lg op50 />
56+
<span i-carbon-intent-request-upgrade flex-none text-lg op50 />
5757
<code op50>v{{ info.current }}</code>
5858
<div i-carbon-arrow-right op50 />
5959
<code text-green>v{{ info.latest }}</code>
6060
</button>
6161
</div>
6262
<div v-else-if="info?.latest" flex="~ gap-2" items-center title="NPM">
63-
<span i-carbon-cube text-lg op50 />
63+
<span i-carbon-cube flex-none text-lg op50 />
6464
<code text-sm op50>v{{ info.current }}</code>
6565
</div>
6666
</template>

packages/devtools/client/components/ModuleItemBase.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ const avatarBase = 'https://api.nuxtjs.org/api/ipx/s_44,f_webp/gh_avatar/'
2626
const githubBase = 'https://github.com/'
2727
const npmBase = 'https://www.npmjs.com/package/'
2828
29+
const { format: formatNumber } = Intl.NumberFormat(navigator.language || 'en', { notation: 'compact', maximumFractionDigits: 1 })
30+
31+
const stars = computed(() => formatNumber(data.value.stats?.stars || 0))
32+
const downloads = computed(() => formatNumber(data.value.stats?.downloads || 0))
33+
2934
const openInEditor = useOpenInEditor()
3035
</script>
3136

@@ -67,7 +72,7 @@ const openInEditor = useOpenInEditor()
6772
<div flex-auto />
6873

6974
<div v-if="data.website" flex="~ gap-2" title="Documentation">
70-
<span i-carbon-link text-lg op50 />
75+
<span i-carbon-link flex-none text-lg op50 />
7176
<NuxtLink
7277
:to="data.website"
7378
target="_blank"
@@ -78,7 +83,7 @@ const openInEditor = useOpenInEditor()
7883
</NuxtLink>
7984
</div>
8085
<div v-if="data.github" flex="~ gap-2">
81-
<span i-carbon-logo-github text-lg op50 />
86+
<span i-carbon-logo-github flex-none text-lg op50 />
8287
<NuxtLink
8388
:to="data.github"
8489
target="_blank"
@@ -93,16 +98,16 @@ const openInEditor = useOpenInEditor()
9398
<slot name="items" />
9499

95100
<div v-if="data.stats" flex="~ gap-4 items-center">
96-
<div flex="~ gap-2 items-center" op50>
97-
<NIcon icon="carbon-star" text-lg />
101+
<div v-if="data.stats.stars" flex="~ gap-2 items-center" op50>
102+
<NIcon icon="carbon-star" flex-none text-lg />
98103
<span>
99-
{{ data.stats.stars }}
104+
{{ stars }}
100105
</span>
101106
</div>
102-
<div flex="~ gap-2 items-center" op50>
103-
<NIcon icon="carbon-download" text-lg />
107+
<div v-if="data.stats.downloads" flex="~ gap-2 items-center" op50>
108+
<NIcon icon="carbon-download" flex-none text-lg />
104109
<span>
105-
{{ data.stats.downloads }}
110+
{{ downloads }}
106111
</span>
107112
</div>
108113
</div>
@@ -115,7 +120,7 @@ const openInEditor = useOpenInEditor()
115120
:factor="0.5"
116121
>
117122
<template #before>
118-
<NIcon icon="carbon-time" mr2 text-lg op50 />
123+
<NIcon icon="carbon-time" mr2 flex-none text-lg op50 />
119124
</template>
120125
</DurationDisplay>
121126
</div>
@@ -127,7 +132,7 @@ const openInEditor = useOpenInEditor()
127132
h-20 w-20 flex flex-none rounded bg-gray:3 p4
128133
>
129134
<img v-if="data.icon" :src="iconBase + data.icon" :alt="mod.name" ma>
130-
<div i-carbon-cube ma text-4xl op30 />
135+
<div v-else i-carbon-cube ma flex-none text-4xl op30 />
131136
</div>
132137
<div v-if="data.maintainers?.length && maintainers" flex="~" mt2 flex-auto items-end justify-end>
133138
<NuxtLink

packages/devtools/client/pages/modules/modules.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ registerCommands(() => [
119119
rounded-full text-xl :border="false"
120120
@click="installModuleOpen = false"
121121
/>
122-
123122
<ModuleInstallList @close="installModuleOpen = false" />
124123
</div>
125124
</Transition>

0 commit comments

Comments
 (0)