Skip to content

Commit

Permalink
fix: get correct champion name.
Browse files Browse the repository at this point in the history
  • Loading branch information
cangzhang committed Apr 16, 2020
1 parent 0cce43a commit 85ce32b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import s from './app.module.scss';

import { ipcRenderer } from 'electron';
import _get from 'lodash/get';
import _findIdx from 'lodash/findIndex';

import React, { useReducer, useMemo, useRef, useEffect } from 'react';
import { HashRouter as Router, Switch, Route } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -50,8 +52,9 @@ const App = () => {
if (!lcuIns.active)
return false;

const { actions } = await lcuIns.getCurrentSession();
const championId = _get(actions, `0.0.championId`, 0);
const { actions, myTeam = []} = await lcuIns.getCurrentSession();
const pickIdx = _findIdx(myTeam, i => i.summonerId > 0);
const championId = _get(actions, `0.${pickIdx}.championId`, 0);

if (!championId) {
ipcRenderer.send(`hide-popup`);
Expand Down
1 change: 1 addition & 0 deletions src/modules/popup/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.list {
display: flex;
flex-direction: column;
background-color: #ffffff;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
'Helvetica Neue', sans-serif;
}
Expand Down

0 comments on commit 85ce32b

Please sign in to comment.