Skip to content

Commit

Permalink
Fix Rebase Removals
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaSat committed Sep 23, 2022
1 parent 55358d8 commit d6358ca
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 62 deletions.
120 changes: 60 additions & 60 deletions frontend/src/components/BottomBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import MediaQuery from 'react-responsive';
import Flags from 'country-flag-icons/react/3x2';
import { Link as LinkRouter } from 'react-router-dom';
import { apiClient } from '../services/api';
import RobotAvatar from './Robots/RobotAvatar';

// Icons
import BarChartIcon from '@mui/icons-material/BarChart';
Expand All @@ -32,9 +33,15 @@ import PriceChangeIcon from '@mui/icons-material/PriceChange';
// Missing flags
import { CataloniaFlag, BasqueCountryFlag } from './Icons';

import { CommunityDialog, ExchangeSummaryDialog, ProfileDialog, StatsDialog } from './Dialogs';

import {
CommunityDialog,
ExchangeSummaryDialog,
ProfileDialog,
StatsDialog,
UpdateClientDialog,
} from './Dialogs';
import { getCookie } from '../utils/cookies';
import checkVer from '../utils/checkVer';

class BottomBar extends Component {
constructor(props) {
Expand All @@ -44,6 +51,7 @@ class BottomBar extends Component {
openCommuniy: false,
openExchangeSummary: false,
openClaimRewards: false,
openUpdateClient: false,
num_public_buy_orders: 0,
num_public_sell_orders: 0,
book_liquidity: 0,
Expand Down Expand Up @@ -72,22 +80,28 @@ class BottomBar extends Component {

getInfo() {
this.setState(null);
apiClient.get('/api/info/').then(
(data) =>
this.setState(data) &
this.props.setAppState({
nickname: data.nickname,
loading: false,
activeOrderId: data.active_order_id ? data.active_order_id : null,
lastOrderId: data.last_order_id ? data.last_order_id : null,
referralCode: data.referral_code,
tgEnabled: data.tg_enabled,
tgBotName: data.tg_bot_name,
tgToken: data.tg_token,
earnedRewards: data.earned_rewards,
lastDayPremium: data.last_day_nonkyc_btc_premium,
}),
);
apiClient.get('/api/info/').then((data) => {
const versionInfo = checkVer(data.version.major, data.version.minor, data.version.patch);
this.setState({
...data,
openUpdateClient: versionInfo.updateAvailable,
coordinatorVersion: versionInfo.coordinatorVersion,
clientVersion: versionInfo.clientVersion,
});
this.props.setAppState({
nickname: data.nickname,
loading: false,
activeOrderId: data.active_order_id ? data.active_order_id : null,
lastOrderId: data.last_order_id ? data.last_order_id : null,
referralCode: data.referral_code,
tgEnabled: data.tg_enabled,
tgBotName: data.tg_bot_name,
tgToken: data.tg_token,
earnedRewards: data.earned_rewards,
lastDayPremium: data.last_day_nonkyc_btc_premium,
stealthInvoices: data.wants_stealth,
});
});
}

handleClickOpenStatsForNerds = () => {
Expand Down Expand Up @@ -191,27 +205,16 @@ class BottomBar extends Component {
}
>
<ListItemAvatar sx={{ width: 30 * fontSizeFactor, height: 30 * fontSizeFactor }}>
<Badge
badgeContent={
(this.props.activeOrderId > 0) & !this.props.profileShown ? '' : null
}
color='primary'
>
<Avatar
className='flippedSmallAvatar'
sx={{ margin: 0, top: -13 }}
alt={this.props.nickname}
imgProps={{
// FIXME: Avatar src not working
onLoad: () => this.props.setAppState({ avatarLoaded: true }),
}}
src={
this.props.nickname
? 'https://robosats.onion.moe/static/assets/avatars/' + this.props.nickname + '.png'
: null
<RobotAvatar
style={{ marginTop: -13 }}
statusColor={
(this.props.activeOrderId > 0) & !this.props.profileShown
? 'primary'
: undefined
}
nickname={this.props.nickname}
onLoad={() => this.props.setAppState({ avatarLoaded: true })}
/>
</Badge>
</ListItemAvatar>
</Tooltip>
<ListItemText primary={this.props.nickname} />
Expand Down Expand Up @@ -497,29 +500,17 @@ class BottomBar extends Component {
onClick={this.handleClickOpenProfile}
sx={{ margin: 0, bottom: 17, right: 8 }}
>
<Badge
badgeContent={
(this.state.active_order_id > 0) & !this.state.profileShown ? '' : null
<RobotAvatar
style={{ width: 55, height: 55 }}
avatarClass='phoneFlippedSmallAvatar'
statusColor={
(this.props.activeOrderId > 0) & !this.props.profileShown
? 'primary'
: undefined
}
color='primary'
>
<Avatar
className='phoneFlippedSmallAvatar'
sx={{ width: 55, height: 55 }}
alt={this.props.nickname}
imgProps={{
onLoad: () => this.props.setAppState({ avatarLoaded: true }),
}}
src={
this.props.nickname
? window.location.origin +
'/static/assets/avatars/' +
this.props.nickname +
'.png'
: null
}
/>
</Badge>
nickname={this.props.nickname}
onLoad={() => this.props.setAppState({ avatarLoaded: true })}
/>
</IconButton>
</Tooltip>
</div>
Expand Down Expand Up @@ -629,6 +620,13 @@ class BottomBar extends Component {
handleClickCloseCommunity={this.handleClickCloseCommunity}
/>

<UpdateClientDialog
open={this.state.openUpdateClient}
coordinatorVersion={this.state.coordinatorVersion}
clientVersion={this.state.clientVersion}
handleClickClose={() => this.setState({ openUpdateClient: false })}
/>

<ExchangeSummaryDialog
isOpen={this.state.openExchangeSummary}
handleClickCloseExchangeSummary={this.handleClickCloseExchangeSummary}
Expand Down Expand Up @@ -666,13 +664,15 @@ class BottomBar extends Component {
<StatsDialog
isOpen={this.state.openStatsForNerds}
handleClickCloseStatsForNerds={this.handleClickCloseStatsForNerds}
coordinatorVersion={this.state.coordinatorVersion}
clientVersion={this.state.clientVersion}
lndVersion={this.state.lnd_version}
network={this.state.network}
nodeAlias={this.state.node_alias}
nodeId={this.state.node_id}
alternativeName={this.state.alternative_name}
alternativeSite={this.state.alternative_site}
robosatsRunningCommitHash={this.state.robosats_running_commit_hash}
commitHash={this.state.robosats_running_commit_hash}
lastDayVolume={this.state.last_day_volume}
lifetimeVolume={this.state.lifetime_volume}
/>
Expand Down
31 changes: 29 additions & 2 deletions frontend/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,38 @@ const config: Configuration = {
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js'],
},
}
};

const configWeb: Configuration = {
...config,
output: {
path: path.resolve(__dirname, 'static/frontend'),
filename: 'main.js',
},
};

export default config;
const configMobile: Configuration = {
...config,
module: {
...config.module,
rules: [
...(config?.module?.rules || []),
{
test: path.resolve(__dirname, 'src/components/i18n.js'),
loader: 'file-replace-loader',
options: {
condition: 'if-replacement-exists',
replacement: path.resolve(__dirname, 'src/components/i18n.Native.js'),
async: true,
}
}
]
},
output: {
path: path.resolve(__dirname, '../mobile/html/Web.bundle/js'),
filename: 'main.js',
},
};

export default [configWeb, configMobile];

0 comments on commit d6358ca

Please sign in to comment.