-
Notifications
You must be signed in to change notification settings - Fork 422
interactive diagram timeboost gentle intro #2049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
181 commits
Select commit
Hold shift + click to select a range
4f7bfc1
Feat: add diagram + components + packages
anegg0 8a6c056
fix: diagram format fix
anegg0 f761f87
fix: add Winnies original auction diagram
anegg0 d020b73
fix: readjust modal on top of other elements
anegg0 c798345
fix: remove old file
anegg0 843b3cf
fix: remove original static image
anegg0 7d40d99
fix: reformat
anegg0 c0050ea
fix: adjust modal font color
anegg0 5b74aa1
fix: adjust swelling dot color
anegg0 71dc5c0
fix: reformat
anegg0 a83b815
feat: implement multiple contents for <Modal/> component
anegg0 0bf35f9
feat: transform the number badge as a component
anegg0 a0dd534
feat: replace basic <Circle/> with <Number4/> inside of <Modal/>
anegg0 c25fc5a
feat: add animation to number components
anegg0 07e4b37
Revert "feat: add animation to number components"
anegg0 a329e83
feat: add effect to number5 component
anegg0 a00047e
fix: deleted deprecated <Circle/> component
anegg0 3818fbc
feat: add new reusable <NumberComponent/>
anegg0 00d642f
fix: adjust number 1,2,3,4 paths and styles
anegg0 19b8169
fix: removed deprecated number elements
anegg0 984b4e9
Revert "fix: removed deprecated number elements"
anegg0 58a6740
fix: remove first batch deprecated circle elements
anegg0 4b08eb1
fix: removal second batch deprecated circle elements
anegg0 1367cdb
fix: batch 4 removal deprecated circle elements
anegg0 c432d52
fix: batch 4 removal deprecated elements
anegg0 cb57e97
fix: final batch removal deprecated elements
anegg0 8802f8b
feat: make Modal take its content from modalContent.json
anegg0 303dbe8
fix: re-add Alice component
anegg0 6daa791
fix: removal unneeded number 5
anegg0 7c447e7
fix: removal deprecated number5
anegg0 f67f983
fix: cleaned up, functional diagram
anegg0 9d342a8
Fix: re-add label
anegg0 26cfc17
feat: define NumbersComponent offsets based on their number
anegg0 e410bc0
feat: better location argument passing
anegg0 dce35f7
fix: number symbol location fix
anegg0 14ac44d
feat: add remaining numbers
anegg0 d61448f
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 c956a77
feat: add tmp OG files
anegg0 6fc5a41
fix: adjust modals bg color
anegg0 ec5c3a4
fix: realign numbers within circle
anegg0 81dc682
feat: add code block rendering in modals
anegg0 c1ef728
fix: make modals size adjust to content
anegg0 cf16df6
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 a99c839
fix: example code block for Derek
anegg0 d102423
feat: add dark/light modes
anegg0 86110a5
fix: re-add animations in light mode
anegg0 5ce03b4
Fix: animate both dark & light mode
anegg0 0164d5b
feat: refactor NumberComponent
anegg0 93049bc
feat: refactor Modal.tsx
anegg0 765b471
feat: update files
anegg0 a47c550
Revert "feat: update files"
anegg0 03dfc9d
feat: refactor modal
anegg0 208e773
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 1f19e0c
fix: remove example files
anegg0 d916d08
feat: better positioning for NumberComponent
anegg0 7020f64
Revert "feat: better positioning for NumberComponent"
anegg0 29277ef
fix: add screen size responsiveness for modals
anegg0 1836613
fix: fit modal to all screens
anegg0 9809deb
feat: add smooth transitions on modal opening
anegg0 b92adc3
fix: reformat
anegg0 cbb9e0c
refactor: Replace Modal with static NumberComponent for number 1
anegg0 518c1c4
feat: Remove animation for NumberComponent when number is 1
anegg0 1e55a91
refactor: Replace Modal with NumberComponent for number 5
anegg0 7af7352
fix: Remove animation effects for number 5 in NumberComponent
anegg0 d1222bb
fix: first batch modal content corrections
anegg0 8b8dafd
fix: correct modal content
anegg0 8944bee
feat: Add clickable code link in modal with new interface and styling
anegg0 97926ac
fix: include links to codebase in modal
anegg0 e775985
refactor: Update modal content for Timeboost centralized auction steps
anegg0 7e7a331
docs: Update modalContent.json for timeboost_submitBid step details
anegg0 ed41956
refactor: Simplify Timeboost auction modal content structure
anegg0 7f23724
feat: Update modalContent.json with detailed auction process descript…
anegg0 274d795
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 ea858e3
Revert "Merge branch 'master' into diagrams-timeboost-gentle-intro"
anegg0 e5de653
refactor: Optimize NumberComponent with ButtonComponent import and an…
anegg0 d946810
fix: squash 23 commits.
anegg0 fbae238
Revert "feat: Ensure numbers 3 and 4 have consistent styling with num…
anegg0 b7cffc3
style: Change number circle background color to orange
anegg0 dc4f9bb
fix: Remove uneven crossfade animation for numbers
anegg0 fd4fad9
refactor: Extract constants and types for Timeboost CentralizedAuctio…
anegg0 2e21792
fix: Correct TypeScript type import syntax in NumberComponent
anegg0 08d5078
fix: Remove TypeScript annotations from JSX files
anegg0 ad8982b
feat: Add low-frequency blinking effect to numbers 2, 3, and 4
anegg0 0a5364b
feat: Enhance ButtonComponent visibility with hover and scaling effects
anegg0 7e9d148
feat: Add ButtonComponent to numbers 3 and 4 in NumberComponent
anegg0 097372b
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 04823bb
fix: re-add ImageZoom component sources
anegg0 5270728
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 64a942e
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 1fb33e4
feat: Implement crossfade blinking effect for white circles in Number…
anegg0 3204b62
perf: Reduce blinking animation duration to 500ms for faster effect
anegg0 6029bb9
feat: Convert modalContent.json to modalContent.mdx with auction proc…
anegg0 af04d00
feat: Update Modal.tsx to import MDX content instead of JSON
anegg0 0b86e1c
refactor: Update Modal component to use MDX rendering with MDXProvider
anegg0 0d75090
feat: Add @mdx-js/react dependency to website package.json
anegg0 1d5595c
refactor: Update Modal component with minor formatting and syntax adj…
anegg0 057a753
fix: Resolve TypeScript JSX namespace and dependency conflicts
anegg0 4edb61b
feat: tmp changes, prolly need reverting
anegg0 62ea45f
feat: Add modal content for centralized auction diagram
anegg0 791beb2
refactor: Split modalContent.mdx into separate step-specific MDX files
anegg0 458c6b5
refactor: Remove redundant stepTitles and simplify Modal component re…
anegg0 ddf6340
feat: remove unneeded components
anegg0 f161dbf
fix: update steps with outlinks to relevant guide
anegg0 f4c2ee3
fix: update yarn
anegg0 e8035d8
style: Soften modal title color in dark mode
anegg0 573fa2f
refactor: Adjust animation duration and formatting in NumberComponent
anegg0 15d26bd
style: Refine number animation with smoother opacity pulse effect
anegg0 5209b16
refactor: Adjust opacity animation parameters for NumberComponent
anegg0 954bd04
refactor: Adjust number animation opacity and spring physics
anegg0 1fbb299
fix: reformat
anegg0 ebd48d0
feat: improved buttons' visibility
anegg0 27b8a3b
feat: Add blinking animation to interactive buttons
anegg0 5659791
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 b504539
fix: reformat
anegg0 a41d840
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 f13906f
refactor: Remove styled-components from ImageZoom component
anegg0 c64db1e
feat: Add image zoom styles to content body SCSS
anegg0 451da2c
fix: Implement ImageZoom functionality with proper modal and zoom beh…
anegg0 055e25b
fix: Improve ImageZoom component with accessibility and modal handling
anegg0 f4ec1fd
style: Format ImageZoom component with consistent whitespace
anegg0 dd865a2
refactor: Improve ImageZoom component with animations and accessibility
anegg0 0ed2040
feat: Add automatic ImageZoom wrapping for markdown images
anegg0 107e5e3
style: Refactor SCSS formatting and improve code readability
anegg0 3da3635
feat: Enhance image zoom to occupy full viewport with improved scaling
anegg0 1d4684f
fix: Improve image zoom animation to maintain enlarged state
anegg0 cfb1b95
style: Adjust zoomed image sizing to fit within viewport
anegg0 4c39fd9
refactor: Replace styled-components with CSS classes in Modal component
anegg0 3d0240f
refactor: Improve Modal component formatting and remove empty line
anegg0 9045a78
fix: Resolve Title component undefined error in MDX rendering
anegg0 d371842
style: Add backdrop filter and transparency to modal styles
anegg0 cadc63e
style: Remove modal blur and use solid theme-based background colors
anegg0 b1c5ed0
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 a04b5db
refactor: Reorganize modal styles into separate SCSS partial
anegg0 abc6366
refactor: Move NumberComponent styles to SCSS partial and update imports
anegg0 4215ea6
refactor: remove styles.modules.css and add its classes to website/sr…
anegg0 1128d01
fix: revert content changes
anegg0 e469c1f
refactor: relocate imgs
anegg0 75ef3eb
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 b51ee56
fix: reformat
anegg0 b89c660
fix: fix import
anegg0 b46067e
fix: Update import path for number component SCSS module
anegg0 74fe470
refactor: Update import path for number component styles
anegg0 7d33b23
fix: Resolve CSS module import issues for NumberComponent
anegg0 34bd6b4
refactor: Update import path for number component styles
anegg0 a861a15
Based on the changes, here's a concise commit message that captures t…
anegg0 3873d71
feat: Add Radix UI, React Spring, and MDX dependencies to project
anegg0 5abe611
feat: Add interactive Timeboost auction diagram component
anegg0 782b747
feat: Add TypeScript types to InteractiveDiagrams component
anegg0 ae0a75b
refactor: Configure TypeScript for React and JSX support
anegg0 2c00313
refactor: Update NumberComponent with theme-specific styles and imports
anegg0 aa141c1
refactor: Remove local styles module and use global CSS for NumberCom…
anegg0 4d72468
refactor: Update import path for custom CSS file
anegg0 a4e3c70
style: Increase blinking animation speed in NumberComponent
anegg0 842e10f
refactor: Relocate InteractiveDiagrams index to Timeboost/Centralized…
anegg0 0a16988
style: Increase blinking animation speed in NumberComponent
anegg0 6a61f82
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 09129ee
feat: Enhance blinking animation for numbers 2, 3, and 4 with more ag…
anegg0 4a2f3ab
feat: Add color alternation between blue and orange for NumberComponent
anegg0 332e81d
fix: reformat
anegg0 bb4575c
feat: Enhance ImageZoom with styled-components, portal, and improved UX
anegg0 269fbf8
refactor: Replace styled-components with global CSS classes in ImageZoom
anegg0 05a9023
style: Update modal transparency and close button positioning
anegg0 b2a48b9
fix: restore functional ImageZoom component
anegg0 a3699a6
feat: add package.json with types/react deps
anegg0 d2a5d11
fix: remove all legacy imgs
anegg0 0dcf49d
fix: remove useless usage file
anegg0 992429c
fix: img links
anegg0 1e451bb
fix: re-add legacy img
anegg0 1885842
refactor: Simplify CentralizedAuction component and remove unnecessar…
anegg0 ab117a2
feat: Add named FlowChart export to CentralizedAuction component
anegg0 b92da22
refactor: remove duplicate index.jsx
anegg0 42ef07b
update: bump yarn.lock
anegg0 66c9b7a
feat: Add connection lines to CentralizedAuction diagram
anegg0 f02dffa
Revert "update: bump yarn.lock"
anegg0 b77cfc0
Revert "refactor: remove duplicate index.jsx"
anegg0 b2988e7
fix: reformat
anegg0 b981ca9
update: yarn.lock
anegg0 5686449
Merge branch 'master' into diagrams-timeboost-gentle-intro
anegg0 916f9b7
fix: delete redundant file
anegg0 a7960bf
refactor: Merge root package.json dependencies into website/package.json
anegg0 3e97041
refactor: remove unneeded package.json
anegg0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 21 additions & 21 deletions
42
arbitrum-docs/how-arbitrum-works/timeboost/gentle-introduction.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
202 changes: 202 additions & 0 deletions
202
...-orbit-chain/02-configure-your-chain/common-configurations/fast-withdrawals.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Submodule stylus-by-example
updated
8 files
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-718 KB
...archive/build-decentralized-apps/metamask-connect-to-arb-sepolia-2025-01-12.gif
Binary file not shown.
Binary file removed
BIN
-64.6 KB
website/archive/build-decentralized-apps/metamask-quickstart-localhost.png
Binary file not shown.
Binary file removed
BIN
-64.6 KB
website/archive/build-decentralized-apps/quickstart-localhost-metamask.png
Binary file not shown.
Binary file removed
BIN
-710 KB
.../archive/build-decentralized-apps/remix-metamask-deploy-to-anvil-2025-01-13.gif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
website/src/components/InteractiveDiagrams/Timeboost/CentralizedAuction/ButtonComponent.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import * as React from 'react'; | ||
|
|
||
| const ButtonComponent = ({ x, y, width, height }) => { | ||
| const [isHovered, setIsHovered] = React.useState(false); | ||
|
|
||
| return ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| x={x - width * 0.25} | ||
| y={y - height * 0.25} | ||
| width={width * 1.5} | ||
| height={height * 1.5} | ||
| viewBox="0 0 512 512" | ||
| style={{ | ||
| cursor: 'pointer', | ||
| transition: 'transform 0.2s', | ||
| transform: isHovered ? 'scale(1.1)' : 'scale(1)', | ||
| }} | ||
| onMouseEnter={() => setIsHovered(true)} | ||
| onMouseLeave={() => setIsHovered(false)} | ||
| > | ||
| <title>Interactive Button</title> | ||
| <path | ||
| d="M448,256c0-106-86-192-192-192S64,150,64,256s86,192,192,192S448,362,448,256Z" | ||
| style={{ | ||
| fill: 'none', | ||
| stroke: '#ffffff', | ||
| strokeMiterlimit: 10, | ||
| strokeWidth: '32px', | ||
| filter: 'drop-shadow(0px 0px 4px rgba(255,255,255,0.5))', | ||
| }} | ||
| /> | ||
| <circle | ||
| cx="256" | ||
| cy="256" | ||
| r="144" | ||
| style={{ | ||
| fill: '#ff7f2a', | ||
| filter: isHovered ? 'brightness(1.2)' : 'none', | ||
| transition: 'filter 0.2s', | ||
| animation: 'blink 2s ease-in-out infinite', | ||
| }} | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; | ||
|
|
||
| export default ButtonComponent; |
157 changes: 157 additions & 0 deletions
157
website/src/components/InteractiveDiagrams/Timeboost/CentralizedAuction/Modal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| import React, { useState, useEffect } from 'react'; | ||
| import { useTransition, animated } from '@react-spring/web'; | ||
| import * as Dialog from '@radix-ui/react-dialog'; | ||
| import step1Content from './modal-centralized-auction-step-1.mdx'; | ||
| import step2Content from './modal-centralized-auction-step-2.mdx'; | ||
| import step3Content from './modal-centralized-auction-step-3.mdx'; | ||
| import step4Content from './modal-centralized-auction-step-4.mdx'; | ||
| import step5Content from './modal-centralized-auction-step-5.mdx'; | ||
| import { createPortal } from 'react-dom'; | ||
| import { NumberComponent } from './NumberComponent'; | ||
| import { MDXProvider } from '@mdx-js/react'; | ||
| import type { MDXComponents } from '@mdx-js/react/lib'; | ||
| import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter'; | ||
| import { oneDark, oneLight } from 'react-syntax-highlighter/dist/cjs/styles/prism'; | ||
| import javascript from 'react-syntax-highlighter/dist/cjs/languages/prism/javascript'; | ||
| import solidity from 'react-syntax-highlighter/dist/cjs/languages/prism/solidity'; | ||
| import { useColorMode } from '@docusaurus/theme-common'; | ||
|
|
||
| // Define the CodeBlock interface | ||
| interface CodeBlock { | ||
| language: string; | ||
| code: string; | ||
| } | ||
|
|
||
| SyntaxHighlighter.registerLanguage('javascript', javascript); | ||
| SyntaxHighlighter.registerLanguage('solidity', solidity); | ||
|
|
||
| const components = { | ||
| h1: ({ children }) => <h1 className="modal__title">{children}</h1>, | ||
| p: ({ children }) => <p>{children}</p>, | ||
| ol: ({ children }) => <ul>{children}</ul>, | ||
| li: ({ children }) => <li>{children}</li>, | ||
| pre: ({ children }) => children, | ||
| code: ({ children, className }) => { | ||
| const language = className?.replace('language-', '') || 'text'; | ||
| return ( | ||
| <SyntaxHighlighter | ||
| language={language} | ||
| style={useColorMode().isDarkTheme ? oneDark : oneLight} | ||
| customStyle={{ | ||
| margin: 0, | ||
| padding: '16px', | ||
| borderRadius: '4px', | ||
| backgroundColor: useColorMode().isDarkTheme ? 'rgb(41, 45, 62)' : 'rgb(246, 248, 250)', | ||
| }} | ||
| > | ||
| {children} | ||
| </SyntaxHighlighter> | ||
| ); | ||
| }, | ||
| }; | ||
|
|
||
| export function Modal({ number }: { number: number }) { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const { isDarkTheme } = useColorMode(); | ||
| const stepContent = { | ||
| 1: step1Content, | ||
| 2: step2Content, | ||
| 3: step3Content, | ||
| 4: step4Content, | ||
| 5: step5Content, | ||
| }; | ||
| const StepContent = stepContent[number]; | ||
|
|
||
| const transitions = useTransition(isOpen, { | ||
| from: { opacity: 0, transform: 'scale(0.95)' }, | ||
| enter: { opacity: 1, transform: 'scale(1)' }, | ||
| leave: { opacity: 0, transform: 'scale(0.95)' }, | ||
| config: { tension: 300, friction: 20 }, | ||
| }); | ||
|
|
||
| const overlayTransitions = useTransition(isOpen, { | ||
| from: { opacity: 0 }, | ||
| enter: { opacity: 1 }, | ||
| leave: { opacity: 0 }, | ||
| config: { duration: 200 }, | ||
| }); | ||
|
|
||
| const renderCodeBlock = (block: CodeBlock, index: number) => ( | ||
| <div key={index} style={{ position: 'relative' }}> | ||
| <SyntaxHighlighter | ||
| language={block.language} | ||
| style={isDarkTheme ? oneDark : oneLight} | ||
| customStyle={{ | ||
| margin: 0, | ||
| padding: '16px', | ||
| borderRadius: '4px', | ||
| backgroundColor: isDarkTheme ? 'rgb(41, 45, 62)' : 'rgb(246, 248, 250)', | ||
| }} | ||
| > | ||
| {block.code.trim()} | ||
| </SyntaxHighlighter> | ||
| </div> | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| <g | ||
| onClick={() => setIsOpen(true)} | ||
| style={{ | ||
| cursor: 'pointer', | ||
| pointerEvents: 'all', | ||
| }} | ||
| > | ||
| <NumberComponent number={number} /> | ||
| </g> | ||
| {typeof document !== 'undefined' && | ||
| createPortal( | ||
| <Dialog.Root open={isOpen} onOpenChange={setIsOpen}> | ||
| <Dialog.Portal> | ||
| {overlayTransitions( | ||
| (styles, item) => | ||
| item && <Dialog.Overlay className="modal__overlay" style={styles} />, | ||
| )} | ||
| {transitions( | ||
| (styles, item) => | ||
| item && ( | ||
| <div className="modal__container"> | ||
| <Dialog.Content | ||
| className="modal__content" | ||
| forceMount | ||
| style={{ | ||
| ...styles, | ||
| pointerEvents: 'auto', | ||
| }} | ||
| > | ||
| <header className="modal__header"> | ||
| <Dialog.Close | ||
| className="modal__close-button" | ||
| onClick={() => setIsOpen(false)} | ||
| > | ||
| <CloseIcon /> | ||
| </Dialog.Close> | ||
| </header> | ||
| <MDXProvider components={components}> | ||
| <StepContent /> | ||
| </MDXProvider> | ||
| </Dialog.Content> | ||
| </div> | ||
| ), | ||
| )} | ||
| </Dialog.Portal> | ||
| </Dialog.Root>, | ||
| document.body, | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| const CloseIcon = () => ( | ||
| <svg width="22" height="22" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path | ||
| d="M15.9574 14.1689L8.59651 6.75098L6.73232 8.59598L14.1313 16.071L6.71338 23.4129L8.5964 25.2769L15.9574 17.8779L23.3943 25.2769L25.2392 23.4129L17.8213 16.071L25.2202 8.59598L23.3752 6.75098L15.9574 14.1689Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ); |
67 changes: 67 additions & 0 deletions
67
website/src/components/InteractiveDiagrams/Timeboost/CentralizedAuction/NumberComponent.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import * as React from 'react'; | ||
| import { useSpring, animated } from '@react-spring/web'; | ||
| import { useColorMode } from '@docusaurus/theme-common'; | ||
| import '@site/src/css/custom.css'; | ||
| import ButtonComponent from './ButtonComponent'; | ||
| import { CIRCLE_RADIUS, numberPaths, coordinates } from './constants'; | ||
| import { NumberComponentProps } from './types'; | ||
|
|
||
| export const NumberComponent = ({ number }) => { | ||
| const { isDarkTheme } = useColorMode(); | ||
|
|
||
| const animationProps = | ||
| number === 1 || number === 5 | ||
| ? { opacity: 1 } | ||
| : useSpring({ | ||
| from: { opacity: 0, fill: '#ff7f2a' }, | ||
| to: [ | ||
| { opacity: 1, fill: '#ff7f2a' }, | ||
| { opacity: 1, fill: '#3578e5' }, | ||
| { opacity: 0, fill: '#3578e5' } | ||
| ], | ||
| config: { tension: 20000, friction: 10 }, | ||
| loop: true, | ||
| reset: true, | ||
| immediate: false, | ||
| }); | ||
|
|
||
| const coords = coordinates[number]; | ||
| const pathData = numberPaths[number]; | ||
|
|
||
| if (!coords || !pathData) { | ||
| return null; | ||
| } | ||
|
|
||
| const offsetX = coords.circle.x - coords.path.x + (coords.offset?.x || 0); | ||
| const offsetY = coords.circle.y - coords.path.y + (coords.offset?.y || 0); | ||
|
|
||
| const circleClassName = isDarkTheme ? 'cls-5' : 'cls-5-light'; | ||
| const pathClassName = isDarkTheme ? 'cls-10' : 'cls-10-light'; | ||
|
|
||
| return ( | ||
| <g id={`number${number}`}> | ||
| {(number === 2 || number === 3 || number === 4) && ( | ||
| <ButtonComponent | ||
| x={coords.circle.x - CIRCLE_RADIUS} | ||
| y={coords.circle.y - CIRCLE_RADIUS} | ||
| width={CIRCLE_RADIUS * 2} | ||
| height={CIRCLE_RADIUS * 2} | ||
| /> | ||
| )} | ||
| <animated.circle | ||
| id={`circle${number}`} | ||
| cx={coords.circle.x} | ||
| cy={coords.circle.y} | ||
| r={CIRCLE_RADIUS} | ||
| className={circleClassName} | ||
| style={{ ...animationProps }} | ||
| /> | ||
| <path | ||
| id={`path${number}`} | ||
| d={pathData} | ||
| className={pathClassName} | ||
| transform={`translate(${offsetX}, ${offsetY})`} | ||
| /> | ||
| </g> | ||
| ); | ||
| }; |
17 changes: 17 additions & 0 deletions
17
website/src/components/InteractiveDiagrams/Timeboost/CentralizedAuction/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export const CIRCLE_RADIUS = 20.95; | ||
|
|
||
| export const numberPaths = { | ||
| 1: 'M412.16 410.7v-3.06c2.5 0 3.66-.47 4.05-2.65h3.99v14.72h-4.35v-9.01h-3.68Z', | ||
| 2: 'M583.04 633.46c.8-1.14 1.46-1.64 3.86-2.91 2.09-1.12 2.61-1.64 2.61-2.61 0-.84-.54-1.36-1.38-1.36-1.06 0-1.57.67-1.64 2.11h-4.42c0-3.25 2.35-5.21 6.25-5.21 3.36 0 5.62 1.68 5.62 4.18 0 2.11-.99 3.55-3.34 4.78l-.78.41c-2.05 1.08-2.67 1.55-2.84 2.48.73-.06 1.42-.11 2.2-.11h5.17v3.3h-12.52c0-2.46.37-3.86 1.21-5.06Z', | ||
| 3: 'M586.28 781.21c1.06 0 1.72-.62 1.72-1.53 0-1.03-.67-1.59-2.15-1.59h-.6v-3.21h.47c1.49 0 2.05-.52 2.05-1.57 0-.82-.67-1.42-1.62-1.42-1.12 0-1.75.78-1.77 2.05h-4.29c.09-3.19 2.31-5.11 6.14-5.11s5.88 1.57 5.88 4.07c0 1.7-.91 2.93-2.76 3.34v.11c2 .39 3.02 1.64 3.02 3.51 0 2.71-2.28 4.42-6.23 4.42-3.51 0-6.23-1.42-6.23-5.3h4.35c.06 1.42.78 2.24 2 2.24Z', | ||
| 4: 'M1048.97 602.13v-3.3l5.49-8.55h5.54v8.66h2.13v3.19H1060V605h-4.24v-2.87h-6.79Zm3.53-3.19h3.45c0-1.7 0-3.38.22-5.52l-.19-.06-3.47 5.58Z', | ||
| 5: 'M1003.53 257.43c1.01 0 1.7-.97 1.7-2.18s-.67-2.05-1.75-2.05c-.82 0-1.36.52-1.7 1.31l-4.27-.3.86-8.73h10.43v3.3h-4.42c-.78 0-1.75-.02-2.52-.11-.09.8-.15 1.96-.45 2.76h.17c.69-.78 1.77-1.16 3.12-1.16 2.93 0 5.08 2.11 5.08 4.96 0 3.21-2.46 5.34-6.23 5.34s-6.18-1.92-6.31-4.8h4.52c.06 1.01.73 1.66 1.75 1.66Z', | ||
| }; | ||
|
|
||
| export const coordinates = { | ||
| 1: { circle: { x: 416.59, y: 412.69 }, path: { x: 412.16, y: 410.7 }, offset: { x: -4, y: -2 } }, | ||
| 2: { circle: { x: 588.13, y: 631.51 }, path: { x: 583.04, y: 633.46 }, offset: { x: -4, y: 1 } }, | ||
| 3: { circle: { x: 586.23, y: 776.88 }, path: { x: 586.28, y: 781.21 }, offset: { x: 1, y: 4 } }, | ||
| 4: { circle: { x: 1055.6, y: 597.98 }, path: { x: 1048.97, y: 602.13 }, offset: { x: -6, y: 3 } }, | ||
| 5: { circle: { x: 1003.53, y: 257.43 }, path: { x: 1003.53, y: 257.43 }, offset: { x: 1, y: 4 } }, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.