@luxfi/ui 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/auth/login-panel.tsx +1 -1
- package/components/{commerce → auth}/mobile-login-button.tsx +0 -1
- package/components/auth/signup-panel.tsx +1 -1
- package/components/chat-widget.tsx +1 -1
- package/components/commerce/bag-button.tsx +2 -2
- package/components/commerce/checkout-button.tsx +2 -2
- package/components/commerce/desktop-bag-popup.tsx +2 -2
- package/components/{commerce → header}/desktop-nav-menu.tsx +59 -59
- package/components/header/desktop.tsx +6 -2
- package/components/header/index.tsx +3 -2
- package/components/{commerce → header}/mobile-bag-drawer.tsx +1 -1
- package/components/header/mobile-nav-menu-item.tsx +47 -0
- package/components/{commerce → header}/mobile-nav-menu.tsx +1 -1
- package/components/header/mobile.tsx +23 -18
- package/components/icons/index.ts +6 -0
- package/components/logo.tsx +3 -3
- package/package.json +15 -20
- package/site-def/footer/community.tsx +12 -18
- package/site-def/index.ts +2 -1
- package/site-def/main-nav.tsx +67 -65
- package/components/commerce/_to_deprecate_checkout-widget/const.ts +0 -13
- package/components/commerce/_to_deprecate_checkout-widget/index.tsx_ +0 -188
- package/components/commerce/_to_deprecate_checkout-widget/obs-string-set.ts +0 -48
- package/components/commerce/_to_deprecate_checkout-widget/use-anim-clx-set.ts +0 -59
- package/components/commerce/mobile-nav-menu-item.tsx +0 -50
- package/components/icons/24k-gold-card.tsx +0 -43
- package/components/icons/ai-chat-act.tsx +0 -47
- package/components/icons/ai-chat.tsx +0 -29
- package/components/icons/anodized-titanium.tsx +0 -45
- package/components/icons/blog-act.tsx +0 -14
- package/components/icons/blog.tsx +0 -20
- package/components/icons/bridge-act.tsx +0 -18
- package/components/icons/bridge.tsx +0 -68
- package/components/icons/changelog-act.tsx +0 -15
- package/components/icons/changelog.tsx +0 -21
- package/components/icons/chrome.tsx +0 -45
- package/components/icons/coins-act.tsx +0 -29
- package/components/icons/coins.tsx +0 -20
- package/components/icons/compare-cards-act.tsx +0 -30
- package/components/icons/compare-cards.tsx +0 -21
- package/components/icons/credit-act.tsx +0 -29
- package/components/icons/credit.tsx +0 -20
- package/components/icons/customer-support-act.tsx +0 -27
- package/components/icons/customer-support.tsx +0 -21
- package/components/icons/customers-act.tsx +0 -65
- package/components/icons/customers.tsx +0 -33
- package/components/icons/developer-docs-act.tsx +0 -26
- package/components/icons/developer-docs.tsx +0 -20
- package/components/icons/exchange-act.tsx +0 -27
- package/components/icons/exchange.tsx +0 -21
- package/components/icons/explorer-act.tsx +0 -27
- package/components/icons/explorer.tsx +0 -22
- package/components/icons/faqs-act.tsx +0 -27
- package/components/icons/faqs.tsx +0 -21
- package/components/icons/github.tsx +0 -14
- package/components/icons/guides-act.tsx +0 -26
- package/components/icons/guides.tsx +0 -21
- package/components/icons/gun-metal.tsx +0 -44
- package/components/icons/index.tsx +0 -43
- package/components/icons/integrations-act.tsx +0 -41
- package/components/icons/integrations.tsx +0 -25
- package/components/icons/irradescent.tsx +0 -41
- package/components/icons/launch-subnet.tsx +0 -21
- package/components/icons/launchsubnet-act.tsx +0 -29
- package/components/icons/lux-finance-act.tsx +0 -34
- package/components/icons/lux-finance.tsx +0 -23
- package/components/icons/lux-pass-act.tsx +0 -41
- package/components/icons/lux-pass.tsx +0 -25
- package/components/icons/lux-quests-act.tsx +0 -15
- package/components/icons/lux-quests.tsx +0 -21
- package/components/icons/market-act.tsx +0 -39
- package/components/icons/market.tsx +0 -24
- package/components/icons/mirrored-titanium.tsx +0 -46
- package/components/icons/more-benefits-act.tsx +0 -29
- package/components/icons/more-benefits.tsx +0 -21
- package/components/icons/open-source-act.tsx +0 -41
- package/components/icons/open-source.tsx +0 -26
- package/components/icons/safe-act.tsx +0 -77
- package/components/icons/safe.tsx +0 -37
- package/components/icons/search.tsx +0 -12
- package/components/icons/secure-delivery.tsx +0 -13
- package/components/icons/shop-act.tsx +0 -29
- package/components/icons/shop.tsx +0 -20
- package/components/icons/sterling-silver-card.tsx +0 -44
- package/components/icons/templates-act.tsx +0 -29
- package/components/icons/templates.tsx +0 -21
- package/components/icons/validators-act.tsx +0 -42
- package/components/icons/validators.tsx +0 -41
- package/components/icons/view-all-card-act.tsx +0 -28
- package/components/icons/view-all-card.tsx +0 -20
- package/components/icons/wallet-act.tsx +0 -29
- package/components/icons/wallet.tsx +0 -20
- package/components/icons/warpcast.tsx +0 -58
- package/components/icons/youtube-logo.tsx +0 -59
- /package/components/{commerce → header}/mobile-menu-toggle-button.tsx +0 -0
- /package/components/{commerce → header}/mobile-nav-menu-ai.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxfi/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@next/third-parties": "^14.1.0",
|
|
40
|
-
"@types/node": "^20.12.12",
|
|
41
40
|
"@types/validator": "^13.12.1",
|
|
42
41
|
"cookies-next": "^4.1.1",
|
|
43
42
|
"date-fns": "^3.6.0",
|
|
@@ -51,18 +50,19 @@
|
|
|
51
50
|
"usehooks-ts": "^3.1.0"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
|
-
"@hanzo/auth": "
|
|
55
|
-
"@hanzo/commerce": "
|
|
56
|
-
"@hanzo/ui": "
|
|
53
|
+
"@hanzo/auth": "catalog:",
|
|
54
|
+
"@hanzo/commerce": "catalog:",
|
|
55
|
+
"@hanzo/ui": "catalog:",
|
|
56
|
+
"@luxfi/menu-icons": "1.0.1",
|
|
57
57
|
"@hookform/resolvers": "^3.3.2",
|
|
58
|
-
"lucide-react": "
|
|
58
|
+
"lucide-react": "catalog:",
|
|
59
59
|
"mobx": "^6.12.3",
|
|
60
60
|
"mobx-react-lite": "^4.0.7",
|
|
61
|
-
"next": "
|
|
61
|
+
"next": "catalog:",
|
|
62
62
|
"next-themes": "^0.2.1",
|
|
63
|
-
"react": "
|
|
64
|
-
"react-dom": "
|
|
65
|
-
"react-hook-form": "
|
|
63
|
+
"react": "catalog:",
|
|
64
|
+
"react-dom": "catalog:",
|
|
65
|
+
"react-hook-form": "catalog:",
|
|
66
66
|
"validator": "^13.11.0",
|
|
67
67
|
"zod": "3.23.8"
|
|
68
68
|
},
|
|
@@ -73,15 +73,10 @@
|
|
|
73
73
|
"@types/facebook-pixel": "^0.0.30",
|
|
74
74
|
"@types/gtag.js": "^0.0.19",
|
|
75
75
|
"@types/mdx": "^2.0.9",
|
|
76
|
-
"@types/node": "
|
|
77
|
-
"@types/react": "
|
|
78
|
-
"@types/react-dom": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"react-hook-form": "^7.51.4",
|
|
82
|
-
"tailwindcss": "^3.4.3",
|
|
83
|
-
"typescript": "5.6.3",
|
|
84
|
-
"validator": "^13.11.0",
|
|
85
|
-
"zod": "3.23.8"
|
|
76
|
+
"@types/node": "catalog:",
|
|
77
|
+
"@types/react": "catalog:",
|
|
78
|
+
"@types/react-dom": "catalog:",
|
|
79
|
+
"tailwindcss": "catalog:",
|
|
80
|
+
"typescript": "catalog:"
|
|
86
81
|
}
|
|
87
82
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LinkDef } from '@hanzo/ui/types'
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { SocialIcon } from '../../components/icons'
|
|
3
4
|
|
|
4
5
|
// @ts-ignore (will build in project that has @svgr support)
|
|
5
6
|
import SVG_warp_logo from './svg/warpcast-logo.svg'
|
|
@@ -12,56 +13,49 @@ export default [
|
|
|
12
13
|
href: '',
|
|
13
14
|
variant: 'linkFG',
|
|
14
15
|
},
|
|
15
|
-
|
|
16
16
|
{
|
|
17
17
|
title: 'Lux Channel',
|
|
18
18
|
href: 'https://warpcast.com/~/channel/lux',
|
|
19
|
-
icon: <SVG_warp_logo width={SOC_ICON_SIZE} height={SOC_ICON_SIZE} /> //<
|
|
19
|
+
icon: <SVG_warp_logo width={SOC_ICON_SIZE} height={SOC_ICON_SIZE} /> //<SocialIcon network='warpcast' size={SOC_ICON_SIZE} />
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
title: 'Lux Discussions',
|
|
23
23
|
href: 'https://github.com/orgs/luxfi/discussions',
|
|
24
|
-
icon: <
|
|
24
|
+
icon: <SocialIcon network='github' size={SOC_ICON_SIZE} />
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
/*
|
|
28
26
|
{
|
|
29
27
|
title: 'Discord',
|
|
30
|
-
href: 'https://discord.gg/
|
|
31
|
-
|
|
32
|
-
icon: <Icons.SocialIcon network='discord' size={SOC_ICON_SIZE} />
|
|
28
|
+
href: 'https://discord.gg/sxaS7FFHwh',
|
|
29
|
+
icon: <SocialIcon network='discord' size={SOC_ICON_SIZE} />
|
|
33
30
|
},
|
|
34
31
|
{
|
|
35
32
|
title: 'Telegram',
|
|
36
33
|
href: 'https://t.me/luxdefi',
|
|
37
|
-
|
|
38
|
-
icon: <Icons.SocialIcon network='telegram' size={SOC_ICON_SIZE} />
|
|
34
|
+
icon: <SocialIcon network='telegram' size={SOC_ICON_SIZE} />
|
|
39
35
|
},
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
36
|
{
|
|
43
37
|
title: '@luxdefi',
|
|
44
38
|
href: 'https://twitter.com/luxdefi',
|
|
45
|
-
icon: <
|
|
39
|
+
icon: <SocialIcon network='x' size={SOC_ICON_SIZE} />
|
|
46
40
|
},
|
|
47
41
|
{
|
|
48
42
|
title: '@luxdefi',
|
|
49
43
|
href: 'https://facebook.com/luxdefi',
|
|
50
|
-
icon: <
|
|
44
|
+
icon: <SocialIcon network='facebook' size={SOC_ICON_SIZE + 2} />
|
|
51
45
|
},
|
|
52
46
|
{
|
|
53
47
|
title: '@luxdefi',
|
|
54
48
|
href: 'https://www.instagram.com/luxdefi',
|
|
55
|
-
icon: <
|
|
49
|
+
icon: <SocialIcon network='instagram' size={SOC_ICON_SIZE + 2} />
|
|
56
50
|
},
|
|
57
51
|
{
|
|
58
52
|
title: '@luxdefi',
|
|
59
53
|
href: 'https://linkedin.com/company/luxdefi',
|
|
60
|
-
icon: <
|
|
54
|
+
icon: <SocialIcon network='linkedin' size={SOC_ICON_SIZE + 2} />
|
|
61
55
|
},
|
|
62
56
|
{
|
|
63
57
|
title: '@luxdefi',
|
|
64
58
|
href: 'https://www.youtube.com/@luxdefi',
|
|
65
|
-
icon: <
|
|
59
|
+
icon: <SocialIcon network='youtube' size={SOC_ICON_SIZE + 2} />
|
|
66
60
|
},
|
|
67
61
|
] satisfies LinkDef[]
|
package/site-def/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * as footer from './footer' //
|
|
1
|
+
export * as footer from './footer' // footer.standard, footer.community, etc
|
|
2
2
|
export { default as mainNav } from './main-nav'
|
|
3
|
+
export type { ChildMenu, LinkDefExtended } from './main-nav'
|
|
3
4
|
export type { SiteDef } from '../types'
|
package/site-def/main-nav.tsx
CHANGED
|
@@ -1,75 +1,77 @@
|
|
|
1
1
|
import type { LinkDef } from '@hanzo/ui/types'
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AIChatAct,
|
|
5
|
+
AIChat,
|
|
6
|
+
Anodized,
|
|
7
|
+
BlogAct,
|
|
8
|
+
Blog,
|
|
9
|
+
BridgeAct,
|
|
10
|
+
Bridge,
|
|
11
|
+
ChangeLogAct,
|
|
12
|
+
ChangeLog,
|
|
13
|
+
Chrome,
|
|
14
|
+
CoinsAct,
|
|
15
|
+
Coins,
|
|
16
|
+
CompareCardsAct,
|
|
17
|
+
CompareCards,
|
|
18
|
+
CreditAct,
|
|
19
|
+
Credit,
|
|
20
|
+
CustomersAct,
|
|
21
|
+
Customers,
|
|
22
|
+
CustomerSupportAct,
|
|
23
|
+
CustomerSupport,
|
|
24
|
+
DeveloperDocsAct,
|
|
25
|
+
DeveloperDocs,
|
|
26
|
+
ExchangeAct,
|
|
27
|
+
Exchange,
|
|
28
|
+
ExplorerAct,
|
|
29
|
+
Explorer,
|
|
30
|
+
FAQsAct,
|
|
31
|
+
FAQs,
|
|
32
|
+
GoldCard,
|
|
33
|
+
GuidesAct,
|
|
34
|
+
Guides,
|
|
35
|
+
GunMetal,
|
|
36
|
+
IntegrationAct,
|
|
37
|
+
Integration,
|
|
38
|
+
Irradescent,
|
|
39
|
+
LaunchSubnetAct,
|
|
40
|
+
LaunchSubnet,
|
|
41
|
+
LuxFinanceAct,
|
|
42
|
+
LuxFinance,
|
|
43
|
+
LuxPassAct,
|
|
44
|
+
LuxPass,
|
|
45
|
+
LuxQuestsAct,
|
|
46
|
+
LuxQuests,
|
|
47
|
+
LuxWalletAct,
|
|
48
|
+
MarketAct,
|
|
49
|
+
Market,
|
|
50
|
+
MirroredTitanium,
|
|
51
|
+
MoreBenefitsAct,
|
|
52
|
+
MoreBenefits,
|
|
53
|
+
OpenSourceAct,
|
|
54
|
+
OpenSource,
|
|
55
|
+
SafeAct,
|
|
56
|
+
Safe,
|
|
57
|
+
ShopAct,
|
|
58
|
+
Shop,
|
|
59
|
+
Sterling,
|
|
60
|
+
TemplatesAct,
|
|
61
|
+
Templates,
|
|
62
|
+
ValidatorsAct,
|
|
63
|
+
Validators,
|
|
64
|
+
ViewAllCardsAct,
|
|
65
|
+
ViewAllCards,
|
|
66
|
+
Wallet,
|
|
67
|
+
} from '@luxfi/menu-icons'
|
|
68
|
+
|
|
66
69
|
|
|
67
70
|
export interface LinkDefExtended extends LinkDef {
|
|
68
71
|
isAIMenu?: boolean
|
|
69
72
|
icon?: any,
|
|
70
73
|
details?: string,
|
|
71
74
|
childMenu?: ChildMenu[]
|
|
72
|
-
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export interface ChildMenu extends LinkDef{
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
itemImgConstraint: { w: 40, h: 24 },
|
|
3
|
-
animDurationMs: 400,
|
|
4
|
-
animTimingFn: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
5
|
-
compWidthClx: {
|
|
6
|
-
checkout: 'w-pr-40',
|
|
7
|
-
itemInfo: 'w-pr-60'
|
|
8
|
-
},
|
|
9
|
-
shadowStyle: {
|
|
10
|
-
border: '1px solid rgb(100 100 100)',
|
|
11
|
-
boxShadow: '2px 4px 4px -3px rgb(125 125 125 / 0.7), 4px -4px 8px -4px rgb(125 125 125 / 0.7)'
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, { useRef } from 'react'
|
|
3
|
-
import { createPortal } from 'react-dom'
|
|
4
|
-
import { usePathname, useRouter } from 'next/navigation'
|
|
5
|
-
import { observer } from 'mobx-react-lite'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@hanzo/ui/util'
|
|
8
|
-
import { useStepAnimation } from '@hanzo/ui/util-client'
|
|
9
|
-
|
|
10
|
-
import { Image } from '@hanzo/ui/primitives'
|
|
11
|
-
|
|
12
|
-
import CheckoutButton from '../checkout-button'
|
|
13
|
-
import useAnimationClxSet from './use-anim-clx-set'
|
|
14
|
-
import CONST from './const'
|
|
15
|
-
import type { LineItem } from '@hanzo/commerce/types'
|
|
16
|
-
|
|
17
|
-
const transStyle = (t: { transition: string, from : string, to: string } | undefined) : any => (
|
|
18
|
-
t ? {
|
|
19
|
-
transitionProperty: t.transition,
|
|
20
|
-
transitionTimingFunction: CONST.animTimingFn,
|
|
21
|
-
transitionDuration: `${CONST.animDurationMs}ms`
|
|
22
|
-
} : {}
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
const transClx = (on: boolean, t: { transition: string, from : string, to: string } | undefined) : string => (
|
|
26
|
-
on ? (t?.from ?? '') : (t?.to ?? '')
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const VARS: any = {
|
|
30
|
-
BR: {
|
|
31
|
-
pos: 'bottom-[24px] right-[66px]',
|
|
32
|
-
width: 'w-initial',
|
|
33
|
-
centerText: false,
|
|
34
|
-
coClx: 'w-auto',
|
|
35
|
-
infoClx: 'w-auto',
|
|
36
|
-
activeItemAnim: {
|
|
37
|
-
co: {
|
|
38
|
-
transition: 'none',
|
|
39
|
-
from : 'px-3 gap-2.5',
|
|
40
|
-
to: ''
|
|
41
|
-
},
|
|
42
|
-
coText: {
|
|
43
|
-
transition: 'max-width',
|
|
44
|
-
from : 'max-w-[100px]',
|
|
45
|
-
to: 'max-w-[0px]'
|
|
46
|
-
},
|
|
47
|
-
info: {
|
|
48
|
-
transition: 'transform, opacity',
|
|
49
|
-
from : 'scale-x-100 opacity-100 origin-right',
|
|
50
|
-
to: 'scale-x-0 opacity-0 origin-right'
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
showArrow: true
|
|
54
|
-
},
|
|
55
|
-
TR: {
|
|
56
|
-
pos: 'top-[48px] md:top-[80px] right-[28px]',
|
|
57
|
-
width: 'w-initial',
|
|
58
|
-
centerText: false,
|
|
59
|
-
showQuantity: false,
|
|
60
|
-
showArrow: true,
|
|
61
|
-
coClx: 'w-auto px-3 gap-1',
|
|
62
|
-
infoClx: 'w-auto',
|
|
63
|
-
activeItemAnim: {
|
|
64
|
-
co: {
|
|
65
|
-
transition: 'none',
|
|
66
|
-
from : 'px-3 gap-2.5',
|
|
67
|
-
to: ''
|
|
68
|
-
},
|
|
69
|
-
coText: {
|
|
70
|
-
transition: 'max-width',
|
|
71
|
-
from : 'max-w-[100px]',
|
|
72
|
-
to: 'max-w-[0px]'
|
|
73
|
-
},
|
|
74
|
-
info: {
|
|
75
|
-
transition: 'transform',
|
|
76
|
-
from : 'scale-x-100 origin-right',
|
|
77
|
-
to: 'scale-x-0 origin-right'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
TRIO: {
|
|
82
|
-
pos: 'top-[48px] md:top-[70px] right-[28px]',
|
|
83
|
-
centerText: false,
|
|
84
|
-
showQuantity: true,
|
|
85
|
-
showArrow: true,
|
|
86
|
-
width: 'w-initial',
|
|
87
|
-
coClx: 'hidden',
|
|
88
|
-
infoClx: 'w-auto',
|
|
89
|
-
activeItemAnim: {
|
|
90
|
-
info: {
|
|
91
|
-
transition: 'transform, opacity',
|
|
92
|
-
from : 'scale-x-100 opacity-100',
|
|
93
|
-
to: 'scale-x-50 opacity-0'
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const v = 'TR'
|
|
100
|
-
|
|
101
|
-
const CheckoutWidget: React.FC<{
|
|
102
|
-
clx?: string
|
|
103
|
-
}> = observer(({
|
|
104
|
-
clx=''
|
|
105
|
-
}) => {
|
|
106
|
-
|
|
107
|
-
const router = useRouter()
|
|
108
|
-
|
|
109
|
-
const isCheckout = usePathname() === '/checkout'
|
|
110
|
-
const clxSet = useAnimationClxSet(isCheckout)
|
|
111
|
-
|
|
112
|
-
// for rendering content after recentActivity.item() would return false
|
|
113
|
-
const persistentRef = useRef<LineItem | undefined>(undefined)
|
|
114
|
-
|
|
115
|
-
// Doing double duty of being initial step fn for StepAnimation,
|
|
116
|
-
// and also capturing the item for persistentRef :)
|
|
117
|
-
const initialStepFn = (): boolean => {
|
|
118
|
-
if (!!recentActivity.item && !persistentRef.current) {
|
|
119
|
-
persistentRef.current = recentActivity.item
|
|
120
|
-
}
|
|
121
|
-
return !!recentActivity.item
|
|
122
|
-
}
|
|
123
|
-
const steps = useStepAnimation(initialStepFn, [CONST.animDurationMs, CONST.animDurationMs, CONST.animDurationMs])
|
|
124
|
-
|
|
125
|
-
const handleCheckout = () => { router.push('/checkout')}
|
|
126
|
-
|
|
127
|
-
return globalThis?.document?.body && createPortal(
|
|
128
|
-
(<div
|
|
129
|
-
className={cn(
|
|
130
|
-
VARS[v].width,
|
|
131
|
-
'z-below-modal-2 fixed ',
|
|
132
|
-
VARS[v].pos,
|
|
133
|
-
'rounded-lg',
|
|
134
|
-
'flex',
|
|
135
|
-
steps.notPast(0) ? 'bg-background' : '',
|
|
136
|
-
steps.notPast(1) ? 'gap-2' : '',
|
|
137
|
-
clxSet.asArray.join(' ')
|
|
138
|
-
)}
|
|
139
|
-
style={steps.notPast(1) ? {} : VARS[v].coClx?.includes('hidden') ? {} : CONST.shadowStyle}
|
|
140
|
-
>
|
|
141
|
-
<div
|
|
142
|
-
className={cn(
|
|
143
|
-
'flex flex-row justify-between items-center',
|
|
144
|
-
transClx(steps.notPast(0), VARS[v].activeItemAnim.info),
|
|
145
|
-
VARS[v].itemClx,
|
|
146
|
-
steps.notPast(1) ? 'px-3 border rounded-lg bg-level-1 border-muted-3' : ''
|
|
147
|
-
)}
|
|
148
|
-
style={transStyle(VARS[v].activeItemAnim.info)}
|
|
149
|
-
>
|
|
150
|
-
{steps.notPast(1) && persistentRef.current?.img && (
|
|
151
|
-
<Image def={persistentRef.current.img} constrainTo={CONST.itemImgConstraint} preload className='grow-0 shrink-0'/>
|
|
152
|
-
)}
|
|
153
|
-
{steps.notPast(1) && persistentRef.current && (<div className='text-foreground grow ml-1'>
|
|
154
|
-
<p className='whitespace-nowrap text-ellipsis text-sm'>{persistentRef.current.title}</p>
|
|
155
|
-
<p className='whitespace-nowrap text-clip text-xxs' >recently added...</p>
|
|
156
|
-
</div>)}
|
|
157
|
-
</div>
|
|
158
|
-
<CheckoutButton
|
|
159
|
-
handleCheckout={handleCheckout}
|
|
160
|
-
centerText={VARS[v].centerText ?? !steps.notPast(0)}
|
|
161
|
-
variant='primary'
|
|
162
|
-
rounded='lg'
|
|
163
|
-
showQuantity={VARS[v].showQuantity ?? true}
|
|
164
|
-
showArrow={VARS[v].showArrow ?? true}
|
|
165
|
-
className={cn(
|
|
166
|
-
// for setting and unsetting 'gap'
|
|
167
|
-
transClx((VARS[v].activeItemAnim.coText ? steps.notPast(3) : true), VARS[v].activeItemAnim.co),
|
|
168
|
-
VARS[v].coClx
|
|
169
|
-
)}
|
|
170
|
-
style={transStyle(VARS[v].activeItemAnim.co)}
|
|
171
|
-
>
|
|
172
|
-
<div
|
|
173
|
-
className={cn(
|
|
174
|
-
'overflow-hidden',
|
|
175
|
-
'flex justify-center items-center',
|
|
176
|
-
transClx(steps.notPast(2), VARS[v].activeItemAnim.coText),
|
|
177
|
-
)}
|
|
178
|
-
style={transStyle(VARS[v].activeItemAnim.coText)}
|
|
179
|
-
>
|
|
180
|
-
Checkout
|
|
181
|
-
</div>
|
|
182
|
-
</CheckoutButton>
|
|
183
|
-
</div>),
|
|
184
|
-
globalThis?.document?.body
|
|
185
|
-
)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
export default CheckoutWidget
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
action,
|
|
3
|
-
computed,
|
|
4
|
-
makeObservable,
|
|
5
|
-
observable
|
|
6
|
-
} from 'mobx'
|
|
7
|
-
|
|
8
|
-
class ObsStringSet {
|
|
9
|
-
|
|
10
|
-
private _set = observable.set(new Set<string>())
|
|
11
|
-
|
|
12
|
-
constructor(initial: string[] = []) {
|
|
13
|
-
initial.forEach((el) => {this._set.add(el)})
|
|
14
|
-
makeObservable(this, {
|
|
15
|
-
add: action,
|
|
16
|
-
remove: action,
|
|
17
|
-
asArray: computed
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
add = (v: string | string[]): void => {
|
|
22
|
-
if (Array.isArray(v)) {
|
|
23
|
-
v.forEach((el) => {this._set.add(el)})
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this._set.add(v)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
remove = (v: string | string[]): void => {
|
|
31
|
-
if (Array.isArray(v)) {
|
|
32
|
-
v.forEach((el) => {this._set.delete(el)})
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this._set.delete(v)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
has = (v: string): boolean => (
|
|
40
|
-
this._set.has(v)
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
get asArray() {
|
|
44
|
-
return Array.from(this._set)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default ObsStringSet
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react'
|
|
2
|
-
import { reaction, runInAction} from 'mobx'
|
|
3
|
-
|
|
4
|
-
import { useCommerce } from '@hanzo/commerce'
|
|
5
|
-
|
|
6
|
-
import ObsStringSet from './obs-string-set'
|
|
7
|
-
import { useSelectAndBuy } from '../../../commerce/ui/context'
|
|
8
|
-
|
|
9
|
-
export default (isCheckout: boolean): ObsStringSet => {
|
|
10
|
-
|
|
11
|
-
const ui = useSelectAndBuy()
|
|
12
|
-
const cmmc = useCommerce()
|
|
13
|
-
|
|
14
|
-
const clxSetRef = useRef<ObsStringSet>(new ObsStringSet(
|
|
15
|
-
(cmmc.cartEmpty || ui.currentSkuPath || isCheckout) ? ['hidden'] : []
|
|
16
|
-
))
|
|
17
|
-
|
|
18
|
-
useEffect(() => (
|
|
19
|
-
reaction(
|
|
20
|
-
() => ({
|
|
21
|
-
microOpen: !(cmmc.cartEmpty || !!ui.currentSkuPath || isCheckout),
|
|
22
|
-
buyOpen: !!ui.currentSkuPath
|
|
23
|
-
}),
|
|
24
|
-
(val, prev) => {
|
|
25
|
-
|
|
26
|
-
runInAction(() => {
|
|
27
|
-
if (!val.microOpen && prev.microOpen) {
|
|
28
|
-
clxSetRef.current.add('checkout-widget-disappears')
|
|
29
|
-
}
|
|
30
|
-
else if (val.microOpen && !prev.microOpen) {
|
|
31
|
-
clxSetRef.current.remove('hidden')
|
|
32
|
-
clxSetRef.current.add('checkout-widget-appears')
|
|
33
|
-
}
|
|
34
|
-
if (!val.buyOpen && prev.buyOpen) {
|
|
35
|
-
clxSetRef.current.add('checkout-widget-appears-after-buy-drawer-closes')
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
clxSetRef.current.remove('checkout-widget-appears-after-buy-drawer-closes')
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
setTimeout(() => {runInAction(() => {
|
|
43
|
-
clxSetRef.current.remove(['checkout-widget-appears', 'checkout-widget-appears-after-buy-drawer-closes'])
|
|
44
|
-
if (clxSetRef.current.has('checkout-widget-disappears') ) {
|
|
45
|
-
clxSetRef.current.remove('checkout-widget-disappears')
|
|
46
|
-
clxSetRef.current.add('hidden')
|
|
47
|
-
}
|
|
48
|
-
})}, 800)
|
|
49
|
-
},
|
|
50
|
-
{equals: (val, prev) => (
|
|
51
|
-
val.microOpen === prev.microOpen
|
|
52
|
-
&&
|
|
53
|
-
val.buyOpen === prev.buyOpen
|
|
54
|
-
)}
|
|
55
|
-
)
|
|
56
|
-
), [isCheckout])
|
|
57
|
-
|
|
58
|
-
return clxSetRef.current
|
|
59
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import type { LinkDefExtended } from '../../site-def/main-nav'
|
|
3
|
-
import { RightArrow } from '../icons'
|
|
4
|
-
import LeftArrow from '../icons/left-arrow'
|
|
5
|
-
import Link from 'next/link'
|
|
6
|
-
import MobileNavMenuAI from './mobile-nav-menu-ai'
|
|
7
|
-
|
|
8
|
-
interface MobileNavMenuItemProps {
|
|
9
|
-
link: LinkDefExtended,
|
|
10
|
-
setMenuOpen: (open: boolean) => void
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const MobileNavMenuItem: React.FC<MobileNavMenuItemProps> = ({
|
|
15
|
-
link,
|
|
16
|
-
setMenuOpen
|
|
17
|
-
}) => {
|
|
18
|
-
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<div className="w-full flex items-center px-5 py-3 gap-[27px] text-2xl cursor-pointer" onClick={() => setIsOpen(true)}>
|
|
23
|
-
<span className='block w-[18px] h-[22px] items-center'>{link.icon}</span>
|
|
24
|
-
<span className='flex-1'>{link.title}</span>
|
|
25
|
-
<RightArrow className='' />
|
|
26
|
-
</div>
|
|
27
|
-
<div className={`fixed left-0 top-0 w-screen h-screen ${isOpen ? 'block' : 'hidden'}`} style={{ backgroundColor: 'black' }}>
|
|
28
|
-
<MobileNavMenuAI setMenuOpen={setMenuOpen} />
|
|
29
|
-
<div className="w-full flex items-center px-5 py-3 gap-[27px] text-2xl font-bold" onClick={() => setIsOpen(false)}>
|
|
30
|
-
<LeftArrow />
|
|
31
|
-
<span className="text-white">{link.title}</span>
|
|
32
|
-
</div>
|
|
33
|
-
<div className="flex flex-col">
|
|
34
|
-
{link.childMenu?.map((menu, index) => {
|
|
35
|
-
return (
|
|
36
|
-
<Link href={menu.href}>
|
|
37
|
-
<div className="w-full flex items-center px-5 py-3 gap-[27px] text-2xl" key={index}>
|
|
38
|
-
<span className='w-[18px] h-[22px] self-center flex items-center justify-center'>{menu.icon}</span>
|
|
39
|
-
<span className='flex-1'>{menu.title}</span>
|
|
40
|
-
</div>
|
|
41
|
-
</Link>
|
|
42
|
-
)
|
|
43
|
-
})}
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default MobileNavMenuItem
|