-
Notifications
You must be signed in to change notification settings - Fork 399
Update to new card design #4065
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 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fea0840
Update to new card design
benceruleanlu dd69b69
Merge branch 'main' into bl-updated-manager-cards
benceruleanlu 8e96c8c
Move some card specific styling back to pt
benceruleanlu cb35670
Explanatory comment
benceruleanlu b9110e1
remove empty div
benceruleanlu 771e132
Update src/components/dialog/content/manager/packCard/PackCard.vue
benceruleanlu 9c31fa2
computed date!
benceruleanlu ebb26ca
readd deleted comments
benceruleanlu 228b4d4
remove duplicated caching
benceruleanlu ed2c66b
Revert "remove duplicated caching"
benceruleanlu 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
41 changes: 41 additions & 0 deletions
41
src/components/dialog/content/manager/packBanner/PackBanner.vue
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,41 @@ | ||
| <template> | ||
| <img | ||
| :src="isImageError ? DEFAULT_BANNER : imgSrc" | ||
| :alt="nodePack.name + ' banner'" | ||
| class="object-cover" | ||
| :style="{ width: cssWidth, height: cssHeight }" | ||
| @error="isImageError = true" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed, ref } from 'vue' | ||
|
|
||
| import { components } from '@/types/comfyRegistryTypes' | ||
|
|
||
| const DEFAULT_BANNER = '/assets/images/fallback-gradient-avatar.svg' | ||
|
|
||
| const { | ||
| nodePack, | ||
| width = '100%', | ||
| height = '12rem' | ||
| } = defineProps<{ | ||
| nodePack: components['schemas']['Node'] & { banner?: string } // Temporary measure until banner is in backend | ||
| width?: string | ||
| height?: string | ||
| }>() | ||
|
|
||
| const isImageError = ref(false) | ||
| const shouldShowFallback = computed( | ||
| () => !nodePack.banner || nodePack.banner.trim() === '' || isImageError.value | ||
| ) | ||
| const imgSrc = computed(() => | ||
| shouldShowFallback.value ? DEFAULT_BANNER : nodePack.banner | ||
| ) | ||
|
|
||
| const convertToCssValue = (value: string | number) => | ||
| typeof value === 'number' ? `${value}rem` : value | ||
|
|
||
| const cssWidth = computed(() => convertToCssValue(width)) | ||
| const cssHeight = computed(() => convertToCssValue(height)) | ||
| </script> |
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
32 changes: 11 additions & 21 deletions
32
src/components/dialog/content/manager/packCard/PackCardFooter.vue
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 |
|---|---|---|
| @@ -1,39 +1,29 @@ | ||
| <template> | ||
| <div | ||
| class="flex justify-between px-5 py-4 text-xs text-muted font-medium leading-3" | ||
| class="flex justify-between items-center px-4 py-2 text-xs text-muted font-medium leading-3" | ||
| > | ||
| <div class="flex items-center gap-2 cursor-pointer"> | ||
| <span v-if="publisherName" class="max-w-40 truncate"> | ||
| {{ publisherName }} | ||
| </span> | ||
| </div> | ||
| <div | ||
| v-if="nodePack.latest_version?.createdAt" | ||
| class="flex items-center gap-2 truncate" | ||
| > | ||
| {{ $t('g.updated') }} | ||
| {{ | ||
| $d(new Date(nodePack.latest_version.createdAt), { | ||
| dateStyle: 'medium' | ||
| }) | ||
| }} | ||
| <div v-if="nodePack.downloads" class="flex items-center gap-1.5"> | ||
| <i class="pi pi-download text-muted"></i> | ||
| <span>{{ formattedDownloads }}</span> | ||
| </div> | ||
| <PackInstallButton :node-packs="[nodePack]" /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| import PackInstallButton from '@/components/dialog/content/manager/button/PackInstallButton.vue' | ||
| import type { components } from '@/types/comfyRegistryTypes' | ||
|
|
||
| const { nodePack } = defineProps<{ | ||
| nodePack: components['schemas']['Node'] | ||
| }>() | ||
|
|
||
| const publisherName = computed(() => { | ||
| if (!nodePack) return null | ||
| const { n } = useI18n() | ||
|
|
||
| const { publisher, author } = nodePack | ||
| return publisher?.name ?? publisher?.id ?? author | ||
| }) | ||
| const formattedDownloads = computed(() => | ||
| nodePack.downloads ? n(nodePack.downloads) : '' | ||
| ) | ||
| </script> |
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.