Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions packages/dashboard/src/components/FooterLine/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { About } from './About'
import { Close } from '@mui/icons-material'
import { Version } from './Version'
import links from './links.json'
import { openWindow } from '@masknet/shared-base-ui'

const useStyles = makeStyles()((theme) => ({
navRoot: {
Expand Down Expand Up @@ -105,9 +106,9 @@ export const FooterLine = memo(() => {
const openVersionLink = (event: React.MouseEvent) => {
// `MouseEvent.prototype.metaKey` on macOS (`Command` key), Windows (`Windows` key), Linux (`Super` key)
if (process.env.channel === 'stable' && !event.metaKey) {
open(`${links.DOWNLOAD_LINK_STABLE_PREFIX}/v${version}`)
openWindow(`${links.DOWNLOAD_LINK_STABLE_PREFIX}/v${version}`)
} else {
open(`${links.DOWNLOAD_LINK_UNSTABLE_PREFIX}/${process.env.COMMIT_HASH}`)
openWindow(`${links.DOWNLOAD_LINK_UNSTABLE_PREFIX}/${process.env.COMMIT_HASH}`)
}
}
return (
Expand Down
5 changes: 2 additions & 3 deletions packages/mask/src/extension/debug-page/DebugInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { map } from 'lodash-unified'
import { makeNewBugIssueURL } from './issue'
import { useI18N } from '../../utils'
import { openWindow } from '@masknet/shared-base-ui'
export const DEBUG_INFO = {
'User Agent': navigator.userAgent,
'Mask Version': process.env.VERSION,
Expand All @@ -16,9 +17,7 @@ export const DEBUG_INFO = {

export const DebugInfo = () => {
const { t } = useI18N()
const onNewBugIssue = () => {
open(makeNewBugIssueURL())
}
const onNewBugIssue = () => openWindow(makeNewBugIssueURL())

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { createElement } from 'react'
import { useI18N } from '../../../../utils'
import { Provider } from '../Provider'
import { IMTokenIcon, MetaMaskIcon, RainbowIcon, TrustIcon } from './Icons'
import urlcat from 'urlcat'
import { openWindow } from '@masknet/shared-base-ui'

const useStyles = makeStyles()({
container: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' },
Expand All @@ -27,11 +29,7 @@ const providers: WalletProvider[] = [
export const SafariPlatform: React.FC<{ uri: string }> = ({ uri }) => {
const { t } = useI18N()
const { classes } = useStyles()
const makeConnect = (link: string) => () => {
const url = new URL(link)
url.searchParams.set('uri', uri)
open(url.toString())
}
const makeConnect = (link: string) => () => openWindow(urlcat(link, { uri }))
const descriptionMapping: Record<string, string> = {
MetaMask: t('plugin_wallet_connect_safari_metamask'),
Rainbow: t('plugin_wallet_connect_safari_rainbow'),
Expand Down
3 changes: 2 additions & 1 deletion packages/plugins/FileService/src/SNSAdaptor/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CopyableCode } from './components/Copyable'
import type { FileInfo } from '../types'
import { resolveGatewayAPI } from '../helpers'
import urlcat from 'urlcat'
import { openWindow } from '@masknet/shared-base-ui'

const useStyles = makeStyles()((theme) => ({
root: {
Expand Down Expand Up @@ -64,7 +65,7 @@ export function Preview({ info }: { info: FileInfo }) {
const onClick = (event: React.MouseEvent) => {
event.preventDefault()
event.stopPropagation()
open(info.key ? `${link}#${info.key}` : link)
openWindow(info.key ? `${link}#${info.key}` : link)
}
return (
<Paper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { FileInfo } from '../../types'
import { FileName } from './FileName'
import { resolveGatewayAPI } from '../../helpers'
import urlcat from 'urlcat'
import { openWindow } from '@masknet/shared-base-ui'

const useStyles = makeStyles()({
container: {
Expand Down Expand Up @@ -82,7 +83,7 @@ export const Uploaded: React.FC = () => {

const linkPrefix = resolveGatewayAPI(state.provider)
const link = urlcat(linkPrefix, '/:txId', { txId: state.landingTxID })
open(state.key ? `${link}#${state.key}` : link)
openWindow(state.key ? `${link}#${state.key}` : link)
}
return (
<Grid container className={classes.container}>
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/src/Components/Dialogs/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const MaskDialog = memo((props: MaskDialogProps) => {
})

export function useMaskDialog(title: string, content: ReactNode, actions: ReactNode) {
const [isOpen, open] = useState(false)
const onClose = useCallback(() => open(false), [])
const [isOpen, setOpen] = useState(false)
const onClose = useCallback(() => setOpen(false), [])
return (
<MaskDialog onClose={onClose} open={isOpen} title={title}>
<DialogContent>{content}</DialogContent>
Expand Down