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

style: adjust the style of the floating icon. #269

Merged
merged 12 commits into from
Dec 19, 2024
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-core",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -29,9 +29,9 @@
"build-version-info": "node ./scripts/buildVersionInfo.js"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-errors": "2.2.0",
"@onekeyfe/cross-inpage-provider-events": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/cross-inpage-provider-errors": "2.2.1",
"@onekeyfe/cross-inpage-provider-events": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"events": "^3.3.0",
"lodash-es": "^4.17.21",
"ms": "^2.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const EXT_PORT_UI_TO_BG = 'onekey@EXT_PORT_UI_TO_BG';
export const DEBUG_LOGGER_STORAGE_KEY = '$$ONEKEY_DEBUG_LOGGER';
export const WALLET_INFO_LOACAL_KEY = 'onekey_wallet_info_local_key'
export const WALLET_INFO_LOACAL_KEY_V5 = "onekey_wallet_info_local_key_v5";
export const ONEKEY_ALIGN_PRIMARY_ACCOUNT = '$$ONEKEY_ALIGN_PRIMARY_ACCOUNT';
export const ONEKEY_REQUEST_TO_ALL_CS = '$$ONEKEY_REQUEST_TO_ALL_CS';
2 changes: 1 addition & 1 deletion packages/core/src/versionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

const version = '2.2.0';
const version = '2.2.1';
const versionBuild = '2020-0101-1';

export default {
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop/desktop-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/desktop-bridge-injected",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0"
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/empty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-empty",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-errors",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-events",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down
24 changes: 12 additions & 12 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-example",
"version": "2.2.0",
"version": "2.2.1",
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand Down Expand Up @@ -28,17 +28,17 @@
"@metamask/onboarding": "^1.0.1",
"@mizuwallet-sdk/core": "^1.4.0",
"@mysten/dapp-kit": "0.13.2",
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/onekey-aptos-provider": "2.2.0",
"@onekeyfe/onekey-cardano-provider": "2.2.0",
"@onekeyfe/onekey-conflux-provider": "2.2.0",
"@onekeyfe/onekey-cosmos-provider": "2.2.0",
"@onekeyfe/onekey-near-provider": "2.2.0",
"@onekeyfe/onekey-solana-provider": "2.2.0",
"@onekeyfe/onekey-sui-provider": "2.2.0",
"@onekeyfe/onekey-tron-provider": "2.2.0",
"@onekeyfe/onekey-webln-provider": "2.2.0",
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"@onekeyfe/onekey-aptos-provider": "2.2.1",
"@onekeyfe/onekey-cardano-provider": "2.2.1",
"@onekeyfe/onekey-conflux-provider": "2.2.1",
"@onekeyfe/onekey-cosmos-provider": "2.2.1",
"@onekeyfe/onekey-near-provider": "2.2.1",
"@onekeyfe/onekey-solana-provider": "2.2.1",
"@onekeyfe/onekey-sui-provider": "2.2.1",
"@onekeyfe/onekey-tron-provider": "2.2.1",
"@onekeyfe/onekey-webln-provider": "2.2.1",
"@polkadot/api": "^9.11.3",
"@polkadot/extension-dapp": "^0.47.5",
"@radix-ui/react-checkbox": "^1.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-hosted/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-hosted",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,8 +28,8 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as uuid from 'uuid';

import { JsBridgeBase, consts } from '@onekeyfe/cross-inpage-provider-core';

const { EXT_PORT_OFFSCREEN_TO_BG, EXT_PORT_CS_TO_BG, EXT_PORT_UI_TO_BG, ONEKEY_ALIGN_PRIMARY_ACCOUNT } = consts;
const { EXT_PORT_OFFSCREEN_TO_BG, EXT_PORT_CS_TO_BG, EXT_PORT_UI_TO_BG, ONEKEY_REQUEST_TO_ALL_CS } = consts;

class JsBridgeExtBackground extends JsBridgeBase {
constructor(config: IJsBridgeConfig) {
Expand Down Expand Up @@ -143,7 +143,7 @@ class JsBridgeExtBackground extends JsBridgeBase {
data = await data({ origin });
}
// Send a notification to the port of the specified origin
if (!targetOrigin || targetOrigin === origin || targetOrigin === ONEKEY_ALIGN_PRIMARY_ACCOUNT) {
if (!targetOrigin || targetOrigin === origin || targetOrigin === ONEKEY_REQUEST_TO_ALL_CS) {
// TODO check ports disconnected
this.requestSync({
data,
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-injected",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0"
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1"
}
}
14 changes: 7 additions & 7 deletions packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-injected",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -42,12 +42,12 @@
"electron": "*"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/desktop-bridge-injected": "2.2.0",
"@onekeyfe/extension-bridge-injected": "2.2.0",
"@onekeyfe/inpage-providers-hub": "2.2.0",
"@onekeyfe/native-bridge-injected": "2.2.0",
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"@onekeyfe/desktop-bridge-injected": "2.2.1",
"@onekeyfe/extension-bridge-injected": "2.2.1",
"@onekeyfe/inpage-providers-hub": "2.2.1",
"@onekeyfe/native-bridge-injected": "2.2.1",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/native/native-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/native-bridge-injected",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0"
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1"
}
}
42 changes: 21 additions & 21 deletions packages/providers/inpage-providers-hub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/inpage-providers-hub",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -30,26 +30,26 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/onekey-algo-provider": "2.2.0",
"@onekeyfe/onekey-alph-provider": "2.2.0",
"@onekeyfe/onekey-aptos-provider": "2.2.0",
"@onekeyfe/onekey-bfc-provider": "2.2.0",
"@onekeyfe/onekey-btc-provider": "2.2.0",
"@onekeyfe/onekey-cardano-provider": "2.2.0",
"@onekeyfe/onekey-conflux-provider": "2.2.0",
"@onekeyfe/onekey-cosmos-provider": "2.2.0",
"@onekeyfe/onekey-eth-provider": "2.2.0",
"@onekeyfe/onekey-nostr-provider": "2.2.0",
"@onekeyfe/onekey-polkadot-provider": "2.2.0",
"@onekeyfe/onekey-private-provider": "2.2.0",
"@onekeyfe/onekey-scdo-provider": "2.2.0",
"@onekeyfe/onekey-solana-provider": "2.2.0",
"@onekeyfe/onekey-sui-provider": "2.2.0",
"@onekeyfe/onekey-ton-provider": "2.2.0",
"@onekeyfe/onekey-tron-provider": "2.2.0",
"@onekeyfe/onekey-webln-provider": "2.2.0",
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"@onekeyfe/onekey-algo-provider": "2.2.1",
"@onekeyfe/onekey-alph-provider": "2.2.1",
"@onekeyfe/onekey-aptos-provider": "2.2.1",
"@onekeyfe/onekey-bfc-provider": "2.2.1",
"@onekeyfe/onekey-btc-provider": "2.2.1",
"@onekeyfe/onekey-cardano-provider": "2.2.1",
"@onekeyfe/onekey-conflux-provider": "2.2.1",
"@onekeyfe/onekey-cosmos-provider": "2.2.1",
"@onekeyfe/onekey-eth-provider": "2.2.1",
"@onekeyfe/onekey-nostr-provider": "2.2.1",
"@onekeyfe/onekey-polkadot-provider": "2.2.1",
"@onekeyfe/onekey-private-provider": "2.2.1",
"@onekeyfe/onekey-scdo-provider": "2.2.1",
"@onekeyfe/onekey-solana-provider": "2.2.1",
"@onekeyfe/onekey-sui-provider": "2.2.1",
"@onekeyfe/onekey-ton-provider": "2.2.1",
"@onekeyfe/onekey-tron-provider": "2.2.1",
"@onekeyfe/onekey-webln-provider": "2.2.1",
"preact": "^10.25.1",
"web3": "^1.7.3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ const textStyle = {

const containerId = 'onekey-floating-widget';

const removeApp = () => {
const removeIcon = () => {
document.getElementById(containerId)?.remove();
isInjected = false;
}

const useOutsideClick = (
Expand Down Expand Up @@ -81,7 +82,7 @@ function CloseDialog({ onClose }: { onClose: () => void }) {
}).$onekey.$private.request({
method: 'wallet_disableFloatingButton',
});
removeApp();
removeIcon();
}, [])
const handleHideOnSite = useCallback(() => {
void (globalThis as unknown as {
Expand All @@ -96,7 +97,7 @@ function CloseDialog({ onClose }: { onClose: () => void }) {
method: 'wallet_hideFloatingButtonOnSite',
params: { url: window.location.origin },
});
removeApp();
removeIcon();
}, [])
return (
<div
Expand Down Expand Up @@ -461,6 +462,7 @@ function SecurityInfo({
color: 'rgba(0, 0, 0, 0.88)',
fontSize: '13px',
fontWeight: '500',
overflow: 'hidden',
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

文本溢出处理优化

添加了文本溢出处理,防止长文本破坏布局。建议进一步完善:

 style={{ 
   width: '100%', 
   overflow: 'hidden', 
   textOverflow: 'ellipsis' 
+  whiteSpace: 'nowrap'
 }}

Also applies to: 505-513

}}
>
{securityInfo?.dapp?.logo ? (
Expand Down Expand Up @@ -500,13 +502,23 @@ function SecurityInfo({
/>
</svg>
)}
{securityInfo?.dapp?.name || securityInfo?.host}
<span
style={{
width: '100%',
overflow: 'hidden',
textOverflow: 'ellipsis'
}}
>
{securityInfo?.dapp?.name || securityInfo?.host}
</span>
</div>
<div
style={{
width: "24",
height: "24",
cursor: "pointer"
cursor: "pointer",
display: 'flex',
alignItems: 'center',
huhuanming marked this conversation as resolved.
Show resolved Hide resolved
}}
onClick={() => {
onClose();
Expand Down Expand Up @@ -670,7 +682,7 @@ function App() {
style={{
position: 'fixed',
zIndex: 999_999,
top: '20%',
bottom: '25%',
huhuanming marked this conversation as resolved.
Show resolved Hide resolved
right: '-146px',
background: 'rgba(255, 255, 255, 1)',
borderWidth: '0.33px',
Expand Down Expand Up @@ -711,7 +723,7 @@ function App() {
);
}

export async function injectFloatingButton() {
async function injectIcon() {
huhuanming marked this conversation as resolved.
Show resolved Hide resolved
const { isShow, i18n: i18nResponse } = await (globalThis as unknown as {
$onekey: {
$private: {
Expand Down Expand Up @@ -744,3 +756,22 @@ export async function injectFloatingButton() {
document.body.appendChild(div);
render(<App />, document.body, div);
}

huhuanming marked this conversation as resolved.
Show resolved Hide resolved
export function injectFloatingButton() {
(globalThis as unknown as {
$onekey: {
$private: {
onNotifyFloatingIconChanged: (
arg: ((params: { showFloatingIcon: boolean }) => void)
) => void
}
}
}).$onekey.$private.onNotifyFloatingIconChanged(({ showFloatingIcon }: { showFloatingIcon: boolean }) => {
huhuanming marked this conversation as resolved.
Show resolved Hide resolved
if (showFloatingIcon) {
void injectIcon();
} else {
removeIcon();
}
});
void injectIcon();
huhuanming marked this conversation as resolved.
Show resolved Hide resolved
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-algo-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-algo-provider",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,9 +28,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.2.0",
"@onekeyfe/cross-inpage-provider-errors": "2.2.0",
"@onekeyfe/cross-inpage-provider-types": "2.2.0",
"@onekeyfe/extension-bridge-injected": "2.2.0"
"@onekeyfe/cross-inpage-provider-core": "2.2.1",
"@onekeyfe/cross-inpage-provider-errors": "2.2.1",
"@onekeyfe/cross-inpage-provider-types": "2.2.1",
"@onekeyfe/extension-bridge-injected": "2.2.1"
}
}
Loading
Loading