-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add navigation with governance to voting page [LW-11519]
- Loading branch information
1 parent
e2ffb9a
commit 1bfbce4
Showing
8 changed files
with
137 additions
and
8 deletions.
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
16 changes: 16 additions & 0 deletions
16
source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.scss
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import '../votingConfig'; | ||
|
||
.component { | ||
flex: 1 0 0; | ||
padding: 20px; | ||
} | ||
|
||
.heading { | ||
@extend %accentText; | ||
font-family: var(--font-semibold); | ||
font-size: 18px; | ||
letter-spacing: 2px; | ||
margin-bottom: 14px; | ||
text-align: center; | ||
text-transform: uppercase; | ||
} |
25 changes: 25 additions & 0 deletions
25
source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import { injectIntl } from 'react-intl'; | ||
import BorderedBox from '../../widgets/BorderedBox'; | ||
import { messages } from '../voting-info/Headline.messages'; | ||
import styles from './VotingPowerDelegation.scss'; | ||
import type { Intl } from '../../../types/i18nTypes'; | ||
|
||
type Props = { | ||
intl: Intl; | ||
}; | ||
|
||
function VotingPowerDelegation({ intl }: Props) { | ||
return ( | ||
<div className={styles.component}> | ||
<BorderedBox> | ||
<h1 className={styles.heading}> | ||
{intl.formatMessage(messages.heading)} | ||
</h1> | ||
</BorderedBox> | ||
</div> | ||
); | ||
} | ||
|
||
export default observer(injectIntl(VotingPowerDelegation)); |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const VOTING_NAV_IDS = { | ||
REGISTRATION: 'registration', | ||
GOVERNANCE: 'governance', | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { Component } from 'react'; | ||
import { inject, observer } from 'mobx-react'; | ||
import Navigation, { type NavButtonProps } from '../../components/navigation/Navigation'; | ||
import type { InjectedContainerProps } from '../../types/injectedPropsType'; | ||
import MainLayout from '../MainLayout'; | ||
import { ROUTES } from '../../routes-config'; | ||
|
||
type Props = InjectedContainerProps; | ||
|
||
@inject('stores', 'actions') | ||
@observer | ||
export class Voting extends Component<Props> { | ||
|
||
static defaultProps = { | ||
actions: null, | ||
stores: null, | ||
}; | ||
|
||
render() { | ||
const { app } = this.props.stores; | ||
const navItems: Array<NavButtonProps> = [ | ||
{ | ||
id: ROUTES.VOTING.REGISTRATION, | ||
label: 'Registration', | ||
}, | ||
{ | ||
id: ROUTES.VOTING.GOVERNANCE, | ||
label: 'Governance', | ||
}, | ||
]; | ||
const activeItem = navItems.find((item) => app.currentRoute === item.id); | ||
return ( | ||
<MainLayout> | ||
<div style={{ height: '50px' }}> | ||
<Navigation | ||
items={navItems} | ||
activeItem={activeItem.label} | ||
isActiveNavItem={(navItemId: string) => navItemId === activeItem.id} | ||
onNavItemClick={(navItemId: string) => { | ||
this.props.actions.router.goToRoute.trigger({ | ||
route: navItemId | ||
}); | ||
}} | ||
/> | ||
</div> | ||
{this.props.children} | ||
</MainLayout> | ||
); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
source/renderer/app/containers/voting/VotingGovernancePage.tsx
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { Component } from 'react'; | ||
import { inject, observer } from 'mobx-react'; | ||
import type { InjectedProps } from '../../types/injectedPropsType'; | ||
import VotingPowerDelegation from '../../components/voting/voting-governance/VotingPowerDelegation'; | ||
|
||
type Props = InjectedProps; | ||
|
||
@inject('stores', 'actions') | ||
@observer | ||
class VotingGovernancePage extends Component<Props> { | ||
static defaultProps = { | ||
actions: null, | ||
stores: null, | ||
}; | ||
|
||
render() { | ||
return <VotingPowerDelegation />; | ||
} | ||
} | ||
|
||
export default VotingGovernancePage; |
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
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