Skip to content

Commit

Permalink
Add freecpu
Browse files Browse the repository at this point in the history
  • Loading branch information
dfstool committed Jan 27, 2024
1 parent 6edaf12 commit 4378575
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 19 deletions.
41 changes: 31 additions & 10 deletions app/modules/main/containers/Sections/Account/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next';
import compose from 'lodash/fp/compose';
import { withRouter } from 'react-router-dom';
import { Button, Container, Header, Icon, Segment } from 'semantic-ui-react';
import { Button, Container, Header, Icon, Segment, Checkbox } from 'semantic-ui-react';
import { Resources } from '@greymass/eosio-resources';
import AccountHeader from './Header';
import AccountOverviewRam from './Overview/Ram';
import AccountOverviewResource from './Overview/Resource';

import * as AccountsActions from '../../../../../shared/actions/accounts';
import * as NavigationActions from '../../../actions/navigation';
import * as DFSActions from '../../../../../shared/actions/dfs';

class AccountOverview extends Component<Props> {
constructor(props) {
Expand All @@ -22,13 +23,15 @@ class AccountOverview extends Component<Props> {
Object.keys(this.props.accounts).includes(account)
&& Object.keys(this.props.balances).includes(account)
);
const checked = this.props.dfs.smoothMode;
this.state = {
account,
expanded: {},
loaded,
sample: false,
rstate: false,
pstate: false,
checked
};
}
componentDidMount() {
Expand Down Expand Up @@ -113,6 +116,10 @@ class AccountOverview extends Component<Props> {
const { getAccount } = this.props.actions;
getAccount(this.state.account);
}
onChange = (event, data) => {
this.setState({checked: data.checked});
this.props.actions.switchSmoothMode(data.checked);
}
render() {
const {
system,
Expand All @@ -125,6 +132,7 @@ class AccountOverview extends Component<Props> {
sample,
pstate,
rstate,
checked
} = this.state;
if (!account || account === 'undefined') {
return (
Expand All @@ -142,15 +150,26 @@ class AccountOverview extends Component<Props> {
return (
<React.Fragment>
<Container fluid clearing={true}>
<Button
basic
color="grey"
content={t('main_sections_overview_button_one')}
floated="right"
icon="refresh"
loading={refreshing}
onClick={this.refresh}
/>
<div style={{float: "right"}}>
{connection.chain === 'DFS'?
<Checkbox
style={{marginRight: "20px"}}
toggle={true}
type="checkbox"
label={t('main_sections_overview_smooth_mode')}
onChange={this.onChange}
checked={checked}
/>: false
}
<Button
basic
color="grey"
content={t('main_sections_overview_button_one')}
icon="refresh"
loading={refreshing}
onClick={this.refresh}
/>
</div>
<Header
content={t('main_sections_overview_header_one')}
subheader={t('main_sections_overview_subheader_one')}
Expand Down Expand Up @@ -219,6 +238,7 @@ function mapStateToProps(state) {
resources: state.resources,
settings: state.settings,
system: state.system,
dfs: state.dfs,
};
}

Expand All @@ -227,6 +247,7 @@ function mapDispatchToProps(dispatch) {
actions: bindActionCreators({
...NavigationActions,
...AccountsActions,
...DFSActions,
}, dispatch)
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "anchor-wallet",
"productName": "DFS Anchor Wallet",
"version": "1.0.0",
"version": "1.1.0",
"description": "An Antelope Light Wallet with simple tools for basic activities and advanced tools for power users.",
"main": "./main.prod.js",
"author": {
Expand Down
1 change: 1 addition & 0 deletions app/renderer/assets/locales/en-US/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"main_sections_overview_resource_table_popup_three_content": "Tokens this account has staked previously which are now unstaking over the course of 3 days.",
"main_sections_overview_resource_table_popup_three_trigger": "Unstaking",
"main_sections_header_header_available": "Available",
"main_sections_overview_smooth_mode": "Smooth Mode",
"main_sections_overview_header_one": "Resource Overview",
"main_sections_overview_subheader_one": "Overview of resources for the selected account.",
"main_sections_overview_button_one": "Refresh",
Expand Down
133 changes: 133 additions & 0 deletions app/renderer/assets/locales/zh-CN/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"main_components_overview_sidebar_subheader": "EOSIO Signing Request",
"main_components_overview_sidebar_header": "App Integration",
"main_components_overview_sidebar_support_subheader": "Issues with Anchor?",
"main_components_overview_sidebar_support_header": "Ask Support",
"main_components_overview_sidebar_button": "Website",
"main_components_overview_sidebar_update_subheader": "Upgrade Available",
"main_components_overview_sidebar_modal_paragraph": "An update for Anchor is now available and information about this recent release is included below.",
"main_components_overview_sidebar_modal_paragraph_two": "For further information about this release, please visit our GitHub releases page.",
"main_components_overview_sidebar_modal_button": "View Update on GitHub",
"main_components_overview_sidebar_modal_action_header": "Would you like to automatically update?",
"main_components_overview_sidebar_modal_action_yes": "Yes",
"main_components_overview_sidebar_modal_action_no": "No",
"main_components_overview_sidebar_prompt_header": " App Integration",
"main_components_overview_sidebar_prompt_subheader": "EOSIO Signing Request",
"main_components_overview_sidebar_prompt_button_enable": "Enable",
"main_components_overview_sidebar_prompt_button_disable": "Disable",
"main_components_overview_table_total": "Total",
"main_components_overview_table_available": "Available",
"main_components_overview_table_staked": "Staked",
"main_components_overview_table_delegated": "Delegated",
"main_components_overview_table_refunding": "Refunding",
"main_components_overview_popup_one_content": "The strength of each vote, which is the sum of both staked CPU and NET of this account and any other account which has set this account as a proxy.",
"main_components_overview_popup_one_trigger": "Vote Weight",
"main_components_overview_popup_two_content": "The relative strength of the current vote against the strength of a vote cast today. The strength can be increased to 100%% simply by casting your vote again.",
"main_components_overview_table_votes": "Votes",
"main_components_overview_popup_three_content": "The proxy set by this account. The staked voting weight is transfered from the current account and given to the proxy.",
"main_components_overview_popup_three_trigger": "Proxy",
"main_components_overview_menu_item_one": "System Token",
"main_components_overview_menu_item_two": "Tokens",
"main_components_overview_menu_item_three": "Resources",
"main_components_overview_menu_item_four": "Governance",
"main_components_overview_no_token_balances": "No token balances being tracked",
"main_components_overview_table_header": "Accounts",
"main_components_overview_table_subheader": "Overview",
"main_navigation_wallet_menu_item_one": "Transfer Tokens",
"main_navigation_wallet_menu_item_two": "Stake Tokens",
"main_navigation_wallet_menu_item_three": "RAM Exchange",
"main_sections_overview_resource_allowed": "Allowed",
"main_sections_overview_resource_used": "Used",
"main_sections_overview_ram_subheader": "A <1>size-based</1> resource an account can use to <3>store data</3> within smart contracts.",
"main_sections_overview_ram_grid_subheader": "RAM Owned",
"main_sections_overview_ram_table_cell_one": "Value",
"main_sections_overview_ram_table_cell_two": "RAM Price",
"main_sections_overview_resource_grid_subheader_one": "A <1>time-based</1> resource an account uses while <3>performing</3> smart contract actions.",
"main_sections_overview_resource_grid_subheader_two": "A <1>size-based</1> resource an account uses while <3>sending data</3> to the blockchain.",
"main_sections_overview_resource_grid_subheader_three_available": "{{resource}} Available",
"main_sections_overview_resource_grid_subheader_three_used": "{{resource}} Used",
"main_sections_overview_resource_grid_subheader_four": "Staked to {{resource}}",
"main_sections_overview_resource_table_popup_one_content": "Tokens this account has staked to itself that can be unstaked.",
"main_sections_overview_resource_table_popup_one_trigger": "Staked Tokens",
"main_sections_overview_resource_table_popup_two_content": "Includes delegated tokens from other accounts and rentals from REX.",
"main_sections_overview_resource_table_popup_two_trigger": "Other Tokens",
"main_sections_overview_resource_table_popup_three_content": "Tokens this account has staked previously which are now unstaking over the course of 3 days.",
"main_sections_overview_resource_table_popup_three_trigger": "Unstaking",
"main_sections_header_header_available": "Available",
"main_sections_overview_smooth_mode": "顺畅模式",
"main_sections_overview_header_one": "Resource Overview",
"main_sections_overview_subheader_one": "Overview of resources for the selected account.",
"main_sections_overview_button_one": "Refresh",
"main_sections_overview_header_two": "Loading Account Data...",
"main_sections_overview_subheader_two": "The data for this account is being fetched from an API server.",
"main_sections_overview_system_tokens_header": "System Token: {{chainSymbol}}",
"main_sections_overview_system_tokens_subheader": "The native resource token for this blockchain.",
"main_sections_governance_disabled_header": "Governance not available on this chain.",
"main_sections_header_subheader_one": "Status",
"main_sections_header_subheader_two": "Available",
"main_sections_home_initialize_paragraph_one": "Antelope Wallet and Authenticator",
"main_sections_home_initialize_button_one": "Setup an Account",
"main_sections_home_initialize_card_description_one": "Do you have an Anchor backup?",
"main_sections_home_initialize_card_content_one": "Advanced Options...",
"main_sections_home_signing_request_prompt_header_one": "Allow Anchor to integrate with apps?",
"main_sections_home_signing_request_prompt_paragraph_one": "Enabling app integrations will allow you to sign in to any supported application using this desktop Anchor wallet.",
"main_sections_home_signing_request_prompt_paragraph_two": "This can be toggled on or off from the sidebar on the Home screen at any time.",
"main_sections_home_signing_request_prompt_button_one": "No, remain disabled",
"main_sections_home_signing_request_prompt_button_two": "Yes, enable app integrations",
"main_sections_home_upgrade_subheader_one": "Wallet Storage",
"main_sections_home_upgrade_header_one": "Upgrading",
"main_sections_home_upgrade_header_two": "Wallet Storage - Upgrade Required",
"main_sections_home_upgrade_subheader_two": "The following wallets need to be upgraded before they can be accessed. Click the button below and enter your Anchor Password to complete this process.",
"main_sections_home_upgrade_button_one": "Upgrade Wallet Storage",
"main_sections_home_upgrade_table_cell_one": "\"{{walletMode}}\" wallet storage - upgrade required",
"main_sections_overview_sidebar_backup_subheader": "Last Backup",
"main_sections_overview_sidebar_backup_header_never": "Never",
"main_sections_overview_sidebar_backup_button": "Backup",
"main_sections_overview_sidebar_header": "App Status",
"main_sections_overview_sidebar_subheader": "Important information and events for your Anchor wallet.",
"main_sections_tools_display_header_one": "Anchor Display Properties",
"main_sections_tools_display_header_two": "Window Settings",
"main_sections_tools_display_button": "Reset Window Size",
"main_sections_tools_home_paragraph_one": "This feature requires a one of the following types of wallets:",
"main_sections_tools_home_paragraph_two": "Select a compatible wallet to continue.",
"main_sections_wallet_ram_subheader": "Buy or Sell RAM into the automated market.",
"main_sections_wallet_ram_header": "RAM Trading",
"main_sections_wallet_transfer_button_refresh": "Load All Balances",
"main_sections_wallet_transfer_header": "Transfer Tokens",
"main_sections_wallet_transfer_subheader": "Send tokens to another account, an exchange, or one of your contacts.",
"main_sections_wallet_transfer_select": "Select an account",
"main_sections_wallet_transfer_grid_header_one": "Selected Account",
"main_sections_wallet_transfer_grid_subheader_one": "The currently selected account will be used to perform the transfer.",
"main_sections_wallet_transfer_grid_header_two": "Tracked Balances",
"main_sections_wallet_transfer_grid_subheader_two": "Click the button to load any additional tracked token balances. Manage Tracked Tokens in the Tools section.",
"main_sections_wallet_transfer_table_cell": "No available balances being tracked.",
"main_sections_disabled_segment": "This section is not yet enabled.",
"main_content_error_paragraph_one": "If this involved issuing a transaction on a blockchain, that action may have still processed successfully - so before trying again, please check your account history to verify whether or not the last operation succeeded.",
"main_content_error_paragraph_two": "To report this bug to the Anchor team, please use the Help > Report Bug feature and let us know the contents of the error message below.",
"main_content_error_button":"Reload Anchor",
"main_content_error_header": "Anchor has encountered an error",
"main_content_error_label": "Error Message",
"main_sections_wallet_stake_header": "Stake Tokens",
"main_sections_wallet_stake_subheader": "Staking grants the accounts rights to resources on the network.",
"main_sections_wallet_stake_transaction_title": "Update Staked",
"main_sections_overview_header": "System Token: {{chainSymbol}}",
"main_sections_overview_subheader": "The native resource token for this blockchain.",
"main_sections_overview_balances_header": "Tracked Tokens",
"main_sections_overview_balances_subheader": "The balances of the tracked token you have selected. Click the 'Load All Balances' button to load the balances for each token on each account.",
"main_sections_overview_governance_header": "Governance Statistics",
"main_sections_overview_governance_subheader": "A breakdown of all loaded accounts and their involvement in governance.",
"main_sections_overview_resources_header": "Resource Usage",
"main_sections_overview_resources_subheader": "The resource usage breakdown for all loaded accounts on this blockchain.",
"main_sections_overview_grid_header": "Account(s) Overview",
"main_sections_overview_grid_subheader": "Overview of accounts for this blockchain.",
"main_sections_overview_container_button": "Manage Wallets",
"main_sections_overview_container_button_accounts": "Refresh All Accounts",
"main_sections_overview_container_button_tokens": "Manage Tracked Tokens",
"main_sections_overview_ram_buy_button": "Purchase",
"main_sections_overview_ram_sell_button": "Sell",
"main_sections_overview_resource_button_add": "Stake",
"main_sections_overview_resource_button_remove": "Unstake",
"main_sections_overview_resource_button_rent": "Rent",
"main_sections_overview_resource_button_rent_powerup": "Rent via PowerUp (1 day)",
"main_sections_overview_resource_button_rent_rex": "Rent via REX (30 days)"
}
14 changes: 12 additions & 2 deletions app/shared/actions/dfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function getVote(account) {
return (dispatch, getState) => {
const { dfs } = getState();
let sumDFS = new BigNumber(0);
let liqs = dfs.liqs[account];
let liqs = dfs.liqs[account]? dfs.liqs[account]: [];
let markets = dfs.markets;
let market = '';
let vote = '';
Expand Down Expand Up @@ -225,13 +225,23 @@ export function voteProducers(producers = [], proxy = '') {
};
}

export function switchSmoothMode(mode) {
return (dispatch, getState) => {
dispatch({
type: types.DFS_SWITCH_SMOOTH_MODE,
payload: { mode }
});
};
}

export default {
syncDFS,
getVoter,
getVoters,
getLiq,
getLiqs,
getVotes,
voteProducers
voteProducers,
switchSmoothMode,

};
2 changes: 2 additions & 0 deletions app/shared/actions/typesDFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ export const DFS_GET_VOTE_PENDING = 'DFS_GET_VOTE_PENDING';
export const DFS_GET_VOTE_SUCCESS = 'DFS_GET_VOTE_SUCCESS';
export const DFS_GET_VOTE_FAILURE = 'DFS_GET_VOTE_FAILURE';

export const DFS_SWITCH_SMOOTH_MODE = 'DFS_SWITCH_SMOOTH_MODE';

7 changes: 6 additions & 1 deletion app/shared/reducers/dfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const initialState = {
voters: {},
liqs: {},
markets: [],
votes: {}
votes: {},
smoothMode: true
};

export default function dfs(state = initialState, action) {
Expand Down Expand Up @@ -44,6 +45,10 @@ export default function dfs(state = initialState, action) {
return set(state, `votes.${action.payload.account}`, action.payload.data)
}

case types.DFS_SWITCH_SMOOTH_MODE: {
return set(state, `smoothMode`, action.payload.mode)
}


default: {
return state;
Expand Down
1 change: 1 addition & 0 deletions app/shared/store/shared/persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const persistConfig = {
'storage',
'wallet',
'wallets',
'dfs'
]
};

Expand Down
Loading

0 comments on commit 4378575

Please sign in to comment.