Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
condenser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
condenser
Commits
ffcb6b43
Commit
ffcb6b43
authored
8 years ago
by
Tim
Browse files
Options
Downloads
Patches
Plain Diff
chain state concept #234
parent
74a3838d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/modules/Header.jsx
+15
-2
15 additions, 2 deletions
app/components/modules/Header.jsx
app/redux/PollDataSaga.js
+1
-0
1 addition, 0 deletions
app/redux/PollDataSaga.js
with
16 additions
and
2 deletions
app/components/modules/Header.jsx
+
15
−
2
View file @
ffcb6b43
...
@@ -17,7 +17,9 @@ function sortOrderToLink(so, topic, account) {
...
@@ -17,7 +17,9 @@ function sortOrderToLink(so, topic, account) {
class
Header
extends
React
.
Component
{
class
Header
extends
React
.
Component
{
static
propTypes
=
{
static
propTypes
=
{
location
:
React
.
PropTypes
.
object
.
isRequired
,
location
:
React
.
PropTypes
.
object
.
isRequired
,
current_account_name
:
React
.
PropTypes
.
string
current_account_name
:
React
.
PropTypes
.
string
,
chain_participation
:
React
.
PropTypes
.
number
,
chain_time
:
React
.
PropTypes
.
string
};
};
constructor
()
{
constructor
()
{
...
@@ -182,6 +184,13 @@ class Header extends React.Component {
...
@@ -182,6 +184,13 @@ class Header extends React.Component {
];
];
sort_order_extra_menu
=
<
HorizontalMenu
items
=
{
items
}
/>
sort_order_extra_menu
=
<
HorizontalMenu
items
=
{
items
}
/>
}
}
let
warning
;
const
participation_rate
=
Math
.
round
(
100.0
*
this
.
props
.
chain_participation
/
128.0
,
2
)
const
head_block_age
=
(((
new
Date
())
-
(
new
Date
(
this
.
props
.
chain_time
)))
/
1000
)
warning
=
"
Participation:
"
+
participation_rate
+
"
% -- head block age:
"
+
head_block_age
+
"
s
"
return
(
return
(
<
header
className
=
"Header noPrint"
>
<
header
className
=
"Header noPrint"
>
<
div
className
=
"Header__top header"
>
<
div
className
=
"Header__top header"
>
...
@@ -207,6 +216,7 @@ class Header extends React.Component {
...
@@ -207,6 +216,7 @@ class Header extends React.Component {
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
warning
&&
<
div
className
=
"Header__chain-state-warning"
>
{
warning
}
</
div
>
}
<
div
className
=
{
'
Header__sub-nav expanded show-for-medium row
'
+
(
this
.
state
.
subheader_hidden
?
'
hidden
'
:
''
)
}
>
<
div
className
=
{
'
Header__sub-nav expanded show-for-medium row
'
+
(
this
.
state
.
subheader_hidden
?
'
hidden
'
:
''
)
}
>
<
div
className
=
"columns"
>
<
div
className
=
"columns"
>
<
HorizontalMenu
items
=
{
sort_order_menu_horizontal
}
/>
<
HorizontalMenu
items
=
{
sort_order_menu_horizontal
}
/>
...
@@ -226,9 +236,12 @@ export default connect(
...
@@ -226,9 +236,12 @@ export default connect(
state
=>
{
state
=>
{
const
current_user
=
state
.
user
.
get
(
'
current
'
);
const
current_user
=
state
.
user
.
get
(
'
current
'
);
const
current_account_name
=
current_user
?
current_user
.
get
(
'
username
'
)
:
state
.
offchain
.
get
(
'
account
'
);
const
current_account_name
=
current_user
?
current_user
.
get
(
'
username
'
)
:
state
.
offchain
.
get
(
'
account
'
);
const
{
participation_count
,
time
}
=
state
.
global
.
get
(
'
props
'
).
toJS
()
return
{
return
{
location
:
state
.
app
.
get
(
'
location
'
),
location
:
state
.
app
.
get
(
'
location
'
),
current_account_name
current_account_name
,
chain_participation
:
participation_count
,
chain_time
:
time
}
}
}
}
)(
Header
);
)(
Header
);
This diff is collapsed.
Click to expand it.
app/redux/PollDataSaga.js
+
1
−
0
View file @
ffcb6b43
...
@@ -29,6 +29,7 @@ function* pollData() {
...
@@ -29,6 +29,7 @@ function* pollData() {
// console.log('-- pollData.pollData -->', data);
// console.log('-- pollData.pollData -->', data);
// const data = yield call([db_api, db_api.exec], 'get_discussions_by_created', [{limit: 10}]);
// const data = yield call([db_api, db_api.exec], 'get_discussions_by_created', [{limit: 10}]);
// yield put(GlobalReducer.actions.receiveRecentPosts({data}));
// yield put(GlobalReducer.actions.receiveRecentPosts({data}));
yield
put
(
GlobalReducer
.
actions
.
update
({
key
:
[
'
props
'
],
updater
:
(
m
)
=>
m
.
merge
(
data
)}));
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
~~ pollData saga error ~~>
'
,
error
);
console
.
error
(
'
~~ pollData saga error ~~>
'
,
error
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment