This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
new homepage #230
Open
xxibcill
wants to merge
20
commits into
v1.1.0
Choose a base branch
from
feat/change-homepage-layout
base: v1.1.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
new homepage #230
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9cc88c9
add Divider to Navbar
xxibcill f6e5c0d
set ToggleButton for general used
xxibcill b9994c3
Merge remote-tracking branch 'origin/v1.1.0' into feat/change-homepag…
xxibcill f6666dc
finish switch network button
xxibcill e071092
able to set primary color in TypeID
xxibcill 26f2dfa
fix primary color
xxibcill f3d1c6c
Merge branch 'feat/new-color-theme' into feat/change-homepage-layout
xxibcill 65f5a47
finish Latest Transactions on desktop
xxibcill b53f443
rearrange NavBar
xxibcill 37b702c
fix style
xxibcill f62def8
fix MsgBadge
xxibcill 1f01d0c
finish Latest Requests table
xxibcill 85df249
add more info card
xxibcill 887c961
tx last 24 hr
xxibcill 4d93126
last24 hours
xxibcill e50682f
calculate Avg Staking APR
xxibcill bc14941
optimize use query instead of sub
xxibcill 76c724f
fix status badge in mobile
xxibcill 36979b4
finish table mobile version
xxibcill 34c8c33
header mobile
xxibcill 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 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 |
---|---|---|
|
@@ -5,11 +5,11 @@ module Styles = { | |
style([ | ||
display(`flex), | ||
borderRadius(`px(8)), | ||
border(`px(1), `solid, isDarkMode ? theme.neutral_100 : theme.neutral_600), | ||
// border(`px(1), `solid, isDarkMode ? theme.neutral_100 : theme.neutral_600), | ||
backgroundColor(theme.neutral_000), | ||
padding2(~v=`px(8), ~h=`px(10)), | ||
padding2(~v=`px(8), ~h=`px(16)), | ||
minWidth(`px(153)), | ||
justifyContent(`spaceBetween), | ||
// justifyContent(`spaceBetween), | ||
alignItems(`center), | ||
position(`relative), | ||
cursor(`pointer), | ||
|
@@ -43,8 +43,40 @@ module Styles = { | |
padding2(~v=`px(5), ~h=`px(10)), | ||
hover([backgroundColor(theme.neutral_100)]), | ||
]); | ||
let buttonContainer = style([Media.mobile([width(`percent(100.))])]); | ||
let baseBtn = | ||
style([ | ||
textAlign(`center), | ||
Media.mobile([flexGrow(0.), flexShrink(0.), flexBasis(`percent(50.))]), | ||
]); | ||
|
||
let leftBtn = (state, theme: Theme.t, isDarkMode) => { | ||
style([ | ||
borderTopRightRadius(`zero), | ||
borderBottomRightRadius(`zero), | ||
backgroundColor(state ? theme.neutral_900 : theme.neutral_000), | ||
color(state ? theme.neutral_100 : theme.neutral_900), | ||
hover([ | ||
backgroundColor(state ? theme.neutral_900 : theme.neutral_100), | ||
color(state ? theme.neutral_100 : theme.neutral_900), | ||
]), | ||
]); | ||
}; | ||
let rightBtn = (state, theme: Theme.t, isDarkMode) => { | ||
style([ | ||
borderTopLeftRadius(`zero), | ||
borderBottomLeftRadius(`zero), | ||
color(state ? theme.neutral_900 : theme.neutral_100), | ||
backgroundColor(state ? theme.neutral_000 : theme.neutral_900), | ||
hover([ | ||
backgroundColor(state ? theme.neutral_100 : theme.neutral_900), | ||
color(state ? theme.neutral_900 : theme.neutral_100), | ||
]), | ||
]); | ||
}; | ||
}; | ||
|
||
|
||
type chainID = | ||
| WenchangTestnet | ||
| WenchangMainnet | ||
|
@@ -109,7 +141,7 @@ let getName = | |
| Unknown => "unknown"; | ||
|
||
[@react.component] | ||
let make = () => | ||
let make = (~dropdown=false) => | ||
{ | ||
let (show, setShow) = React.useState(_ => false); | ||
let trackingSub = TrackingSub.use(); | ||
|
@@ -118,7 +150,18 @@ let make = () => | |
let%Sub tracking = trackingSub; | ||
let currentChainID = tracking.chainID->parseChainID; | ||
|
||
<div | ||
let networkNames = [|LaoziMainnet, LaoziTestnet|] -> Belt.Array.map(chainID => chainID->getName); | ||
|
||
let isMainnet = (currentChainID->getName) == "laozi-mainnet" | ||
let handleToggle = (value) => { | ||
Js.log(value) | ||
Js.log(currentChainID->getName) | ||
if(!value && isMainnet){ | ||
ReasonReactRouter.push(LaoziMainnet |> getLink) | ||
} | ||
}; | ||
|
||
{dropdown ? <div | ||
className={Styles.version(theme, isDarkMode)} | ||
onClick={event => { | ||
setShow(oldVal => !oldVal); | ||
|
@@ -130,22 +173,43 @@ let make = () => | |
nowrap=true | ||
weight=Text.Semibold | ||
/> | ||
<HSpacing size=Spacing.sm /> | ||
{show | ||
? <Icon name="far fa-angle-up" color={theme.neutral_600} /> | ||
: <Icon name="far fa-angle-down" color={theme.neutral_600} />} | ||
<div className={Css.style([Css.paddingLeft(`px(4))])}> | ||
{show | ||
? <Icon name="far fa-angle-up" color={theme.neutral_900} /> | ||
: <Icon name="far fa-angle-down" color={theme.neutral_900} />} | ||
</div> | ||
<div className={Styles.dropdown(show, theme, isDarkMode)}> | ||
{[|LaoziMainnet, LaoziTestnet|] | ||
->Belt.Array.keep(chainID => chainID != currentChainID) | ||
->Belt.Array.map(chainID => { | ||
let name = chainID->getName; | ||
<AbsoluteLink href={getLink(chainID)} key=name className={Styles.link(theme)}> | ||
<Text value=name color={theme.neutral_600} nowrap=true weight=Text.Semibold /> | ||
<Text value=name color={theme.neutral_900} nowrap=true weight=Text.Semibold /> | ||
</AbsoluteLink>; | ||
}) | ||
->React.array} | ||
</div> | ||
</div> | ||
</div> : <div className={Css.merge([CssHelper.flexBox(), Styles.buttonContainer])}> | ||
<AbsoluteLink href={isMainnet ? "" : getLink(LaoziMainnet)} > | ||
<Button | ||
px=16 | ||
py=8 | ||
variant=Button.Outline | ||
style={Css.merge([Styles.baseBtn, Styles.leftBtn(isMainnet, theme, isDarkMode)])}> | ||
{networkNames[0] |> React.string} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -> |
||
</Button> | ||
</AbsoluteLink> | ||
<AbsoluteLink href={isMainnet ? getLink(LaoziTestnet) : ""} > | ||
<Button | ||
px=16 | ||
py=8 | ||
variant=Button.Outline | ||
style={Css.merge([Styles.baseBtn, Styles.rightBtn(isMainnet, theme, isDarkMode)])}> | ||
{networkNames[1] |> React.string} | ||
</Button> | ||
</AbsoluteLink> | ||
</div>} | ||
|
||
|> Sub.resolve; | ||
} | ||
|> Sub.default( | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->