Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support floating icon #267

Merged
merged 32 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
843d3fe
add new button
huhuanming Dec 17, 2024
ef39f5b
refactor to jsx
huhuanming Dec 17, 2024
1c45294
Update injectWeb3Provider.ts
huhuanming Dec 17, 2024
1059efa
Update index.tsx
huhuanming Dec 17, 2024
6ee0809
Update tsconfig.cjs.json
huhuanming Dec 17, 2024
41072f3
Update tsconfig.json
huhuanming Dec 17, 2024
bfccbad
Update index.tsx
huhuanming Dec 17, 2024
f765ad5
Update tsconfig.cjs.json
huhuanming Dec 17, 2024
326a9d1
Update tsconfig.json
huhuanming Dec 17, 2024
6fa343a
Update index.tsx
huhuanming Dec 17, 2024
4cc9214
Update index.tsx
huhuanming Dec 17, 2024
85a8329
Update injectWeb3Provider.ts
huhuanming Dec 17, 2024
12588b4
Update tsconfig.cjs.json
huhuanming Dec 18, 2024
b75d02a
Update tsconfig.json
huhuanming Dec 18, 2024
0c8aba6
Update tsconfig.cjs.json
huhuanming Dec 18, 2024
aeb949c
Update tsconfig.json
huhuanming Dec 18, 2024
e51bc42
dapp is optional
huhuanming Dec 18, 2024
9650933
Update yarn.lock
huhuanming Dec 18, 2024
af0722e
Update index.tsx
huhuanming Dec 18, 2024
afc8c12
Create images.tsx
huhuanming Dec 18, 2024
21e59c0
Update index.tsx
huhuanming Dec 18, 2024
bb11fdf
Update index.tsx
huhuanming Dec 18, 2024
34eb1b5
Update index.tsx
huhuanming Dec 18, 2024
a662975
Update index.tsx
huhuanming Dec 18, 2024
a19d86e
Update index.tsx
huhuanming Dec 18, 2024
de3cef3
Update index.tsx
huhuanming Dec 18, 2024
7af11e4
Update index.tsx
huhuanming Dec 18, 2024
8c83082
Update index.tsx
huhuanming Dec 18, 2024
5b19353
Update injectWeb3Provider.ts
huhuanming Dec 18, 2024
df703aa
Update images.tsx
huhuanming Dec 18, 2024
8fcb4ad
fix: fix version
huhuanming Dec 18, 2024
3d7af02
Update versionInfo.ts
huhuanming Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ yarn-error.log
package.json.lerna_backup
lerna-debug.log
.env
.vscode
.vscode
.history
2 changes: 1 addition & 1 deletion packages/injected/src/injectedExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const bridge = (): JsBridgeExtInjected =>
});
injectJsBridge(bridge);

injectWeb3Provider();
injectWeb3Provider({ showFloatingButton: true });

console.log('OneKey Provider Ready ', performance.now());

Expand Down
3 changes: 2 additions & 1 deletion packages/providers/inpage-providers-hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"@onekeyfe/onekey-ton-provider": "2.1.23",
"@onekeyfe/onekey-tron-provider": "2.1.23",
"@onekeyfe/onekey-webln-provider": "2.1.23",
"web3": "^1.7.3"
"web3": "^1.7.3",
"preact": "^10.25.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

新增 preact 依赖

新增了 preact 依赖用于实现浮动图标功能,版本选择合适。建议在 README 中说明使用 preact 的原因。

},
"devDependencies": {
"@playwright/test": "^1.43.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

ESLint 规则禁用范围过大

建议只在必要的地方禁用特定规则,而不是完全禁用类型检查。这样可以保持更好的代码质量和类型安全性。

- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
+ // 仅在确实需要的地方禁用特定规则

Committable suggestion skipped: line range outside the PR's diff.

export const Logo = ({ style }: { style: any }) => (
<img
alt="Logo"
style={style}
src="data:image/webp;base64,UklGRswEAABXRUJQVlA4WAoAAAAQAAAALwAALwAAQUxQSCgDAAABoGTbtuq6OdLTNzPbxXCJoehehJlKbkKYmZMGMDPUmZmZOWaM3tN9axXuvVKaEBETEPXhvIhYdOw5Nz35xld//wf//f3Vm0/edO6xiyJi3jBmHsxFLD7poZ/9H39+6KRFEXODGZphLL/iN9WubbvUo/Spa8ed6m9XrohhM9Uo4oKtmtqut47FvmuTbj0/YjTFXMx7StuEIrnUVVKrT82LucooVnxqmwQBpCpI0dT6yYoYFZqY94kHEAEpioW6HPCTedFExGAYT3nAgiAguRRFBA/4VAwHEXNxgS1SFdQMC1O2XhBzMYwV20wCgswuCAImt66I4by4ylYyQRAsZ4CCgK1XxbxY8rsJEBAQLFMUkGLy9yURp5goSXkaC5ILyVMiHrGVXFGclrKiKLY+Ekt+tSuoACI1MxVAtPPXJSdor1QFhApSFdReT7jQTgRBM5lB0Ayw84LbbAXQkhkVQEsKtt72bEFUBMGaIiqCYPbsu04EECqIZQChAk589zuTIAioIDURBFQQk99ttS8IIgKiKIAIIgLau3UsqqCAgoIqqqCABXAMKAKCIGKdXBDEDGRKEcBZQAQkHwvmILnToyC5II632otK2VmkqoC9W783SVnyAgg1KarJH953UhIUVMGMgqAg4MQPXrQTpCiWcovkAoidL91rK3WhJAJTCWDrPVvsNBNrkltERDDr3LJZ+kI9M6NUFexx89q/nAiCYE2sgiC5E/9aE8/ZSq4gUKgDChZan4u4yAmAgBSnAgEpJy+K2LTVVJJcmElySW7dFKO421YARXEqBFAUsfXuGA3jkL32ggogoohQUMnt3XtIDKOJS+ykLCgIYKko2HpJNBGDmPeKYwXNchFLgiKOfWVeDCKiiYN+cawlZUYtOPaXg6KJvIljfrXrRRAEFEVEBfvOX4+JJspNHPGmdj0ouQgKoNB3+uYR0US9ieXX79fUJTAHsdinLun+65dHE9M2ESfev0tl0k1S6rM+TSbdBHXXfSdGNDH9YBhx1MUv77CK9R0vX3x0xHAQMw8HEYuOPOO6x1778redLbQ7f/vytceuPeOoRRGDYdQBVlA4IH4BAACQCACdASowADAAPpE2lkiloqIhMdZqALASCWkABRXm1xMlLv4/sMpVEDsQhAZmdBuj/t2DLLfSj9jeN2h/33kRqlO8uEYD82VJykmZgAD++u9Yi1iq75P1V2sgP+qtpKI6W2w+S89zFwU6NocVAgS4Ahpa8cwJdBVEzwmXPHuS+Bkf1jepfuaBisZjtz5k66v9TsX4ZHJ5vxopXrXVhzZQUpWcle5eRr0hlxA/4qZCdCu7tBQ5hgNercW+3c8xj+8Y/zuF1X58pDYUF3k54O/II2gG8Dqeo/A55jNiCpze2OAuo27ogApJXra1b+faewFXX38yPcZcdAUmJbAX3uojPiByizCXOCi4wxWsVeiO7lp3pZm8f0ZyYUdSt4Zp0OC1vqmHm6T91y+5ksk6nQ1HLhk4+cITpVoLHyAFiOAJR65xrUvCXEZkm4vPDlcD+/++gTsKJ77gEkOU8XBObUsURriu7kcnYOLmxbgVkhgyFKQgHakg1e2tS8mJzSAA"
/>
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

需要改进的几个关键点

  1. style 属性使用 any 类型不够严谨,建议使用 React.CSSProperties
  2. base64 图片建议提取到单独的资源文件中
  3. 缺少图片加载失败的处理

建议按如下方式修改:

- export const Logo = ({ style }: { style: any }) => (
+ import logoImage from './assets/logo.webp';
+ 
+ export const Logo = ({ style }: { style: React.CSSProperties }) => (
   <img
     alt="Logo"
     style={style}
-    src="data:image/webp;base64,UklGR..."
+    src={logoImage}
+    onError={(e) => {
+      e.currentTarget.style.display = 'none';
+    }}
   />
 )

Committable suggestion skipped: line range outside the PR's diff.

Loading
Loading