-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from ZeusLN/master
v0.1.0-beta
- Loading branch information
Showing
34 changed files
with
2,373 additions
and
314 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# These are supported funding model platforms | ||
|
||
github: kaloudis | ||
bitcoin: https://blockstream.info/address/3Lbz4vdt15Fsa4wVD3Yk8uGf6ugKKY4zSc |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-minimal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* Original FeeTable code by Felix Weis - WhatTheFee.io | ||
* https://whatthefee.io/static/js/FeeTable.js | ||
* | ||
* Converted to ReactNative + TypeScript by Evan Kaloudis for Zeus | ||
*/ | ||
import * as React from 'react'; | ||
import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native'; | ||
import { Button } from 'react-native-elements'; | ||
import FeeUtils from './../utils/FeeUtils'; | ||
import { Cell, Header, Row } from 'react-native-data-table'; | ||
import { isEmpty } from 'lodash'; | ||
import { inject, observer } from 'mobx-react'; | ||
|
||
import FeeStore from './../stores/FeeStore'; | ||
import SettingsStore from './../stores/SettingsStore'; | ||
|
||
interface FeeTableProps { | ||
SettingsStore: SettingsStore; | ||
FeeStore: FeeStore; | ||
setFee: (value: string) => void; | ||
} | ||
|
||
interface FeeTableState { | ||
collapsed: boolean; | ||
} | ||
|
||
@inject('SettingsStore', 'FeeStore') | ||
@observer | ||
export default class FeeTable extends React.Component<FeeTableProps, FeeTableState> { | ||
state = { | ||
collapsed: true | ||
} | ||
|
||
styler(x: number|string) { | ||
if(x == null || typeof x === 'string') { | ||
return { | ||
"backgroundColor": "white", | ||
"alignItems": "center", | ||
"height": 53, | ||
"width": 53 | ||
} | ||
}; | ||
|
||
const c: any = FeeUtils.gcolor(x/800); | ||
|
||
return { | ||
"backgroundColor": `hsl(${c[0]}, ${c[1]*100}%, ${c[2]*100}%)`, | ||
"alignItems": "center", | ||
"height": 53, | ||
"width": 53 | ||
}; | ||
} | ||
|
||
repr = (x: number) => Math.exp(x / 100).toFixed(1); | ||
|
||
reprColumn = (x: number) => (x * 100).toFixed(0) + '%'; | ||
|
||
reprIndex = (x: number) => x / 6 + 'h'; | ||
|
||
openTable = () => { | ||
this.props.FeeStore.getFees(); | ||
|
||
this.setState({ | ||
collapsed: false | ||
}); | ||
} | ||
|
||
closeTable = () => { | ||
this.setState({ | ||
collapsed: true | ||
}); | ||
} | ||
|
||
render() { | ||
const { collapsed } = this.state; | ||
const { FeeStore, SettingsStore, setFee } = this.props; | ||
const { dataFrame, loading } = FeeStore; | ||
const { settings } = SettingsStore; | ||
const { theme } = settings; | ||
|
||
const df = dataFrame; | ||
let headers: any; | ||
let rows: any; | ||
|
||
if (!isEmpty(df) && !loading) { | ||
headers = df.columns && df.columns.map((columnName: number, index: number) => | ||
<Cell style={{ backgroundColor: theme === 'dark' ? 'black' : 'white', minWidth: 53, height: 53 }} textStyle={{ color: theme === 'dark' ? 'white' : 'black' }} key={`item-${index}`}>{this.reprColumn(columnName)}</Cell> | ||
); | ||
|
||
rows = df.index.map((index: number, i: number) => { | ||
const cells = df.data[i].map((cell: any, k: number) => { | ||
const value = this.repr(cell); | ||
return ( | ||
<TouchableOpacity key={`cell-${k}`} onPress={() => setFee(value)}><Cell style={this.styler(cell)}><Text style={{ color: 'white' }}>{value}</Text></Cell></TouchableOpacity> | ||
); | ||
}); | ||
|
||
const indexText = this.reprIndex(index); | ||
|
||
return ( | ||
<Row key={`row-${i}`}> | ||
<Cell style={this.styler(indexText)}><Text style={{ backgroundColor: theme === 'dark' ? 'black' : 'white', color: theme === 'dark' ? 'white' : 'black', width: 100 }}>{indexText}</Text></Cell> | ||
{cells} | ||
</Row> | ||
); | ||
}); | ||
} | ||
|
||
return ( | ||
<View style={{ flex: 1 }}> | ||
<Button | ||
title={collapsed ? "What the Fee?" : "Hide Fee Table"} | ||
icon={{ | ||
name: "view-module", | ||
size: 25, | ||
color: theme === 'dark' ? 'black' : 'white' | ||
}} | ||
containerStyle={{ | ||
marginBottom: 20, | ||
width: 200, | ||
alignSelf: "center" | ||
}} | ||
buttonStyle={{ | ||
backgroundColor: theme === 'dark' ? 'white' : 'black', | ||
borderRadius: 30 | ||
}} | ||
titleStyle={{ | ||
color: theme === 'dark' ? 'black' : 'white' | ||
}} | ||
onPress={() => collapsed ? this.openTable() : this.closeTable()} | ||
/> | ||
{!collapsed && loading && <ActivityIndicator size="large" color="#0000ff" />} | ||
{!collapsed && !loading && headers && <View style={{ left: 25 }}> | ||
<Header style={{ backgroundColor: 'white', left: 15 }} textStyle={{ alignItems: 'center' }}> | ||
{headers} | ||
</Header> | ||
{rows} | ||
</View>} | ||
</View> | ||
); | ||
} | ||
} |
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
Oops, something went wrong.