Repository navigation
feat(website): the Hub's model page behind the flag #21101
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
Open
mariana953
wants to merge
10
commits into
mariana/hub-home-banner
Choose a base branch
from
mariana/hub-model-page
base: mariana/hub-home-banner
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9704a54
feat(website): the Hub's Apps catalogue behind the flag
mariana953 2abdf45
chore(website): leave the live apps' new covers for their own change
mariana953 136f995
feat(website): the Hub's model page behind the flag
mariana953 ad020db
fix(website): load the apps half of the catalogue only when it is shown
mariana953 d867d99
Merge branch 'mariana/hub-apps' into mariana/hub-model-page
mariana953 ca7b35f
fix(website): show the Hub copy, tabs and impressions on the Hub apps…
mariana953 247a4b1
Merge branch 'mariana/hub-apps' into mariana/hub-model-page
mariana953 8656fe7
fix(website): count only openable apps in the Hub grid impression
mariana953 ad835d1
fix(website): latch the Hub model page and hold the published one unt…
mariana953 b34dd5e
Merge remote-tracking branch 'origin/mariana/hub-apps' into mariana/h…
mariana953 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
| <script setup lang="ts"> | ||
| import { defineAsyncComponent } from 'vue' | ||
|
|
||
| import type { Locale } from '@/i18n/translations' | ||
| import type { CatalogueApp } from '@/lib/workshop/catalogue-apps' | ||
| import { | ||
| loadAppCatalogue, | ||
| loadHubAppCatalogue | ||
| } from '@/lib/workshop/catalogue-components' | ||
| import { HUB_HOME_FLAG } from '@/lib/workshop/hub-section' | ||
| import { useWorkshopFlag } from '@/scripts/posthog' | ||
|
|
||
| const { apps, locale = 'en' } = defineProps<{ | ||
| apps: readonly CatalogueApp[] | ||
| locale?: Locale | ||
| }>() | ||
| const browseAll = defineModel<boolean>('browseAll') | ||
| const emit = defineEmits<{ section: [inSection: boolean] }>() | ||
|
|
||
| const AppCatalogue = defineAsyncComponent(loadAppCatalogue) | ||
| const HubAppCatalogue = defineAsyncComponent(loadHubAppCatalogue) | ||
| const hubOpen = useWorkshopFlag(HUB_HOME_FLAG) | ||
| </script> | ||
|
|
||
| <template> | ||
| <HubAppCatalogue v-if="hubOpen" :apps :locale> | ||
| <template #tabs> | ||
| <slot name="tabs" /> | ||
| </template> | ||
| </HubAppCatalogue> | ||
| <AppCatalogue | ||
| v-else | ||
| v-model:browse-all="browseAll" | ||
| :apps | ||
| :locale | ||
| @section="emit('section', $event)" | ||
| > | ||
| <template #tabs> | ||
| <slot name="tabs" /> | ||
| </template> | ||
| </AppCatalogue> | ||
| </template> |
42 changes: 42 additions & 0 deletions
42
apps/website/src/components/workshop/CatalogueShowMore.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,42 @@ | ||
| <script setup lang="ts"> | ||
| import { ChevronDown } from '@lucide/vue' | ||
|
|
||
| import type { Locale } from '@/i18n/translations' | ||
| import { translationsFor } from '@/i18n/translations' | ||
|
|
||
| const { | ||
| shown, | ||
| total, | ||
| locale = 'en' | ||
| } = defineProps<{ | ||
| shown: number | ||
| total: number | ||
| locale?: Locale | ||
| }>() | ||
| const { t } = translationsFor(locale) | ||
|
|
||
| defineEmits<{ more: [] }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="mt-10 flex flex-col items-center gap-4 max-sm:mt-8"> | ||
| <p | ||
| class="text-sm text-primary-warm-gray tabular-nums" | ||
| data-testid="catalogue-show-more-count" | ||
| > | ||
| {{ t('workshop.hub.showingOf', { shown, total }) }} | ||
| </p> | ||
| <button | ||
| type="button" | ||
| class="group flex w-full cursor-pointer items-center justify-center gap-2 rounded-2xl border border-transparency-white-t8 px-8 py-4 text-sm font-medium text-primary-comfy-canvas transition-colors outline-none hover:border-primary-comfy-yellow hover:text-primary-comfy-yellow focus-visible:ring-3 focus-visible:ring-primary-comfy-yellow/50" | ||
| data-testid="catalogue-show-more" | ||
| @click="$emit('more')" | ||
| > | ||
| {{ t('workshop.hub.showMore') }} | ||
| <ChevronDown | ||
| class="size-4 transition-transform group-hover:translate-y-0.5" | ||
| aria-hidden="true" | ||
| /> | ||
| </button> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <script setup lang="ts"> | ||
| import { ChevronLeft } from '@lucide/vue' | ||
| import { computed, onMounted, ref } from 'vue' | ||
|
|
||
| import { getRoutes } from '@/config/routes' | ||
| import { t } from '@/i18n/translations' | ||
| import type { ListReturn } from '@/lib/workshop/hub-list-memory' | ||
| import { lastList } from '@/lib/workshop/hub-list-memory' | ||
| import HubBreadcrumb from './HubBreadcrumb.vue' | ||
|
|
||
| const { section, name } = defineProps<{ | ||
| section: 'models' | 'workflows' | ||
| name: string | ||
| }>() | ||
|
|
||
| const routes = getRoutes() | ||
| const sectionList = { | ||
| models: { href: routes.workshop, label: t('workshop.model.breadcrumb') }, | ||
| workflows: { href: routes.hubWorkflows, label: t('workshop.hub.workflows') } | ||
| }[section] | ||
| const hub = { href: routes.hubExplore, label: t('workshop.catalogue.eyebrow') } | ||
|
|
||
| const remembered = ref<ListReturn>() | ||
|
|
||
| // Most visitors reach a page from a list, and the way back they want is that | ||
| // list as they left it. Opened in a new tab, or from a shared link, there is | ||
| // no list to return to and the section answers. | ||
| onMounted(() => { | ||
| remembered.value = lastList(location.pathname) | ||
| }) | ||
|
|
||
| const back = computed(() => { | ||
| const list = remembered.value | ||
| if (!list) return sectionList | ||
| if (list.href === hub.href) return hub | ||
| return { href: list.href, label: list.label ?? sectionList.label } | ||
| }) | ||
|
|
||
| const crumbs = computed(() => [ | ||
| { ...hub, testId: 'detail-hub' }, | ||
| { | ||
| ...(back.value === hub ? sectionList : back.value), | ||
| testId: 'detail-list' | ||
| }, | ||
| { label: name } | ||
| ]) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="min-w-0" data-testid="detail-trail"> | ||
| <HubBreadcrumb :crumbs class="max-sm:hidden" /> | ||
| <a | ||
| :href="back.href" | ||
| :aria-label="t('workshop.model.backTo', { category: back.label })" | ||
| class="-ml-1 inline-flex max-w-full min-w-0 items-center gap-1 rounded-lg px-1 text-sm font-medium text-primary-warm-gray transition-colors outline-none hover:text-primary-comfy-canvas focus-visible:ring-3 focus-visible:ring-primary-comfy-yellow/50 sm:hidden" | ||
| data-testid="detail-back" | ||
| > | ||
| <ChevronLeft class="size-4 shrink-0" aria-hidden="true" /> | ||
| <span class="truncate">{{ back.label }}</span> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| <script setup lang="ts"> | ||
| import { Check } from '@lucide/vue' | ||
| import { computed } from 'vue' | ||
|
|
||
| import { cn } from '@comfyorg/tailwind-utils' | ||
|
|
||
| import type { PlaygroundExample } from '@/config/workshop-playground' | ||
| import type { Locale } from '@/i18n/translations' | ||
| import { translationsFor } from '@/i18n/translations' | ||
| import ExampleMedia from './ExampleMedia.vue' | ||
|
|
||
| const { | ||
| example, | ||
| locale = 'en', | ||
| disabled = false | ||
| } = defineProps<{ | ||
| example: PlaygroundExample | ||
| active: boolean | ||
| alt: string | ||
| videoPreload: 'metadata' | 'none' | ||
| locale?: Locale | ||
| disabled?: boolean | ||
| }>() | ||
| const { t } = translationsFor(locale) | ||
|
|
||
| const emit = defineEmits<{ open: [] }>() | ||
|
|
||
| const specs = computed(() => example.specs.join(' · ')) | ||
|
|
||
| function actionFor(active = false) { | ||
| if (example.sampleOnly) | ||
| return t(active ? 'workshop.examples.viewing' : 'workshop.examples.view') | ||
| return t(active ? 'workshop.examples.using' : 'workshop.examples.use') | ||
| } | ||
|
|
||
| const openLabel = computed(() => | ||
| example.sampleOnly ? actionFor() : t('workshop.examples.open') | ||
| ) | ||
| </script> | ||
|
|
||
| <template> | ||
| <figure class="flex flex-col gap-2"> | ||
| <button | ||
| type="button" | ||
| :aria-label="`${example.title}: ${openLabel}`" | ||
| :aria-current="active ? 'true' : undefined" | ||
| :disabled | ||
| class="group flex w-full cursor-pointer flex-col gap-2 text-left outline-none disabled:cursor-not-allowed disabled:opacity-50" | ||
| data-testid="example-card" | ||
| :title="`${example.title} · ${actionFor(active)}`" | ||
| @click="emit('open')" | ||
| > | ||
| <span | ||
| :class=" | ||
| cn( | ||
| 'relative block aspect-video overflow-hidden rounded-lg bg-primary-comfy-ink-light ring-1 transition-all', | ||
| active | ||
| ? 'ring-2 ring-primary-comfy-yellow group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-primary-warm-white' | ||
| : 'ring-transparency-white-t8 group-hover:-translate-y-0.5 group-hover:ring-transparency-white-t20 group-hover:brightness-110 group-focus-visible:ring-primary-comfy-yellow' | ||
| ) | ||
| " | ||
| data-testid="example-thumbnail" | ||
| > | ||
| <ExampleMedia :example :alt :video-preload /> | ||
|
|
||
| <span | ||
| v-if="active" | ||
| class="absolute top-1.5 right-1.5 grid size-5 place-items-center rounded-full bg-primary-comfy-yellow text-primary-comfy-ink" | ||
| data-testid="example-chosen" | ||
| > | ||
| <Check class="size-3" :stroke-width="3" aria-hidden="true" /> | ||
| </span> | ||
| <span | ||
| v-else | ||
| class="absolute top-1.5 left-1.5 rounded-full bg-black/70 px-2 py-0.5 text-[11px] font-medium text-primary-warm-white opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" | ||
| aria-hidden="true" | ||
| > | ||
| {{ actionFor() }} | ||
| </span> | ||
|
|
||
| <span | ||
| class="absolute inset-x-0 bottom-0 flex flex-col gap-0.5 bg-linear-to-t from-black/85 to-transparent px-2 pt-6 pb-1.5" | ||
| > | ||
| <span class="line-clamp-1 text-xs text-primary-warm-white"> | ||
| {{ example.title }} | ||
| </span> | ||
| <span | ||
| v-if="specs" | ||
| class="line-clamp-1 text-[11px] text-primary-comfy-canvas/70" | ||
| data-testid="example-specs" | ||
| > | ||
| {{ specs }} | ||
| </span> | ||
| </span> | ||
| </span> | ||
| </button> | ||
| <audio | ||
| v-if="example.mediaKind === 'audio'" | ||
| :src="example.outputUrl" | ||
| :aria-label="alt" | ||
| controls | ||
| preload="metadata" | ||
| class="w-full" | ||
| /> | ||
| </figure> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <script setup lang="ts"> | ||
| import { Music2 } from '@lucide/vue' | ||
|
|
||
| import type { PlaygroundExample } from '@/config/workshop-playground' | ||
| import { isVideoUrl, videoPosterUrl } from '@/config/workshop-playground' | ||
|
|
||
| defineProps<{ | ||
| example: PlaygroundExample | ||
| alt: string | ||
| videoPreload: 'metadata' | 'none' | ||
| }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <video | ||
| v-if="example.mediaKind === 'video' || isVideoUrl(example.outputUrl)" | ||
| :src="videoPosterUrl(example.outputUrl)" | ||
| :aria-label="alt" | ||
| class="size-full object-cover" | ||
| muted | ||
| playsinline | ||
| :preload="videoPreload" | ||
| data-testid="example-video" | ||
| /> | ||
| <Music2 | ||
| v-else-if="example.mediaKind === 'audio'" | ||
| class="size-full px-3" | ||
| aria-hidden="true" | ||
| /> | ||
| <img | ||
| v-else-if="example.outputUrl" | ||
| :src="example.outputUrl" | ||
| :alt | ||
| class="size-full object-cover" | ||
| loading="lazy" | ||
| decoding="async" | ||
| /> | ||
| </template> |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: same repo rule. This comment is new code. A name like
restoreListVisitorCameFromon the mount callback, or a test title, can carry the "new tab / shared link falls back to the section" rationale instead.