Skip to content

Commit

Permalink
Updated: Removed console logs from production. fix: #37
Browse files Browse the repository at this point in the history
  • Loading branch information
frugge committed Oct 18, 2019
1 parent 38e35d9 commit 89ba38d
Show file tree
Hide file tree
Showing 55 changed files with 255 additions and 214 deletions.
2 changes: 1 addition & 1 deletion src/api/Arbitration.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class ArbitrationContract {
*/
async sign() {
const instance = await this.contract.deployed();
console.log("handleAcceptArbitration - Arbitration instance", instance);
log("handleAcceptArbitration - Arbitration instance", instance);
const [account] = await this.web3.eth.getAccounts();
return instance.sign({ from: account });
}
Expand Down
4 changes: 3 additions & 1 deletion src/api/ArbitrationMock.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import contract from "truffle-contract";
import ArbitrationMockABI from "../build/contracts/ArbitrationMock.json";

import { log } from "../utils/helpers";

let arbitrationMockSCInstance = null;

export default class ArbitrationMock {
constructor(address) {

console.log("ArbitrationMock – Contract", global.drizzle.contracts[address])
log("ArbitrationMock – Contract", global.drizzle.contracts[address])

if (!arbitrationMockSCInstance) {
arbitrationMockSCInstance = this;
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/AppProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React, { Component } from "react";
import appReference from "../../package.json"; // config
import i18n from "../assets/i18n/en/labels.json"; // i18n

import { log } from "../utils/helpers";

// Comet
import Comet from "../hooks/Comet";
import { SET_LOADING, APP_EXIT } from "../reducers/types.js";
Expand Down Expand Up @@ -89,12 +91,12 @@ class AppProvider extends Component {
Comet.auth(
(customProvider) => {
// success
console.log("AppProvider", "store should be updated");
log("AppProvider", "store should be updated");
this.setState({ onNetwork: true, customProvider });
},
() => {
// error
console.log("AppProvider", "network connection error!");
log("AppProvider", "network connection error!");
this.setState({ cometLoading: false });
this.store.dispatch({ type: SET_LOADING, payload: false });
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/auth/Unlock/Unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const Unlock = () => {
if (typeof window.web3 === "object") {
// TODO: check based on _metamask itself
const { currentProvider: { _comet } } = window.web3
// console.log('UnderAuth - _metamask.isEnabled()', _metamask.isEnabled());
// console.log('UnderAuth - _metamask.isApproved()', _metamask.isApproved());
// console.log('UnderAuth - _metamask.isUnlocked()', _metamask.isUnlocked());
// log('UnderAuth - _metamask.isEnabled()', _metamask.isEnabled());
// log('UnderAuth - _metamask.isApproved()', _metamask.isApproved());
// log('UnderAuth - _metamask.isUnlocked()', _metamask.isUnlocked());
shouldUnlock = typeof _comet !== 'undefined';
}

Expand Down
36 changes: 19 additions & 17 deletions src/components/chain/ActionsBar/ActionsBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
GET_NOW
} from "../../../reducers/types";

import { log } from "../../../utils/helpers";

export const ActionsBar = props => {
const { wallet, contract, isDispute, dispute } = props;
const { balance } = wallet;
Expand All @@ -40,10 +42,10 @@ export const ActionsBar = props => {
currentContractAddress = contract.address;
}

console.log("ActionsBar", {currentContractAddress, id});
log("ActionsBar", {currentContractAddress, id});

const createArbitration = () => {
console.log("createArbitration - call");
log("createArbitration - call");
global.drizzle.store.dispatch({
type: CHAIN_CREATE_ARBITRATION
});
Expand All @@ -52,7 +54,7 @@ export const ActionsBar = props => {
const approveToken = (amount) => {
const contractAddress = currentContractAddress;

console.log("approveToken - call on contract", [contractAddress, currentContractAddress]);
log("approveToken - call on contract", [contractAddress, currentContractAddress]);
amount = amount * 1000000000000000000; // 18 decimals

global.drizzle.store.dispatch({
Expand All @@ -63,7 +65,7 @@ export const ActionsBar = props => {
};

const acceptArbitration = (amount) => {
console.log('acceptArbitration');
log('acceptArbitration');
const contractAddress = currentContractAddress;
amount = amount * 1000000000000000000; // 18 decimals

Expand All @@ -78,7 +80,7 @@ export const ActionsBar = props => {
}

const rejectArbitration = () => {
console.log("rejectArbitration - call");
log("rejectArbitration - call");
const contractAddress = currentContractAddress;
global.drizzle.store.dispatch({
type: REJECT_ARBITRATION,
Expand All @@ -89,15 +91,15 @@ export const ActionsBar = props => {
};

const signArbitration = () => {
console.log("signArbitration - call");
log("signArbitration - call");
global.drizzle.store.dispatch({
type: CHAIN_SIGN_ARBITRATION,
contractAddress: currentContractAddress
});
};

const agreeArbitration = () => {
console.log("agreeArbitration - call");
log("agreeArbitration - call");

global.drizzle.store.dispatch({
type: CHAIN_AGREE_ARBITRATION,
Expand All @@ -106,23 +108,23 @@ export const ActionsBar = props => {
};

const withdrawFromArbitration = () => {
console.log("withdrawFromArbitration - call");
log("withdrawFromArbitration - call");
global.drizzle.store.dispatch({
type: CHAIN_WITHDRAW_DISPERSAL_ARBITRATION,
contractAddress: currentContractAddress
});
};

const onDispute = () => {
console.log("Dispute - call");
log("Dispute - call");
global.drizzle.store.dispatch({
type: DISPUTE_ARBITRATION,
contractAddress: currentContractAddress
});
}

const disputeArbitration = (amount) => {
console.log("approveAndDispute - call");
log("approveAndDispute - call");
global.drizzle.store.dispatch({
type: DISPUTE_ARBITRATION,
contractAddress: currentContractAddress,
Expand All @@ -131,53 +133,53 @@ export const ActionsBar = props => {
}

const calcDisputeEnds = () => {
console.log("calcDisputeEnds - call");
log("calcDisputeEnds - call");
global.drizzle.store.dispatch({
type: CALC_DISPUTE_ENDS_ARBITRATION,
contractAddress: currentContractAddress
});
}

const totalVotes = () => {
console.log("calcDisputeEnds - call");
log("calcDisputeEnds - call");
global.drizzle.store.dispatch({
type: TOTAL_VOTES_ARBITRATION,
contractAddress: currentContractAddress
});
}

const disputeWindowVotes = () => {
console.log("calcDisputeEnds - call");
log("calcDisputeEnds - call");
global.drizzle.store.dispatch({
type: DISPUTE_WINDOW_VOTES_ARBITRATION,
contractAddress: currentContractAddress
});
}

const disputeStarts = () => {
console.log("disputeStarts - call");
log("disputeStarts - call");
global.drizzle.store.dispatch({
type: DISPUTE_STARTS_ARBITRATION,
contractAddress: currentContractAddress
});
}
const disputeEnds = () => {
console.log("disputeEnds - call");
log("disputeEnds - call");
global.drizzle.store.dispatch({
type: DISPUTE_ENDS_ARBITRATION,
contractAddress: currentContractAddress
});
}

const setMockedNow = () => {
console.log("setMockedNow - call");
log("setMockedNow - call");
global.drizzle.store.dispatch({
type: SET_MOCKED_NOW,
contractAddress: currentContractAddress
});
}
const getNow = () => {
console.log("getNow - call");
log("getNow - call");
global.drizzle.store.dispatch({
type: GET_NOW,
contractAddress: currentContractAddress
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/ContractActions/ContractActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import React, {useContext} from "react";
import { AppContext } from "../../../bootstrap/AppProvider"; // context

import "./ContractActions.scss";
import { log } from "../../../utils/helpers";

export const ContractActions = ( props ) => {
const { children, statusId, statusFrom, currentWallet, part, disabled } = props;
const { labels } = useContext(AppContext);
console.log("ContractActions - props", { children, statusId, part });
log("ContractActions - props", { children, statusId, part });
const renderSwitch = () => {
switch (statusId) {
case -1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ storiesOf("ContractDetailsPreview", module)
name: "hello.pdf"
}
],
onContractNameChange: (ev) => console.log(ev.target.value),
onProgress: percentage => console.log(percentage),
onExpire: (ev) => console.log(ev.target.value)
onContractNameChange: (ev) => log(ev.target.value),
onProgress: percentage => log(percentage),
onExpire: (ev) => log(ev.target.value)
}}
onDelete={(ev) => console.log("dilghf")}
onView={(ev) => console.log("dilghf")}
onDelete={(ev) => log("dilghf")}
onView={(ev) => log("dilghf")}
/>
));
2 changes: 1 addition & 1 deletion src/components/common/ContractName/ContractName.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ storiesOf("ContractName", module)
.add("Default", () => (
<ContractName
contractName="Contract name"
onContractNameChange={(ev) => console.log(ev.target.value)}
onContractNameChange={(ev) => log(ev.target.value)}
statusId={0}
statusIdLabel="Draft"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ storiesOf("ContractSelectCategory", module)
}
})
.add("Default", () => (
<ContractSelectCategory onChange={(ev) => console.log(ev)} hasError={() => null} />
<ContractSelectCategory onChange={(ev) => log(ev)} hasError={() => null} />
));
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ storiesOf("ContractSetCaseDispute", module)
id: 2
}
]}
handleChange={(selectedOptionId) => console.log(selectedOptionId)}
handleChange={(selectedOptionId) => log(selectedOptionId)}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ storiesOf("ContractSetDuration", module)
}
})
.add("Default", () => (
<ContractSetDuration onChange={(value) => console.log(value)} hasError={() => null} contract={{duration:{days:4,hours:6,minutes:45}}} />
<ContractSetDuration onChange={(value) => log(value)} hasError={() => null} contract={{duration:{days:4,hours:6,minutes:45}}} />
));
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BlockTitle from "../BlockTitle";
import Switch from "../Switch";
import PriceRange from "../PriceRange";

import { ethToStore } from "../../../utils/helpers"; // helpers
import { ethToStore, log } from "../../../utils/helpers"; // helpers

import "./ContractSetPenaltyFee.scss";
import { AppContext } from "../../../bootstrap/AppProvider"; // context
Expand All @@ -21,7 +21,7 @@ export const ContractSetPenaltyFee = ( props ) => {
const [isActive, setActive] = useState(!!contract.penaltyFee);

const onPriceChange = (counterparty, fee) => {
console.log("setPenaltyFee", counterparty, fee);
log("setPenaltyFee", counterparty, fee);
setPenaltyFee(counterparty, fee);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ storiesOf("ContractSetPenaltyFee", module)
},
penaltyFee: null
}}
setPenaltyFeeStatus={(value) => console.log(value)}
ContractSetPenaltyFee={(value) => console.log(value)}
setPenaltyFeeStatus={(value) => log(value)}
ContractSetPenaltyFee={(value) => log(value)}
/>
))
.add("Width Penalty fee", () => (
Expand All @@ -58,7 +58,7 @@ storiesOf("ContractSetPenaltyFee", module)
partB: 32345
}
}}
setPenaltyFeeStatus={(value) => console.log(value)}
ContractSetPenaltyFee={(value) => console.log(value)}
setPenaltyFeeStatus={(value) => log(value)}
ContractSetPenaltyFee={(value) => log(value)}
/>
));
12 changes: 6 additions & 6 deletions src/components/common/ContractSetValue/ContractSetValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext } from "react";

import WhoPays from "../WhoPays";
import ContractSetPenaltyFee from "../ContractSetPenaltyFee";
import { toCurrencyFormat, ellipsisString } from "../../../utils/helpers";
import { toCurrencyFormat, ellipsisString, log } from "../../../utils/helpers";

import "./ContractSetValue.scss";
import { AppContext } from "../../../bootstrap/AppProvider"; // context
Expand All @@ -12,7 +12,7 @@ export const ContractSetValue = (props) => {
const { contract } = props;

const setPenaltyFeeStatus = (value) => {
console.log(value);
log(value);

props.onChange("hasPenaltyFee", value);
};
Expand All @@ -27,14 +27,14 @@ export const ContractSetValue = (props) => {
// return { contract };
// });

console.log(`setPenaltyFee - counterparty`, counterparty);
console.log(`setPenaltyFee - fee`, fee);
console.log(`setPenaltyFee - ${counterparty.label}PenaltyFee`, fee);
log(`setPenaltyFee - counterparty`, counterparty);
log(`setPenaltyFee - fee`, fee);
log(`setPenaltyFee - ${counterparty.label}PenaltyFee`, fee);
props.onChange(`${counterparty.label}PenaltyFee`, fee);
};

const handleSelectPayer = payer => {
console.log("handleSelectPayer", payer);
log("handleSelectPayer", payer);

// props.onChange("value", payer.value);
props.onChange("whoPays", payer.counterParty.wallet.toLowerCase());
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/ContractSidebar/ContractSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export const ContractSidebar = ({

useEffect(() => {

console.log('ContractSidebar - Mount');
log('ContractSidebar - Mount');
global.drizzle.store.dispatch({
type: CONTRACT_DETAIL_PAGE,
payload: true
});

return () => {
console.log('ContractSidebar - Unmount');
log('ContractSidebar - Unmount');
global.drizzle.store.dispatch({
type: CONTRACT_DETAIL_PAGE,
payload: false
Expand Down Expand Up @@ -347,7 +347,7 @@ export const ContractSidebar = ({
cases={cases}
disabled={disabled}
selectedOptionId={selectedOptionId}
handleChange={(selectedOptionId) => console.log(selectedOptionId)}
handleChange={(selectedOptionId) => log(selectedOptionId)}
/>
</>
)}
Expand Down
Loading

0 comments on commit 89ba38d

Please sign in to comment.