Skip to content

Commit

Permalink
code lint format
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcrypto committed Nov 29, 2024
1 parent 96790ab commit fbdf1ba
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 533 deletions.
494 changes: 0 additions & 494 deletions packages/site/src/components/Card.tsx

This file was deleted.

8 changes: 1 addition & 7 deletions packages/site/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import styled, { useTheme } from 'styled-components';

import { getThemePreference } from '../utils';
import { SnapLogo } from './SnapLogo';
import { Toggle } from './Toggle';

const HeaderWrapper = styled.header`
display: flex;
Expand Down Expand Up @@ -35,11 +33,7 @@ const RightContainer = styled.div`
align-items: center;
`;

export const Header = ({
handleToggleClick,
}: {
handleToggleClick(): void;
}) => {
export const Header = () => {
const theme = useTheme();

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/site/src/components/Progress.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-plusplus */
import React, { useEffect, useState } from 'react';

const ModalProgress = ({ onClose }) => {
const ModalProgress = () => {
const [progress, setProgress] = useState(100);

useEffect(() => {
Expand Down
5 changes: 2 additions & 3 deletions packages/site/src/components/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/* eslint-disable @typescript-eslint/prefer-for-of */
/* eslint-disable id-denylist */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { set } from '@metamask/superstruct';
import { Modal, Button } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import * as uint8arraytools from 'uint8array-tools';
Expand All @@ -28,7 +27,7 @@ import Loader from './Loader';
import ModalProgress from './Progress';
import ModalTurorial from './Tutorial';

const FirstStep = () => {
const Step = () => {
const [data, setData] = useState([]);
const [eoaaddress, setEoaAddress] = useState('');
const [aaaddress, setAaAddress] = useState('');
Expand Down Expand Up @@ -592,4 +591,4 @@ const FirstStep = () => {
);
};

export default FirstStep;
export default Step;
2 changes: 0 additions & 2 deletions packages/site/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
export * from './Buttons';
export * from './Card';
export * from './Footer';
export * from './Header';
export * from './MetaMask';
export * from './PoweredBy';
export * from './SnapLogo';
export * from './Toggle';
export * from './Step';
4 changes: 2 additions & 2 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-unassigned-import */
import React, { useEffect } from 'react';

import FirstStep from '../components/Step';
import Step from '../components/Step';
import './App.css'; // Import your CSS file for styling

const App = () => {
Expand All @@ -10,7 +10,7 @@ const App = () => {
}, []);
return (
<div className="app-container">
<FirstStep />
<Step />
</div>
);
};
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/utils/qng.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export const qngAddWatchAddr = async (addr: string): Promise<void> => {
export const qngCheckUTXO = async (
txid: string,
idx: number,
sig: string,
sign: any,
): Promise<string> => {
try {
const ret = await _qngSend('qng_checkUTXO', [txid, Number(idx), sig]);
const ret = await _qngSend('qng_checkUTXO', [txid, Number(idx), sign]);
console.log('result', ret);
return ret;
} catch (error) {
Expand Down
1 change: 0 additions & 1 deletion packages/site/src/utils/sign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as uint8arraytools from 'uint8array-tools';
import { trimHexPrefix } from './utils';

export const handleSignStr = (sign: string): string => {
Expand Down
35 changes: 14 additions & 21 deletions packages/site/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,29 @@
import * as uint8arraytools from 'uint8array-tools';

export const currentDateTime = () => {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');

// 格式化为字符串
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');

return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
// eslint-disable-next-line jsdoc/require-returns
/**
*
* @param arrays
*/
function mergeUint8Arrays(arrays: any[]) {
const totalLength = arrays.reduce((acc, curr) => acc + curr.length, 0);
export const mergeUint8Arrays = (arrs: any[]) => {
const totalLength = arrs.reduce((acc, curr) => acc + curr.length, 0);

const mergedArray = new Uint8Array(totalLength);

let offset = 0;
arrays.forEach((array) => {
mergedArray.set(array, offset);
offset += array.length;
arrs.forEach((arr) => {
mergedArray.set(arr, offset);
offset += arr.length;
});

return mergedArray;
}
};
export const getInputHash = (
txid: string,
idx: number,
Expand Down

0 comments on commit fbdf1ba

Please sign in to comment.