-
-
Notifications
You must be signed in to change notification settings - Fork 202
feat(ui): add e18e module replacement recommendations to /compare page
#801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
492cc30
feat: suggest package comparisons based on module-replacements
serhalp e7140c1
Merge branch 'main' into feat/suggest-pkg-comparisons-and-no-dep
serhalp 3ddcd91
chore: resort to ye olde temp rename
serhalp bb8d133
chore: ye olde rename back from tmp
serhalp d2a9908
fix: escape `@` in i18n strings
serhalp 04baba9
Merge branch 'main' into feat/suggest-pkg-comparisons-and-no-dep
serhalp fb0e360
fix: remove custom tooltip and simplify
serhalp 8dcea70
Merge branch 'main' into feat/suggest-pkg-comparisons-and-no-dep
serhalp 2baed3e
refactor: remove unused image
serhalp af7f208
fix: render zero pkg and install size
serhalp f6e445d
test: update test assertion
serhalp ce0b30d
fix: update mismatched aria-label
serhalp 9b49e3c
fix: fix regression with no-dependency column
serhalp 93f9dbe
fix: don't hide replacement details when no-dep col added
serhalp 67e9f14
fix: remove a hardcoded English aria-label
serhalp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| <script setup lang="ts"> | ||
| import type { ModuleReplacement } from 'module-replacements' | ||
|
|
||
| const props = defineProps<{ | ||
| packageName: string | ||
| replacement: ModuleReplacement | ||
| /** Whether this suggestion should show the "no dep" action (native/simple) or just info (documented) */ | ||
| variant: 'nodep' | 'info' | ||
| /** Whether to show the action button (defaults to true) */ | ||
| showAction?: boolean | ||
| }>() | ||
|
|
||
| const emit = defineEmits<{ | ||
| addNoDep: [] | ||
| }>() | ||
|
|
||
| const docUrl = computed(() => { | ||
| if (props.replacement.type !== 'documented' || !props.replacement.docPath) return null | ||
| // TODO(serhalp): Once the e18e docs site is complete, link there instead | ||
| return `https://github.com/es-tooling/module-replacements/blob/main/docs/modules/${props.replacement.docPath}.md` | ||
serhalp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| class="flex items-start gap-2 px-3 py-2 rounded-lg text-sm" | ||
| :class=" | ||
| variant === 'nodep' | ||
| ? 'bg-amber-500/10 border border-amber-600/30 text-amber-700 dark:text-amber-400' | ||
| : 'bg-blue-500/10 border border-blue-600/30 text-blue-700 dark:text-blue-400' | ||
| " | ||
| > | ||
| <span | ||
| class="w-4 h-4 flex-shrink-0 mt-0.5" | ||
| :class="variant === 'nodep' ? 'i-carbon:idea' : 'i-carbon:information'" | ||
| /> | ||
| <div class="min-w-0 flex-1"> | ||
| <p class="font-medium">{{ packageName }}: {{ $t('package.replacement.title') }}</p> | ||
| <p class="text-xs mt-0.5 opacity-80"> | ||
| <template v-if="replacement.type === 'native'"> | ||
| {{ | ||
| $t('package.replacement.native', { | ||
| replacement: replacement.replacement, | ||
| nodeVersion: replacement.nodeVersion, | ||
| }) | ||
| }} | ||
| </template> | ||
| <template v-else-if="replacement.type === 'simple'"> | ||
| {{ | ||
| $t('package.replacement.simple', { | ||
| replacement: replacement.replacement, | ||
| community: $t('package.replacement.community'), | ||
| }) | ||
| }} | ||
| </template> | ||
| <template v-else-if="replacement.type === 'documented'"> | ||
| {{ | ||
| $t('package.replacement.documented', { | ||
| community: $t('package.replacement.community'), | ||
| }) | ||
| }} | ||
| </template> | ||
| </p> | ||
| </div> | ||
|
|
||
| <!-- No dependency action button --> | ||
| <button | ||
| v-if="variant === 'nodep' && showAction !== false" | ||
| type="button" | ||
| class="flex-shrink-0 px-2 py-1 text-xs font-medium bg-amber-500/20 hover:bg-amber-500/30 rounded transition-colors" | ||
| :aria-label="$t('compare.no_dependency.add_column')" | ||
| @click="emit('addNoDep')" | ||
| > | ||
| {{ $t('package.replacement.consider_no_dep') }} | ||
| </button> | ||
|
|
||
| <!-- Info link --> | ||
| <a | ||
| v-else-if="docUrl" | ||
| :href="docUrl" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="flex-shrink-0 px-2 py-1 text-xs font-medium bg-blue-500/20 hover:bg-blue-500/30 rounded transition-colors inline-flex items-center gap-1" | ||
| > | ||
| {{ $t('package.replacement.learn_more') }} | ||
| <span class="i-carbon:launch w-3 h-3" /> | ||
| </a> | ||
| </div> | ||
| </template> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.