Skip to content

Commit

Permalink
fix: plugin switchers (#10829)
Browse files Browse the repository at this point in the history
* refactor: code style

* refactor: cache userNftContainer_Query

* fix: button style
  • Loading branch information
guanbinrui committed Sep 22, 2023
1 parent e798b43 commit 49385e5
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 28 deletions.
4 changes: 0 additions & 4 deletions packages/mask/shared-ui/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
"persona_load_failed": "Load failed",
"enable_plugin_boundary": "Enable plugin",
"enable_plugin_boundary_description": "This function has been turned off in the App settings. Enable plug-ins to fully access.",
"close_check_security": "Close [Check Security]?",
"check_security_intro": "The [Check Security] dApp provides quick, reliable, and convenient Web3 security services.",
"check_security_close_warning": "If you decide to close [Check Security], you will no longer see security notifications when interacting with suspicious, blacklisted, or potentially fraudulent contracts and addresses.",
"check_security_close_advice": "We recommend new Web3 users to keep [Check Security] open. ",
"additional_post_box__encrypted_post_pre": "Decrypt this post with #mask_io! $t(promote) {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet_sns_official_account": "$t(promote_red_packet) Follow @{{account}} for Web3 updates and insights. \n\n🧧🧧🧧 Try sending Lucky Drop to your friends with Mask.io. \n\n{{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet": "$t(promote_red_packet) \n\n🧧🧧🧧 Try sending Lucky Drop to your friends with Mask.io. \n\n{{encrypted}}",
Expand Down
4 changes: 0 additions & 4 deletions packages/mask/shared-ui/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@
"persona_load_failed": "読み込み失敗",
"enable_plugin_boundary": "プラグインを有効にする",
"enable_plugin_boundary_description": "特定のコンテンツを表示するには DApp を開く必要があります。",
"close_check_security": "[セキュリティチェック] を閉じますか?",
"check_security_intro": "「セキュリティチェック」dAppは、迅速、確実、便利にWeb3セキュリティサービスを提供します。",
"check_security_close_warning": "「セキュリティチェック」を閉じますと、不審なブラックリストに登録され、不正な契約書やアドレスとやりとりする際に、セキュリティに関する通知が表示されなくなります。",
"check_security_close_advice": "「セキュリティチェック」 を開いたままにしておくことをお勧めします。 ",
"additional_post_box__encrypted_post_pre": "#mask_io で復号しましょう! {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet_sns_official_account": "こんにちは、#mask_io @{{account}} でラッキードロップを獲得しましょう。 \n\n$t(promote_red_packet)\n {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet": "こんにちは、#mask_io @{{account}} でラッキードロップを獲得しましょう。 \n\n$t(promote_red_packet)\n {{encrypted}}",
Expand Down
4 changes: 0 additions & 4 deletions packages/mask/shared-ui/locales/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@
"persona_load_failed": "로딩 실패",
"enable_plugin_boundary": "플러그인 활성화",
"enable_plugin_boundary_description": "특정 콘텐츠를 보려면 dApp을 열어야 합니다.",
"close_check_security": "[Check Security] 닫기",
"check_security_intro": "[Check Security] dApp은 빠르고, 신뢰할 수 있는 웹3 보안 서비스를 제공합니다.",
"check_security_close_warning": "[Check Security] 닫기로 결정한 경우 의심스럽거나 블랙리스트에 있거나 사기 가능성이 있는 컨트랙트 및 주소와 상호 작용할 때 보안 알림이 더 이상 표시되지 않습니다.",
"check_security_close_advice": "새로운 웹3 이용자에게 [Check Security] 열려 있는 상태를 유지하는 것을 권장합니다. ",
"additional_post_box__encrypted_post_pre": "#mask_io로 이 게시물을 해독하기. {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet_sns_official_account": "#mask_io로 행운 드랍을 수령해 보세요. @{{account}} \n\n$t(promote_red_packet)\n {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet": "#mask_io {{encrypted}} 덧붙이고 레드 패킷을 수령하세요.",
Expand Down
4 changes: 0 additions & 4 deletions packages/mask/shared-ui/locales/qya-AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
"persona_load_failed": "crwdns18600:0crwdne18600:0",
"enable_plugin_boundary": "crwdns18602:0crwdne18602:0",
"enable_plugin_boundary_description": "crwdns19131:0crwdne19131:0",
"close_check_security": "crwdns17716:0crwdne17716:0",
"check_security_intro": "crwdns17718:0crwdne17718:0",
"check_security_close_warning": "crwdns17720:0crwdne17720:0",
"check_security_close_advice": "crwdns17722:0crwdne17722:0",
"additional_post_box__encrypted_post_pre": "crwdns3991:0$t(promote)crwdnd3991:0{{encrypted}}crwdne3991:0",
"additional_post_box__encrypted_post_pre_red_packet_sns_official_account": "crwdns19497:0$t(promote_red_packet)crwdnd19497:0{{account}}crwdnd19497:0{{encrypted}}crwdne19497:0",
"additional_post_box__encrypted_post_pre_red_packet": "crwdns3995:0$t(promote_red_packet)crwdnd3995:0{{encrypted}}crwdne3995:0",
Expand Down
4 changes: 0 additions & 4 deletions packages/mask/shared-ui/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
"persona_load_failed": "加载失败",
"enable_plugin_boundary": "开启插件",
"enable_plugin_boundary_description": "您需要打开 DAPP 才能查看特定内容。",
"close_check_security": "关闭 [检查安全] 应用?",
"check_security_intro": "[检查安全] 应用提供迅速、可靠和方便的 Web3 安全服务。",
"check_security_close_warning": "如果您决定关闭 [检查安全] 应用,关闭后与任何有潜在风险的合约或地址进行互动时将无法看到相关安全提示。",
"check_security_close_advice": "我们建议 Web3 新用户保持打开 [检查安全] 应用。 ",
"additional_post_box__encrypted_post_pre": "安装 #mask_io 解密此贴文 ! {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet_sns_official_account": "使用 #mask_io 来领取这个红包!@{{account}} \n\n$t(promote_red_packet)\n {{encrypted}}",
"additional_post_box__encrypted_post_pre_red_packet": "使用 #mask_io 来认领这个红包!@{{encrypted}}",
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/src/site-adaptor-infra/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { assertNotEnvironment, Environment } from '@dimensiondev/holoflows-kit'
import { delay, waitDocumentReadyState } from '@masknet/kit'
import type { SiteAdaptorUI } from '@masknet/types'
import { type Plugin, startPluginSiteAdaptor, SiteAdaptorContextRef } from '@masknet/plugin-infra/content-script'
import { __setSiteAdaptorContext__ } from '@masknet/plugin-infra/content-script/context'
import { Modals, sharedUIComponentOverwrite, sharedUINetworkIdentifier, type ModalProps } from '@masknet/shared'
import {
createSubscriptionFromValueRef,
Expand All @@ -28,7 +29,6 @@ import '../utils/debug/general.js'
import { configureSelectorMissReporter } from '../utils/startWatch.js'
import { NextSharedUIContext, RestPartOfPluginUIContextShared } from '../utils/plugin-context-shared-ui.js'
import { definedSiteAdaptorsUI } from './define.js'
import { __setSiteAdaptorContext__ } from '@masknet/plugin-infra/content-script/context'

const definedSiteAdaptorsResolved = new Map<string, SiteAdaptorUI.Definition>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const useStyles = makeStyles()((theme) => ({
color: theme.palette.grey[700],
},
confirmButton: {
backgroundColor: theme.palette.maskColor.warn,
backgroundColor: `${theme.palette.maskColor.warn} !important`,
color: theme.palette.maskColor.white,
borderRadius: '99px',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MaskTabList, makeStyles, useTabs } from '@masknet/theme'
import { memo, useEffect } from 'react'
import { TabContext, TabPanel } from '@mui/lab'
import { DialogContent, Tab } from '@mui/material'
import { memo, useEffect } from 'react'
import { MaskTabList, makeStyles, useTabs } from '@masknet/theme'
import type { PluginID } from '@masknet/shared-base'
import { ApplicationSettingPluginList } from './ApplicationSettingPluginList.js'
import { ApplicationSettingPluginSwitch } from './ApplicationSettingPluginSwitch.js'
import { ApplicationSettingTabs } from './ApplicationBoardDialog.js'
import type { PluginID } from '@masknet/shared-base'
import { useSharedI18N } from '../../../locales/index.js'
import { InjectedDialog } from '../../../index.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/web3-providers/src/FiatCurrencyRate/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { CurrencyType } from '@masknet/web3-shared-base'
import { BASE_URL } from './constants.js'
import { fetchJSON } from '../entry-helpers.js'
import type { FiatCurrencyRateBaseAPI } from '../entry-types.js'
import { CurrencyType } from '@masknet/web3-shared-base'

export class FiatCurrencyRateAPI implements FiatCurrencyRateBaseAPI.Provider {
async getRate(type?: CurrencyType): Promise<number> {
if (!type || type === CurrencyType.USD) return 1
const result = await fetchJSON<FiatCurrencyRateBaseAPI.Result>(BASE_URL)
return result.rates[type.toUpperCase()]
}

async getRates() {
const result = await fetchJSON<FiatCurrencyRateBaseAPI.Result>(BASE_URL)
return result.rates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import urlcat from 'urlcat'
import { getHeaders } from './getTokens.js'
import { fetchJSON } from '../../helpers/fetchJSON.js'
import { fetchCachedJSON } from '../../helpers/fetchJSON.js'
import type { TwitterBaseAPI } from '../../entry-types.js'
import { Duration } from '../../entry-helpers.js'

export async function getUserNFTContainer(screenName: string) {
return fetchJSON<{
return fetchCachedJSON<{
data: {
user: {
result: TwitterBaseAPI.NFTContainer
Expand All @@ -22,5 +23,8 @@ export async function getUserNFTContainer(screenName: string) {
}),
credentials: 'include',
},
{
cacheDuration: Duration.ONE_DAY,
},
)
}

0 comments on commit 49385e5

Please sign in to comment.