Skip to content

Commit

Permalink
FE2 - Embedding (#1979)
Browse files Browse the repository at this point in the history
* Add Dialog

* Add options to embed dialog

* Min Height of Clipboard Input multiline to 3 lines

* Check for visibility

* Link to change access of project

* Rename to guided mode

* Change icon when user clicks copy button

* Update Menu styles based on agi feedback

* Update graphql.ts

* Embed Options as hashState

* Auto grow Clipboard Input

* embed state and more options

* Tidyups

* Footer only shows when !embedOptions.isTransparent

* Add auto/manual Load

* Add Pre setup component

* WIP Button Group mobile

* Updates around manual load

* Viewer Share nav

* Add embed dialog to project page

* Minor fixes

* Check for federated

* Responsive Tidyups

* Responsive Fixes. Fix console issues

* Add Alert to Version Embed

* Disable Zoom

* GQL updates

* Comment Slideshow

* GraphQl changes

* Fix visibility

* Build fix

* Revert "Build fix"

This reverts commit 0e706cb.

* remove unneeded change, revert yarn.lock

* Test Commit

* Remove commit test

* Fix build

* Update Tailwind. Add base url env

* fix for portal scope issue

* useLogger

* useLogger

* chore(fe2): include NUXT_PUBLIC_BASE_URL in deployment manifests

* lazy load optimization

* lint fixes

* Updates

* Re-add guided open Dialog sections

* Prevent login popup on embed

* Tidy up mobile combined button group

* Tidy up embed Dialogs

* Small styling issues

* Update scrolling in embed dialog

* Move selection info when embed

* Testing fixes

* Discuss in Speckle

* Responsive Dialog Changes

* Fix bug

* WIP Manual Load

* Fix nuxt errors

* Fix nuxt logger issue

* Fix embed dialog overflows

* New Dialog layout

* Responsive Breakpoint change

* Preview Image

* Fix bug with dialogSection

* Hide selection info on mobile when thread is open

* Footer Model Name

* Overflow on ClipboardInput

* Style fixes

* Tidy ups

* Responsive updates

* Responsive fixes

* Update button

* Changes from testing

* Fix embed height with footer

* Fix Dialog Section

* Fixes from testing

* Move "reset filters" on embed

* Small fixes

* Updates from CR 1

* CR Comments 2

* Updates from CR

* Add deserializeEmbedOptions helper

* DialogSection changes

* Revert changes in TextArea

* Updates from CR

* Only check for noscroll in watch

* Update useRoute

* Comment Slideshow mode

* Changes from testing

* Fix mobile share button

* onMounted warn fixes

* Updates from testing

* Remove nesting of ManualLoad

* Keep Speckle text on mobile

* minor cleanup & bugfixes

* Add target prop to Logo

* navbar flash fix + more cleanup

* Fix urls

* Footer Logo changes

* Remove viewer-transparent from layout

* Add Reply in Speckle

* Remove Anchored Points from embed

* Final changes pre CR

* Fix Anchored Points

* Update packages/frontend-2/components/project/model-page/dialog/embed/Embed.vue

Co-authored-by: Kristaps Fabians Geikins <[email protected]>

* Fixes from CR

* Updates from cr

* Changes WIP

* Fix for dialog opening

* Changes from PR

* Updates to check embed in activity

* fix(fe2): project settings dialog error

* Make Team open section on click of "Manage"

* Fixes from merge

* Changes from cr

* Compare old to new in watch

* Fix logo in footer of embed

* Fixes from merge

* Fix build. Fix lazy load

* Updates from Benjamin

* Fix transparent bg

---------

Co-authored-by: Kristaps Fabians Geikins <[email protected]>
Co-authored-by: Iain Sproat <[email protected]>
Co-authored-by: Kristaps Fabians Geikins <[email protected]>
  • Loading branch information
4 people authored Feb 6, 2024
1 parent ec95ebd commit ff64331
Show file tree
Hide file tree
Showing 94 changed files with 1,667 additions and 462 deletions.
1 change: 1 addition & 0 deletions docker-compose-speckle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
environment:
NUXT_PUBLIC_SERVER_NAME: 'local'
NUXT_PUBLIC_API_ORIGIN: 'http://127.0.0.1'
NUXT_PUBLIC_BASE_URL: 'http://127.0.0.1'
NUXT_PUBLIC_BACKEND_API_ORIGIN: 'http://speckle-server:3000'
NUXT_REDIS_URL: 'redis://redis'

Expand Down
2 changes: 2 additions & 0 deletions packages/frontend-2/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ NUXT_PUBLIC_LOG_PRETTY=true

NUXT_PUBLIC_API_ORIGIN=http://127.0.0.1:3000

NUXT_PUBLIC_BASE_URL=http://127.0.0.1:8081

NUXT_PUBLIC_MIXPANEL_TOKEN_ID=acd87c5a50b56df91a795e999812a3a4
NUXT_PUBLIC_MIXPANEL_API_HOST=https://analytics.speckle.systems

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-2/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const config = {
],
'no-alert': 'error',
eqeqeq: ['error', 'always', { null: 'always' }],
'no-console': 'off',
'no-console': 'error',
'no-var': 'error'
},
overrides: [
Expand Down
8 changes: 6 additions & 2 deletions packages/frontend-2/app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div id="speckle" class="bg-foundation-page text-foreground">
<div
id="speckle"
class="bg-foundation-page text-foreground has-[.viewer-transparent]:!bg-transparent"
>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
Expand All @@ -20,7 +23,8 @@ useHead({
lang: 'en'
},
bodyAttrs: {
class: 'simple-scrollbar bg-foundation-page text-foreground'
class:
'simple-scrollbar bg-foundation-page text-foreground has-[.viewer-transparent]:!bg-transparent'
}
})
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend-2/components/header/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<nav class="fixed z-20 top-0 h-14 bg-foundation shadow hover:shadow-md transition">
<div class="flex items-center justify-between h-full w-screen px-4">
<div class="flex gap-4 items-center justify-between h-full w-screen px-4">
<div class="flex items-center truncate">
<HeaderLogoBlock :active="false" to="/" />
<HeaderNavLink
Expand All @@ -12,7 +12,7 @@
/>
<PortalTarget name="navigation"></PortalTarget>
</div>
<div class="flex items-center">
<div class="flex items-center gap-1.5 sm:gap-2">
<PortalTarget name="secondary-actions"></PortalTarget>
<PortalTarget name="primary-actions"></PortalTarget>
<!-- Notifications dropdown -->
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend-2/components/header/NavNotifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</div>

<UserAvatar v-if="!menuOpen" no-bg size="lg" hover-effect>
<BellIcon class="text-foreground w-5 h-5" />
<BellIcon class="text-primary sm:text-foreground w-5 h-5" />
</UserAvatar>
<UserAvatar v-else size="lg" hover-effect no-bg>
<XMarkIcon class="text-foreground w-5 h-5" />
<XMarkIcon class="text-primary sm:text-foreground w-5 h-5" />
</UserAvatar>
</div>
</div>
Expand Down Expand Up @@ -46,7 +46,7 @@
</template>
<script setup lang="ts">
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
import { XMarkIcon, BellIcon } from '@heroicons/vue/24/solid'
import { XMarkIcon, BellIcon } from '@heroicons/vue/24/outline'
import { useActiveUser } from '~~/lib/auth/composables/activeUser'
const { activeUser } = useActiveUser()
Expand Down
133 changes: 133 additions & 0 deletions packages/frontend-2/components/header/NavShare.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<template>
<Menu
as="div"
class="flex items-center relative sm:border-r border-outline-1 sm:pr-4"
>
<MenuButton as="div">
<FormButton class="hidden sm:flex" outlined :icon-right="ChevronDownIcon">
Share
</FormButton>
<button class="sm:hidden mt-1.5">
<ShareIcon class="h-5 w-5 text-primary" />
</button>
</MenuButton>
<Transition
enter-active-class="transition ease-out duration-200"
enter-from-class="transform opacity-0 scale-95"
enter-to-class="transform opacity-100 scale-100"
leave-active-class="transition ease-in duration-75"
leave-from-class="transform opacity-100 scale-100"
leave-to-class="transform opacity-0 scale-95"
>
<MenuItems
class="absolute z-50 flex flex-col gap-1 right-0 sm:right-4 top-12 min-w-max w-full sm:w-44 p-1 origin-top-right bg-foundation-2 outline outline-2 outline-primary-muted rounded-md shadow-lg overflow-hidden text-sm"
>
<MenuItem v-slot="{ active }">
<div
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-2 items-center px-2 py-1.5 text-sm text-foreground cursor-pointer transition rounded'
]"
@click="handleCopyLink"
@keypress="keyboardClick(handleCopyLink)"
>
<LinkIcon class="w-5 h-5" />
Copy Link
</div>
</MenuItem>
<MenuItem v-if="!isFederated" v-slot="{ active }">
<div
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-2 items-center px-2 py-1.5 text-sm text-foreground cursor-pointer transition rounded'
]"
@click="handleCopyId"
@keypress="keyboardClick(handleCopyId)"
>
<FingerPrintIcon class="w-5 h-5" />
Copy ID
</div>
</MenuItem>
<MenuItem v-slot="{ active }">
<div
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-2 items-center px-2 py-1.5 text-sm text-foreground cursor-pointer transition rounded'
]"
@click="handleEmbed"
@keypress="keyboardClick(handleEmbed)"
>
<CodeBracketIcon class="w-5 h-5" />
Embed Model
</div>
</MenuItem>
</MenuItems>
</Transition>
<ProjectModelPageDialogEmbed
v-model:open="embedDialogOpen"
:project-id="projectId"
:visibility="visibility"
/>
</Menu>
</template>
<script setup lang="ts">
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'
import {
ChevronDownIcon,
LinkIcon,
FingerPrintIcon,
CodeBracketIcon,
ShareIcon
} from '@heroicons/vue/24/outline'
import { SpeckleViewer } from '@speckle/shared'
import { keyboardClick } from '@speckle/ui-components'
import type { ProjectVisibility } from '~/lib/common/generated/gql/graphql'
import { useCopyModelLink } from '~~/lib/projects/composables/modelManagement'
const props = defineProps<{
projectId: string
resourceIdString: string
visibility: ProjectVisibility
}>()
const { copy } = useClipboard()
const copyModelLink = useCopyModelLink()
const embedDialogOpen = ref(false)
const parsedResourceIds = computed(() =>
SpeckleViewer.ViewerRoute.parseUrlParameters(props.resourceIdString)
)
const firstResource = computed(() => parsedResourceIds.value[0] || {})
const versionId = computed(() => {
if (SpeckleViewer.ViewerRoute.isModelResource(firstResource.value)) {
return firstResource.value.versionId
}
return ''
})
const modelId = computed(() => {
if (SpeckleViewer.ViewerRoute.isModelResource(firstResource.value)) {
return firstResource.value.modelId // Assuming your firstResource object has a modelId property
}
return ''
})
const isFederated = computed(() => parsedResourceIds.value.length > 1)
const handleCopyId = () => {
copy(props.resourceIdString, { successMessage: 'ID copied to clipboard' })
}
const handleCopyLink = () => {
const modelIdValue = modelId.value
const versionIdValue = versionId.value ? versionId.value : undefined
copyModelLink(props.projectId, modelIdValue, versionIdValue)
}
const handleEmbed = () => {
embedDialogOpen.value = true
}
</script>
18 changes: 9 additions & 9 deletions packages/frontend-2/components/header/NavUserMenu.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<Menu as="div" class="ml-2 flex items-center">
<Menu as="div" class="flex items-center">
<MenuButton v-slot="{ open: userOpen }">
<span class="sr-only">Open user menu</span>
<UserAvatar v-if="!userOpen" size="lg" :user="activeUser" hover-effect />
Expand All @@ -23,7 +23,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3 border-b border-primary items-center px-3 py-3 text-sm text-primary cursor-pointer transition'
'flex gap-3 border-b border-primary items-center px-3 py-3 text-sm text-primary cursor-pointer transition mb-1'
]"
@click="goToConnectors()"
>
Expand All @@ -35,7 +35,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-2.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition'
'flex gap-2.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition mx-1 rounded'
]"
@click="() => (showProfileEditDialog = true)"
>
Expand All @@ -47,7 +47,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition mx-1 rounded'
]"
@click="goToServerManagement()"
>
Expand All @@ -59,7 +59,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition mx-1 rounded'
]"
@click="onThemeClick"
>
Expand All @@ -71,7 +71,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition mx-1 rounded'
]"
@click="toggleInviteDialog"
>
Expand All @@ -83,7 +83,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-foreground cursor-pointer transition mx-1 rounded'
]"
target="_blank"
to="https://docs.google.com/forms/d/e/1FAIpQLSeTOU8i0KwpgBG7ONimsh4YMqvLKZfSRhWEOz4W0MyjQ1lfAQ/viewform"
Expand All @@ -97,7 +97,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-danger cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-danger cursor-pointer transition mx-1 rounded'
]"
@click="logout"
>
Expand All @@ -109,7 +109,7 @@
<NuxtLink
:class="[
active ? 'bg-foundation-focus' : '',
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-primary cursor-pointer transition'
'flex gap-3.5 items-center px-3 py-2.5 text-sm text-primary cursor-pointer transition mx-1 rounded'
]"
:to="loginUrl"
>
Expand Down
39 changes: 22 additions & 17 deletions packages/frontend-2/components/project/model-page/Header.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<template>
<Portal to="navigation">
<HeaderNavLink :to="projectRoute(project.id)" :name="project.name"></HeaderNavLink>
<HeaderNavLink
v-if="props.project.model"
:to="modelVersionsRoute(project.id, props.project.model.id)"
:name="props.project.model.name"
></HeaderNavLink>
</Portal>

<CommonEditableTitleDescription
:title="titleState"
:description="descriptionState"
:can-edit="canEdit"
:is-disabled="anyMutationsLoading"
@update:title="handleUpdateTitle"
@update:description="handleUpdateDescription"
/>
<div>
<Portal to="navigation">
<HeaderNavLink
:to="projectRoute(project.id)"
:name="project.name"
></HeaderNavLink>
<HeaderNavLink
v-if="props.project.model"
:to="modelVersionsRoute(project.id, props.project.model.id)"
:name="props.project.model.name"
></HeaderNavLink>
</Portal>

<CommonEditableTitleDescription
:title="titleState"
:description="descriptionState"
:can-edit="canEdit"
:is-disabled="anyMutationsLoading"
@update:title="handleUpdateTitle"
@update:description="handleUpdateDescription"
/>
</div>
</template>

<script setup lang="ts">
Expand Down
Loading

0 comments on commit ff64331

Please sign in to comment.