Skip to content

Commit

Permalink
chore(dcellar-web-ui): remove redundant codes
Browse files Browse the repository at this point in the history
  • Loading branch information
devinxl committed Oct 10, 2024
1 parent 48c9d98 commit 5bafce2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const RenewalNotification = ({ address }: RenewalNotificationProps) => {
for (const _account of accounts) {
const item = accountInfos[_account];

// item.id === '' means the account is not belong to loginAccount
if (!item || closeRenewalAddresses.includes(item.address)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DiscontinueBanner = ({
background={bg}
color={color}
p={'8px 12px'}
gap={8}
gap={'4px'}
>
{icon}
<Text fontSize={'14px'} overflow={'hidden'}>
Expand Down
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/src/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const Layout = memo<LayoutProps>(function Layout({ children }) {
const Notification = styled(Flex)`
color: #ca300e;
font-size: 14px;
gap: 8px;
gap: 4px;
border-radius: 4px;
background-color: rgba(238, 57, 17, 0.1);
padding: 8px 12px;
Expand Down
67 changes: 0 additions & 67 deletions apps/dcellar-web-ui/src/store/slices/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,71 +280,11 @@ export const setupPaymentAccounts =

const [data, error] = await getPaymentAccountsByOwner(loginAccount);
const { seedString } = await dispatch(getSpOffChainData(loginAccount, specifiedSp));
// const testAccounts = [
// //frozen owner account
// '0x6A69FAA1BD7D73D25A6A3EE1AE41A899DD8CCB8C',
// '0xCDB16F541E1445150F9211DD564668EB01B26E75',
// '0x40EDE296E01E1D57B25697B07D0F1C69077843D0',
// '0xCEE3823C39FCC9845D7C7144A836562F37995085',
// '0x1C893441AB6C1A75E01887087EA508BE8E07AAAE',
// // settime less than 7 days
// '0x367A4BD1606E97647F60DD15FECDCE4535B688F6',
// '0xB4ADFF34EF2C22A4B2FCAA7B955B9FB7BE414E6D',
// '0x78CFE6BCA29CEA13A6C3744D8B6AE86FB576940C',
// '0x9AEAC93ED1444D9E82E2C15F0FD42B0D791A3156',
// '0x3C1A11C54142C44E71A8302AD93AD0191FF17981',
// // // payment accounts
// // '0x4528E40060A22F347EA3BC7EDE62CEA29B5DD837',
// // '0x1745DEB31E405C4CB2C6747E2CFCECA6E57FF77A',
// // '0x258FC67F494A7F25692D02D918E99FA9B29FAEF3',
// // '0x48054722312D664E4C0ADE7FC0C5BD56701BA7D4',
// // '0xF00213234839FE91567E4FFE696A05A078CCF215',
// // '0xFFE7F0C98BB452CD4FA56E9FBE869E502E7186D4',
// // '0x08A8AF3666B39B35C429D8EBA2099B84B999160F',
// // '0xE9AB711EDBBCA0605D7E78E92B14C9D95A0E9D9F',
// // '0xC8B680FB0D2E5B4BEF28195D0D1EE070E271CD84'
// ];
const [paDetail, paError] = await listUserPaymentAccounts(
{ account: loginAccount },
{ type: 'EDDSA', address: loginAccount, domain: window.location.origin, seed: seedString },
{ endpoint: spRecords[specifiedSp].endpoint },
);
// const customDetail = await Promise.all(testAccounts.map(async (address) => {
// const [res, err] = await getStreamRecord(address);
// const [res2, err2] = await getAccount(address);
// console.log('stream_record', res?.streamRecord);
// console.log('account', res2);
// const StreamRecord = {};
// // const mapObj = {
// // account: 'Account',
// // bufferBalance: 'BufferBalance',
// // crudtimestamp: 'CrudTimestamp',
// // frozennetflowrate: 'FrozenNetflowRate',
// // lockbalance: 'LockBalance',
// // netflowrate: 'NetflowRate',
// // outflowcount: 'OutflowCount',
// // settletimestamp: 'SettleTimestamp',
// // staticbalance: 'StaticBalance',
// // status: 'Status',
// // }
// const capitalizeFirstLetter = (str) => {
// return str.charAt(0).toUpperCase() + str.slice(1);
// }
// Object.entries(res?.streamRecord || {}).map(([key, value]) => {
// StreamRecord[capitalizeFirstLetter(key)] = value.low ? value.low : value;
// });
// const PaymentAccount = {};
// Object.entries(res2 || {}).map(([key, value]) => {
// PaymentAccount[capitalizeFirstLetter(key)] = value
// });
// return {
// StreamRecord,
// PaymentAccount
// }
// }
// ))
// console.log('customDetail', customDetail);
// console.log('paDetail', paDetail);
if (error || paError || paDetail?.code !== 0) {
dispatch(setPaymentAccountsLoading(false));
dispatch(setPaymentAccountList({ loginAccount, paymentAccounts: [] }));
Expand All @@ -363,13 +303,6 @@ export const setupPaymentAccounts =
paDetail?.body?.GfSpListUserPaymentAccountsResponse.PaymentAccounts,
(item) => item.PaymentAccount.Address,
);
// const keyCustomDetail = keyBy(
// customDetail,
// (item) => item.StreamRecord.Account?.toLowerCase(),
// );

console.log('keyAccountDetail', keyAccountDetail);
// console.log('keyCustomDetail', keyCustomDetail);
let totalPaymentAccountNetflowRate = BN(0);
const newPaymentAccounts = data.paymentAccounts.map((address, index) => {
const detail = keyAccountDetail[address];
Expand Down
6 changes: 0 additions & 6 deletions apps/dcellar-web-ui/src/store/slices/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export interface GlobalState {
walletDisconnected: boolean;
walletConnected: boolean;
signatureAction: SignatureAction | object;
closeRenewalAddresses: string[];
}

const defaultStoreFeeParams: StoreFeeParams = {
Expand Down Expand Up @@ -155,7 +154,6 @@ const initialState: GlobalState = {
walletDisconnected: false,
walletConnected: false,
signatureAction: {},
closeRenewalAddresses: [],
};

export const globalSlice = createSlice({
Expand Down Expand Up @@ -445,9 +443,6 @@ export const globalSlice = createSlice({
(task: UploadObject) => !ids.includes(task.id),
);
},
setCloseRenewalAddresses(state, { payload }: PayloadAction<string[]>) {
state.closeRenewalAddresses = payload;
},
},
});

Expand All @@ -474,7 +469,6 @@ export const {
setSignatureAction,
setWaitQueue,
clearUploadRecords,
setCloseRenewalAddresses,
} = globalSlice.actions;

const _emptyUploadQueue = Array<UploadObject>();
Expand Down

0 comments on commit 5bafce2

Please sign in to comment.