From 448353174c731a35301c72a60b3d6f121b76f364 Mon Sep 17 00:00:00 2001 From: andrewwallacespeckle <139135120+andrewwallacespeckle@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:00:45 +0000 Subject: [PATCH] refactor(fe2): Gendo pre-launch tidyup (#3794) * Styling updates * Gendo Icon update * Testing updates * updates from testing * Small design changes * Fix build * Fix dialog buttons * Testing updates * Lightbox effect * Fix tippy * Lightbox changes * Updates * Updates from testing * Fix import * Updates from testing * Add mixpanel * Reuse prompt * Move reuse button * Add v-tippy to truncated text * Container Query * Reorder buttons * Copy prompt. Image loading * Changes from testing * Alert consolodation * Final updates * Feedback * Typo * Updates form call with Benjamin * Controls to top * Changes from testing * Generic Feedback * Small changes from testing * Changes from Fabs * Small change * No max width on prompt * Add Dialog Transparent story * Open feedback dialog on click of button --- .../frontend-2/assets/images/gendo/logo.svg | 4 - .../frontend-2/components/feedback/Dialog.vue | 31 ++- .../components/global/icon/Gendo.vue | 16 ++ .../frontend-2/components/viewer/Controls.vue | 10 +- .../components/viewer/gendo/Dialog.vue | 45 +++++ .../components/viewer/gendo/Item.vue | 148 +++++++++++--- .../components/viewer/gendo/List.vue | 10 +- .../components/viewer/gendo/Panel.vue | 187 +++++++++++------- .../src/components/layout/Dialog.stories.ts | 25 +++ .../src/components/layout/Dialog.vue | 7 +- 10 files changed, 375 insertions(+), 108 deletions(-) delete mode 100644 packages/frontend-2/assets/images/gendo/logo.svg create mode 100644 packages/frontend-2/components/global/icon/Gendo.vue create mode 100644 packages/frontend-2/components/viewer/gendo/Dialog.vue diff --git a/packages/frontend-2/assets/images/gendo/logo.svg b/packages/frontend-2/assets/images/gendo/logo.svg deleted file mode 100644 index e0a6fe01cd..0000000000 --- a/packages/frontend-2/assets/images/gendo/logo.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/frontend-2/components/feedback/Dialog.vue b/packages/frontend-2/components/feedback/Dialog.vue index ae7dcfe814..e64a202196 100644 --- a/packages/frontend-2/components/feedback/Dialog.vue +++ b/packages/frontend-2/components/feedback/Dialog.vue @@ -1,15 +1,14 @@ @@ -57,15 +109,24 @@ import { useInjectedViewerState } from '~/lib/viewer/composables/setup' import { VideoCameraIcon, ExclamationCircleIcon, - ArrowDownTrayIcon + ArrowDownTrayIcon, + ArrowUturnUpIcon, + ClipboardIcon } from '@heroicons/vue/24/outline' import { useCameraUtilities } from '~/lib/viewer/composables/ui' import { Vector3 } from 'three' +import { CommonLoadingIcon } from '@speckle/ui-components' +import { useMixpanel } from '~/lib/core/composables/mp' +import { upperFirst } from 'lodash-es' const props = defineProps<{ renderRequest: GendoAiRender }>() +const emit = defineEmits<{ + (e: 'reuse-prompt', prompt: string): void +}>() + const { projectId, resources: { @@ -73,6 +134,16 @@ const { } } = useInjectedViewerState() +const { copy } = useClipboard() +const { triggerNotification } = useGlobalToast() + +const isPreviewOpen = ref(false) +const isFeedbackOpen = ref(false) + +const feedbackIntro = ref( + 'How can we improve the AI rendering experience? Let us know about the quality of renders, prompts that you have had success with, or any features that would make Gendo more useful for your workflow' +) + const versionId = computed(() => { return resourceItems.value[0].versionId as string }) @@ -92,13 +163,14 @@ onRenderUpdated(() => { refetch() }) -const detailedRender = computed(() => result.value?.project?.version?.gendoAIRender) - const { setView: setViewInternal } = useCameraUtilities() - +const mixpanel = useMixpanel() const apiOrigin = useApiOrigin() + +const detailedRender = computed(() => result.value?.project?.version?.gendoAIRender) + const renderUrl = computed(() => { - if (detailedRender.value?.status !== 'COMPLETED') return null + if (detailedRender.value?.status !== 'COMPLETED') return undefined const url = new URL( `/api/stream/${projectId.value}/blob/${detailedRender.value?.responseImage}`, apiOrigin @@ -106,6 +178,18 @@ const renderUrl = computed(() => { return url.toString() }) +const capitalizedPrompt = computed(() => { + return upperFirst(detailedRender.value?.prompt) +}) + +const reusePrompt = () => { + mixpanel.track('Gendo Prompt Reused', { + renderId: detailedRender.value?.id, + prompt: detailedRender.value?.prompt + }) + emit('reuse-prompt', capitalizedPrompt.value || '') +} + const setView = () => { const cam = detailedRender.value?.camera as { target: Vector3; position: Vector3 } @@ -117,4 +201,20 @@ const setView = () => { true ) } + +const openPreview = () => { + mixpanel.track('Gendo Render Preview Opened', { + renderId: detailedRender.value?.id, + prompt: detailedRender.value?.prompt + }) + isPreviewOpen.value = true +} + +const copyPrompt = async () => { + await copy(capitalizedPrompt.value) + triggerNotification({ + type: ToastNotificationType.Info, + title: 'Prompt copied to clipboard' + }) +} diff --git a/packages/frontend-2/components/viewer/gendo/List.vue b/packages/frontend-2/components/viewer/gendo/List.vue index 7b02f927f1..4ea916c06d 100644 --- a/packages/frontend-2/components/viewer/gendo/List.vue +++ b/packages/frontend-2/components/viewer/gendo/List.vue @@ -1,9 +1,12 @@ @@ -15,6 +18,11 @@ import { onGendoAiRenderCreated } from '~/lib/gendo/graphql/queriesAndMutations' import { useInjectedViewerState } from '~/lib/viewer/composables/setup' + +defineEmits<{ + (e: 'reuse-prompt', prompt: string): void +}>() + const { projectId, resources: { diff --git a/packages/frontend-2/components/viewer/gendo/Panel.vue b/packages/frontend-2/components/viewer/gendo/Panel.vue index c7dc1ed214..055f27977b 100644 --- a/packages/frontend-2/components/viewer/gendo/Panel.vue +++ b/packages/frontend-2/components/viewer/gendo/Panel.vue @@ -1,79 +1,91 @@