@luxfi/core 5.2.7 → 5.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/commerce/ui/context.tsx +41 -17
  2. package/commerce/ui/store.ts +40 -12
  3. package/components/auth/login-panel.tsx +1 -1
  4. package/components/back-button.tsx +42 -0
  5. package/components/commerce/checkout-panel/dt-checkout-panel.tsx +36 -18
  6. package/components/commerce/checkout-panel/mb-checkout-panel.tsx +2 -2
  7. package/components/commerce/desktop-nav-menu.tsx +46 -45
  8. package/components/commerce/drawer/index.tsx +0 -17
  9. package/components/commerce/drawer/shell.tsx +58 -56
  10. package/components/commerce/mobile-nav-menu-ai.tsx +12 -8
  11. package/components/commerce/mobile-nav-menu.tsx +68 -34
  12. package/components/footer.tsx +1 -1
  13. package/components/header/desktop.tsx +20 -19
  14. package/components/header/mobile.tsx +15 -18
  15. package/components/icons/24k-gold-card.tsx +43 -0
  16. package/components/icons/ai-chat.tsx +29 -0
  17. package/components/icons/anodized-titanium.tsx +45 -0
  18. package/components/icons/blog.tsx +20 -0
  19. package/components/icons/bridge.tsx +68 -0
  20. package/components/icons/changelog.tsx +21 -0
  21. package/components/icons/chrome.tsx +45 -0
  22. package/components/icons/coins.tsx +20 -0
  23. package/components/icons/compare-cards.tsx +21 -0
  24. package/components/icons/credit.tsx +20 -0
  25. package/components/icons/customer-support.tsx +21 -0
  26. package/components/icons/customers.tsx +33 -0
  27. package/components/icons/developer-docs.tsx +20 -0
  28. package/components/icons/exchange.tsx +21 -0
  29. package/components/icons/explorer.tsx +22 -0
  30. package/components/icons/faqs.tsx +21 -0
  31. package/components/icons/guides.tsx +21 -0
  32. package/components/icons/gun-metal.tsx +44 -0
  33. package/components/icons/integrations.tsx +25 -0
  34. package/components/icons/irradescent.tsx +41 -0
  35. package/components/icons/launch-subnet.tsx +21 -0
  36. package/components/icons/lux-finance.tsx +23 -0
  37. package/components/icons/lux-pass.tsx +25 -0
  38. package/components/icons/lux-quests.tsx +21 -0
  39. package/components/icons/market.tsx +24 -0
  40. package/components/icons/mirrored-titanium.tsx +46 -0
  41. package/components/icons/more-benefits.tsx +21 -0
  42. package/components/icons/open-source.tsx +26 -0
  43. package/components/icons/safe.tsx +37 -0
  44. package/components/icons/shop.tsx +20 -0
  45. package/components/icons/sterling-silver-card.tsx +44 -0
  46. package/components/icons/templates.tsx +21 -0
  47. package/components/icons/validators.tsx +41 -0
  48. package/components/icons/view-all-card.tsx +20 -0
  49. package/components/icons/wallet.tsx +20 -0
  50. package/components/index.ts +2 -0
  51. package/components/logo.tsx +48 -40
  52. package/components/tooltip.tsx +31 -0
  53. package/package.json +2 -1
  54. package/root-layout/index.tsx +1 -1
  55. package/site-def/main-nav.tsx +248 -194
  56. package/components/commerce/checkout-panel/close-button.tsx +0 -26
@@ -1,10 +1,9 @@
1
1
  'use client'
2
2
  import React, { useState } from 'react'
3
- import { Plus } from 'lucide-react'
3
+ import { ArrowRight, Plus } from 'lucide-react'
4
4
  import { Search } from '../icons'
5
- import { ChatWidget } from '../../components'
6
5
  import { Button, Card } from '@hanzo/ui/primitives'
7
- import LuxLogo from '../icons/lux-logo'
6
+ import { Logo } from '..'
8
7
 
9
8
  interface MobileNavMenuAIProps {
10
9
  setMenuOpen: (open: boolean) => void
@@ -15,11 +14,16 @@ const MobileNavMenuAI: React.FC<MobileNavMenuAIProps> = ({ setMenuOpen }) => {
15
14
 
16
15
  return (
17
16
  <>
18
- <div className="w-full px-5 py-4 text-2xl bg-[#202020] cursor-pointer">
19
- <div className="flex items-center gap-5 border-b border-[#3A3A3A]">
20
- <Search className='w-6 h-6 flex-none' />
21
- <div className="text-white font-bold flex-1" onClick={() => setIsOpen(true)}>Ask AI Chat...</div>
22
- <Plus className='w-6 h-6 flex-none rotate-45 transition-transform' onClick={() => setMenuOpen(false)} />
17
+ <div className="w-full px-[10.8px] py-4 text-2xl cursor-pointer">
18
+ <div className='flex justify-between'>
19
+ <Logo variant='text-only' />
20
+ <Plus className='w-[17.7px] h-[17.7px] flex-none rotate-45 transition-transform' onClick={() => setMenuOpen(false)} />
21
+ </div>
22
+ <div className="flex items-center gap-5 border-b border-[#3A3A3A] mt-4 rounded-2xl bg-muted-4">
23
+ <div className="text-muted-1 font-bold flex-1 flex justify-between h-9 items-center" onClick={() => setIsOpen(true)}>
24
+ <span className='text-base pl-2 font-light'>Ask AI a question</span>
25
+ <ArrowRight />
26
+ </div>
23
27
  </div>
24
28
  </div>
25
29
  <div className={
@@ -1,12 +1,14 @@
1
1
  'use client'
2
2
  import React from 'react'
3
-
4
3
  import type { LinkDef } from '@hanzo/ui/types'
5
4
  import { cn } from '@hanzo/ui/util'
6
- import type { LinkDefExtended } from '../../site-def/main-nav'
5
+ import type { LinkDefExtended, ChildMenu } from '../../site-def/main-nav'
7
6
  import MobileNavMenuAI from './mobile-nav-menu-ai'
8
7
  import MobileNavMenuItem from './mobile-nav-menu-item'
9
8
  import MobileAuthWidget from './mobile-login-button'
9
+ import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@hanzo/ui/primitives'
10
+ import { ChevronDown } from 'lucide-react'
11
+ import Link from 'next/link'
10
12
 
11
13
  const MobileNav: React.FC<{
12
14
  currentAs: string | undefined
@@ -15,11 +17,6 @@ const MobileNav: React.FC<{
15
17
  commonItemClx?: string | ((def: LinkDef) => string)
16
18
  setChatbotOpen: (open: boolean) => void
17
19
  setMenuOpen: (open: boolean) => void
18
- /**
19
- * This is called *in addition* to the link's actual navigation
20
- * action. eg, I link is clicked, and the modal menu is closes
21
- */
22
- // TODO :aa shouldn't be so aware of parent context!
23
20
  setMenuState: (arg: 'closed' | 'nav' | 'login' | 'bag') => void
24
21
  }> = ({
25
22
  currentAs,
@@ -31,38 +28,75 @@ const MobileNav: React.FC<{
31
28
  setMenuOpen
32
29
  }) => (
33
30
  links.length > 0 ? (
34
-
35
- <div className={cn('flex flex-col h-full', className)} >
31
+ <div className={cn('flex flex-col h-full', className)}>
36
32
  <MobileNavMenuAI setMenuOpen={setMenuOpen} />
37
- <div className="flex flex-col flex-1">
38
- {links.map((el, index) => {
39
- const variant = el.variant ?? 'link'
40
- let internalClx = ''
41
- // note that linkFG (or any other variant of 'link')
42
- // will not get assigned these classes,
43
- // and will remain styles is 'foreground' (hence the name)
44
- if (variant === 'link') {
45
- internalClx += ' text-muted hover:text-foreground active:text-accent rounded-none'
33
+ <div className="flex flex-col flex-1 overflow-auto">
34
+ <Accordion type="single" collapsible className='w-full h-full'>
35
+ {links.map((el, index) => {
36
+ const itemClx = (commonItemClx) ? (typeof commonItemClx === 'string' ? commonItemClx : commonItemClx(el)) : ''
37
+ const variant = el.variant ?? 'link'
38
+ let internalClx = variant === 'link'
39
+ ? ' text-muted hover:text-foreground active:text-accent rounded-none'
40
+ : ' min-w-0'
41
+
46
42
  if (currentAs && currentAs === el.href) {
47
- internalClx += ' text-accent '
43
+ internalClx += ' pointer-events-none'
44
+ if (variant === 'link') {
45
+ internalClx += ' text-accent'
46
+ }
48
47
  }
49
- }
50
- else {
51
- internalClx += ' min-w-0'
52
- }
53
- if (currentAs && currentAs === el.href) {
54
- internalClx += ' pointer-events-none'
55
- }
56
- const itemClx = (commonItemClx) ? (typeof commonItemClx === 'string' ? commonItemClx : commonItemClx(el)) : ''
57
48
 
58
- if (!el.isAIMenu) {
59
- return <MobileNavMenuItem link={el} setMenuOpen={setMenuOpen}/>
60
- }
61
- })}
49
+ if (!el.isAIMenu) {
50
+ return (
51
+ <AccordionItem key={index} value={el.title ? el.title : ""} className='!no-underline !border-0'>
52
+ <AccordionTrigger className={cn(internalClx, itemClx, '')}>
53
+ <div className={cn(internalClx, itemClx, 'flex items-center justify-between w-full pl-3 text-base font-normal leading-6')}>
54
+ {el.title}
55
+ </div>
56
+ <ChevronDown className="w-4 h-4 mr-3" />
57
+ </AccordionTrigger>
58
+ <AccordionContent>
59
+ {el.childMenu && (
60
+ <div className="px-4">
61
+ {Object.entries(el.childMenu.reduce((acc, child) => {
62
+ const group = acc[child.groupName ? child.groupName : ""] || []
63
+ group.push(child)
64
+ acc[child.groupName ? child.groupName : ""] = group
65
+ return acc
66
+ }, {} as { [key: string]: ChildMenu[] })).map(([groupName, children]) => (
67
+ <div key={groupName}>
68
+ <div className="mt-4 mb-4 font-light text-muted-1">{groupName}</div>
69
+ {children.map((child, childIndex) => (
70
+ <div key={childIndex} className="m-2">
71
+ <div className="flex items-center py-1">
72
+ <span>
73
+ {child.icon && child.icon}
74
+ </span>
75
+ <Link
76
+ href={child.href}
77
+ className="text-muted-2 hover:underline ml-5 hover:text-primary"
78
+ target={child.newTab ? '_blank' : '_self'}
79
+ rel="noopener noreferrer"
80
+ >
81
+ {child.title}
82
+ </Link>
83
+ </div>
84
+ </div>
85
+ ))}
86
+ </div>
87
+ ))}
88
+ </div>
89
+ )}
90
+ </AccordionContent>
91
+ </AccordionItem>
92
+ )
93
+ }
94
+ })}
95
+ </Accordion>
62
96
  </div>
63
- <MobileAuthWidget className=' text-2xl' handleLogin={() => { setMenuState('login') }} />
97
+ <MobileAuthWidget className='text-2xl z-10' handleLogin={() => { setMenuState('login') }} />
64
98
  </div>
65
99
  ) : null
66
- )
100
+ );
67
101
 
68
- export default MobileNav
102
+ export default MobileNav;
@@ -33,7 +33,7 @@ const Footer: React.FC<{
33
33
  'md:flex md:flex-row md:justify-between '
34
34
  }>
35
35
  <div className='hidden lg:flex flex-col' key={0}>
36
- <Logo size='md' layout='text-only' />
36
+ <Logo size='md' variant='text-only' />
37
37
  </div>
38
38
  {footer.map((defs: LinkDef[], index: number) => {
39
39
 
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
 
3
- import { NavItems } from '@hanzo/ui/primitives'
4
3
  import { cn } from '@hanzo/ui/util'
5
4
  import { AuthWidget } from '@hanzo/auth/components'
6
5
 
@@ -8,7 +7,7 @@ import { Logo } from '..'
8
7
 
9
8
  import DesktopBagPopup from '../commerce/desktop-bag-popup'
10
9
  import BagButton from '../commerce/bag-button'
11
- import DesktopNav from '../commerce/desktop-nav-menu'
10
+ import DesktopNav from '../commerce/desktop-nav-menu'
12
11
 
13
12
 
14
13
  import type { LinkDef } from '@hanzo/ui/types'
@@ -25,25 +24,27 @@ const DesktopHeader: React.FC<{
25
24
 
26
25
  // TODO move 13px into a size class and configure twMerge to recognize say, 'text-size-nav'
27
26
  // (vs be beat out by 'text-color-nav')
28
- return (
29
- <header className={cn('bg-background fixed z-header top-0 left-0 right-0', className)} >
30
- {/* md or larger */}
31
- <div className={
32
- 'flex flex-row h-[80px] items-center justify-between ' +
33
- 'px-[8px] w-full mx-auto max-w-screen'
34
- }>
35
- <Logo size='md' href='/' className='hidden lg:flex' key='two' layout='text-only'/>
36
- <Logo size='sm' href='/' className='hidden md:flex lg:hidden' key='one' layout='text-only'/>
27
+ return (
28
+ <header className={cn('bg-background fixed z-header top-0 left-0 right-0', className)} >
37
29
  {/* md or larger */}
38
- <div className='flex gap-4 items-center'>
39
- <DesktopNav links = {links}/>
40
- <DesktopBagPopup popupClx='w-[340px]' trigger={<BagButton className='text-primary -mr-[3px] lg:min-w-0' />} />
41
- <AuthWidget/>
30
+ <div className={
31
+ 'flex flex-row h-[80px] items-center justify-between ' +
32
+ 'px-[8px] w-full mx-auto max-w-screen'
33
+ }>
34
+ <Logo size='md' href='/' outerClx='hidden lg:flex' key='two' variant='text-only' />
35
+ <Logo size='sm' href='/' outerClx='hidden md:flex lg:hidden' key='one' variant='text-only' />
36
+ {/* md or larger */}
37
+ <div className='flex w-full gap-4 items-center justify-between lg:ml-22'>
38
+ <DesktopNav links={links} />
39
+ <div className='flex items-center'>
40
+ <DesktopBagPopup popupClx='w-[340px]' trigger={<BagButton className='text-primary -mr-[3px] lg:min-w-0' />} />
41
+ <AuthWidget />
42
+ </div>
43
+ </div>
42
44
  </div>
43
- </div>
44
- </header>
45
- )
46
- }
45
+ </header>
46
+ )
47
+ }
47
48
 
48
49
  export default DesktopHeader
49
50
 
@@ -86,28 +86,25 @@ const MobileHeader: React.FC<{
86
86
  // header element MUST be fixed, and NOT sticky. Or else drawer breaks on mobile browsers
87
87
  return (<>
88
88
  <header className={cn(
89
- `bg-background fixed z-header top-0 left-0 w-full h-19 ${menuOpen() ? 'hidden' : 'block'}`,
89
+ `bg-background fixed z-header top-0 left-0 w-full ${menuOpen() ? 'hidden' : 'block'}`,
90
90
  className
91
91
  )}>
92
92
  {/* smaller than md: mobile style drawer menu; h-11 is 44px, the standard mobile header height */}
93
- <div className="flex h-11 items-center justify-between pl-6 pr-4">
94
- <div className='h-[74px] w-pr-100 flex flex-row justify-between items-center font-bold'>
95
- <Logo href='/' size='sm' className={'top-[3px] h-full'} layout='text-only' />
96
- {/* Not that key to the cross-fade effect
97
- is that this is **on top of** the logo. */}
98
- {menuOpen() && (
99
- <div className={'absolute left-0 top-0 bottom-0 right-0 pl-8 ' +
100
- 'flex flex-row ' +
101
- 'bg-background animate-mobile-menu-open'
102
- }>
103
- <Icons.Avatar className='self-center ' />
104
- </div>
105
- )}
106
- <div className='flex gap-0 flex-row'>
107
- <BagButton className='text-primary -mr-[3px]' onClick={openBag} />
108
- <MenuToggleButton className='text-foreground' open={menuOpen()} setOpen={setMenuOpen} />
93
+ <div className='w-full h-11 flex flex-row justify-between items-center font-bold pl-6 pr-4'>
94
+ <Logo href='/' size='sm' outerClx={'top-[3px] h-full'} variant='text-only' />
95
+ {/* Not that key to the cross-fade effect
96
+ is that this is **on top of** the logo. */}
97
+ {menuOpen() && (
98
+ <div className={'absolute left-0 top-0 bottom-0 right-0 pl-8 ' +
99
+ 'flex flex-row ' +
100
+ 'bg-background animate-mobile-menu-open'
101
+ }>
102
+ <Icons.Avatar className='self-center ' />
109
103
  </div>
110
-
104
+ )}
105
+ <div className='flex gap-0 flex-row'>
106
+ <BagButton className='text-primary -mr-[3px]' onClick={openBag} />
107
+ <MenuToggleButton className='text-foreground' open={menuOpen()} setOpen={setMenuOpen} />
111
108
  </div>
112
109
 
113
110
  </div>