diff --git a/apps/marketing/src/app/(marketing)/layout.tsx b/apps/marketing/src/app/(marketing)/layout.tsx index 36241e8e2..365d8a5d1 100644 --- a/apps/marketing/src/app/(marketing)/layout.tsx +++ b/apps/marketing/src/app/(marketing)/layout.tsx @@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react'; +import { usePathname } from 'next/navigation'; + import { cn } from '@documenso/ui/lib/utils'; import { Footer } from '~/components/(marketing)/footer'; @@ -13,6 +15,7 @@ export type MarketingLayoutProps = { export default function MarketingLayout({ children }: MarketingLayoutProps) { const [scrollY, setScrollY] = useState(0); + const pathname = usePathname(); useEffect(() => { const onScroll = () => { @@ -25,7 +28,11 @@ export default function MarketingLayout({ children }: MarketingLayoutProps) { }, []); return ( -
+
5, diff --git a/apps/marketing/src/app/(marketing)/single-player-mode/[token]/success/page.tsx b/apps/marketing/src/app/(marketing)/singleplayer/[token]/success/page.tsx similarity index 100% rename from apps/marketing/src/app/(marketing)/single-player-mode/[token]/success/page.tsx rename to apps/marketing/src/app/(marketing)/singleplayer/[token]/success/page.tsx diff --git a/apps/marketing/src/app/(marketing)/single-player-mode/page.tsx b/apps/marketing/src/app/(marketing)/singleplayer/page.tsx similarity index 99% rename from apps/marketing/src/app/(marketing)/single-player-mode/page.tsx rename to apps/marketing/src/app/(marketing)/singleplayer/page.tsx index 3c76ebac0..0ae72c788 100644 --- a/apps/marketing/src/app/(marketing)/single-player-mode/page.tsx +++ b/apps/marketing/src/app/(marketing)/singleplayer/page.tsx @@ -130,7 +130,7 @@ export default function SinglePlayerModePage() { signer: data.email, }); - router.push(`/single-player-mode/${documentToken}/success`); + router.push(`/singleplayer/${documentToken}/success`); } catch { toast({ title: 'Something went wrong', diff --git a/apps/marketing/src/components/(marketing)/footer.tsx b/apps/marketing/src/components/(marketing)/footer.tsx index b1f5e39bf..11d368c22 100644 --- a/apps/marketing/src/components/(marketing)/footer.tsx +++ b/apps/marketing/src/components/(marketing)/footer.tsx @@ -23,7 +23,7 @@ const SOCIAL_LINKS = [ const FOOTER_LINKS = [ { href: '/pricing', text: 'Pricing' }, - { href: '/single-player-mode', text: 'Single Player Mode' }, + { href: '/singleplayer', text: 'Singleplayer' }, { href: '/blog', text: 'Blog' }, { href: '/open', text: 'Open' }, { href: 'https://shop.documenso.com', text: 'Shop', target: '_blank' }, diff --git a/apps/marketing/src/components/(marketing)/header.tsx b/apps/marketing/src/components/(marketing)/header.tsx index 34f1658ac..875f37231 100644 --- a/apps/marketing/src/components/(marketing)/header.tsx +++ b/apps/marketing/src/components/(marketing)/header.tsx @@ -29,7 +29,7 @@ export const Header = ({ className, ...props }: HeaderProps) => { {isSinglePlayerModeMarketingEnabled && ( Try now! diff --git a/apps/marketing/src/components/(marketing)/hero.tsx b/apps/marketing/src/components/(marketing)/hero.tsx index 29bae1b89..88e21bca2 100644 --- a/apps/marketing/src/components/(marketing)/hero.tsx +++ b/apps/marketing/src/components/(marketing)/hero.tsx @@ -134,9 +134,9 @@ export const Hero = ({ className, ...props }: HeroProps) => { variants={HeroTitleVariants} initial="initial" animate="animate" - className="border-primary bg-background hover:bg-muted mx-auto mt-8 w-60 rounded-xl border transition duration-300" + className="border-primary bg-background hover:bg-muted mx-auto mt-8 w-60 rounded-xl border transition-colors duration-300" > - +

Introducing Single Player Mode

diff --git a/apps/marketing/src/components/(marketing)/mobile-navigation.tsx b/apps/marketing/src/components/(marketing)/mobile-navigation.tsx index c9bd07631..a1897ce58 100644 --- a/apps/marketing/src/components/(marketing)/mobile-navigation.tsx +++ b/apps/marketing/src/components/(marketing)/mobile-navigation.tsx @@ -17,8 +17,8 @@ export type MobileNavigationProps = { export const MENU_NAVIGATION_LINKS = [ { - href: '/single-player-mode', - text: 'Single Player Mode', + href: '/singleplayer', + text: 'Singleplayer', }, { href: '/blog', diff --git a/packages/lib/client-only/hooks/use-element-scale-size.ts b/packages/lib/client-only/hooks/use-element-scale-size.ts index 3e9b34b3f..1c8ab320e 100644 --- a/packages/lib/client-only/hooks/use-element-scale-size.ts +++ b/packages/lib/client-only/hooks/use-element-scale-size.ts @@ -60,26 +60,17 @@ export const calculateTextScaleSize = ( */ export function useElementScaleSize( container: { width: number; height: number }, - child: RefObject, + text: string, fontSize: number, fontFamily: string, ) { const [scalingFactor, setScalingFactor] = useState(1); useEffect(() => { - if (!child.current) { - return; - } - - const scaleSize = calculateTextScaleSize( - container, - child.current.innerText, - `${fontSize}px`, - fontFamily, - ); + const scaleSize = calculateTextScaleSize(container, text, `${fontSize}px`, fontFamily); setScalingFactor(scaleSize); - }, [child, container, fontFamily, fontSize]); + }, [text, container, fontFamily, fontSize]); return scalingFactor; } diff --git a/packages/ui/components/signing-card.tsx b/packages/ui/components/signing-card.tsx index 24a6b6e28..3c65ba9dc 100644 --- a/packages/ui/components/signing-card.tsx +++ b/packages/ui/components/signing-card.tsx @@ -56,7 +56,7 @@ export const SigningCard3D = ({ className, name, signingCelebrationImage }: Sign const sheenGradient = useMotionTemplate`linear-gradient( 30deg, transparent, - rgba(var(--sheen-color) / ${trackMouse ? sheenOpacity : 0}) ${sheenPosition}%, + rgba(var(--sheen-color) / ${sheenOpacity}) ${sheenPosition}%, transparent)`; const cardRef = useRef(null); @@ -98,10 +98,12 @@ export const SigningCard3D = ({ className, name, signingCelebrationImage }: Sign void animate(cardX, 0, { duration: 2, ease: 'backInOut' }); void animate(cardY, 0, { duration: 2, ease: 'backInOut' }); + void animate(sheenOpacity, 0, { duration: 2, ease: 'backInOut' }); + setTrackMouse(false); }, 1000); }, - [cardX, cardY, cardCenterPosition, trackMouse], + [cardX, cardY, cardCenterPosition, trackMouse, sheenOpacity], ); useEffect(() => { @@ -126,7 +128,6 @@ export const SigningCard3D = ({ className, name, signingCelebrationImage }: Sign transformStyle: 'preserve-3d', rotateX, rotateY, - // willChange: 'transform background-image', }} > diff --git a/packages/ui/primitives/document-flow/single-player-mode-fields.tsx b/packages/ui/primitives/document-flow/single-player-mode-fields.tsx index 022b05d60..04c093efc 100644 --- a/packages/ui/primitives/document-flow/single-player-mode-fields.tsx +++ b/packages/ui/primitives/document-flow/single-player-mode-fields.tsx @@ -70,25 +70,23 @@ export function SinglePlayerModeSignatureField({ throw new Error('Invalid field type'); } - const $paragraphEl = useRef(null); - const { height, width } = useFieldPageCoords(field); + const insertedBase64Signature = field.inserted && field.Signature?.signatureImageAsBase64; + const insertedTypeSignature = field.inserted && field.Signature?.typedSignature; + const scalingFactor = useElementScaleSize( { height, width, }, - $paragraphEl, + insertedTypeSignature || '', maxFontSize, fontVariableValue, ); const fontSize = maxFontSize * scalingFactor; - const insertedBase64Signature = field.inserted && field.Signature?.signatureImageAsBase64; - const insertedTypeSignature = field.inserted && field.Signature?.typedSignature; - return ( {insertedBase64Signature ? ( @@ -99,7 +97,6 @@ export function SinglePlayerModeSignatureField({ /> ) : insertedTypeSignature ? (