Skip to content

Commit 93f9dbe

Browse files
committed
fix: don't hide replacement details when no-dep col added
user needs to be able to reference the full details
1 parent 9b49e3c commit 93f9dbe

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

app/components/Compare/PackageSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const EASTER_EGG_TRIGGERS = new Set([
3434
'use the platform',
3535
])
3636
37-
// Check if "no dependency" option should show
37+
// Check if "no dependency" option should show in typeahead
3838
const showNoDependencyOption = computed(() => {
3939
if (packages.value.includes(NO_DEPENDENCY_ID)) return false
4040
const input = inputValue.value.toLowerCase().trim()

app/components/Compare/ReplacementSuggestion.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const props = defineProps<{
66
replacement: ModuleReplacement
77
/** Whether this suggestion should show the "no dep" action (native/simple) or just info (documented) */
88
variant: 'nodep' | 'info'
9+
/** Whether to show the action button (defaults to true) */
10+
showAction?: boolean
911
}>()
1012
1113
const emit = defineEmits<{
@@ -63,7 +65,7 @@ const docUrl = computed(() => {
6365

6466
<!-- No dependency action button -->
6567
<button
66-
v-if="variant === 'nodep'"
68+
v-if="variant === 'nodep' && showAction !== false"
6769
type="button"
6870
class="flex-shrink-0 px-2 py-1 text-xs font-medium bg-amber-500/20 hover:bg-amber-500/30 rounded transition-colors"
6971
:aria-label="$t('compare.no_dependency.add_column')"

app/pages/compare.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ const gridColumns = computed(() =>
5959
}),
6060
)
6161
62-
// Filter "no dep" suggestions to only show if not already added and we have room
63-
const actionableNoDepSuggestions = computed(() => {
64-
if (packages.value.length >= 4) return [] // Can't add more
65-
if (packages.value.includes(NO_DEPENDENCY_ID)) return [] // Already added
66-
return noDepSuggestions.value
67-
})
62+
// Whether we can add the no-dep column (not already added and have room)
63+
const canAddNoDep = computed(
64+
() => packages.value.length < 4 && !packages.value.includes(NO_DEPENDENCY_ID),
65+
)
6866
6967
// Add "no dependency" column to comparison
7068
function addNoDep() {
@@ -140,13 +138,14 @@ useSeoMeta({
140138
<ComparePackageSelector v-model="packages" :max="4" />
141139

142140
<!-- "No dep" replacement suggestions (native, simple) -->
143-
<div v-if="actionableNoDepSuggestions.length > 0" class="mt-3 space-y-2">
141+
<div v-if="noDepSuggestions.length > 0" class="mt-3 space-y-2">
144142
<CompareReplacementSuggestion
145-
v-for="suggestion in actionableNoDepSuggestions"
143+
v-for="suggestion in noDepSuggestions"
146144
:key="suggestion.forPackage"
147145
:package-name="suggestion.forPackage"
148146
:replacement="suggestion.replacement"
149147
variant="nodep"
148+
:show-action="canAddNoDep"
150149
@add-no-dep="addNoDep"
151150
/>
152151
</div>

0 commit comments

Comments
 (0)