Skip to content
Open
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"rehype-raw": "^6.1.1",
"semver": "^7.6.3",
"style-loader": "^3.3.2",
"umi-request": "^1.4.0"
"umi-request": "^1.4.0",
"use-sound": "^5.0.0"
},
Comment on lines +99 to 101
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Ensure the workspace that imports use-sound declares it as a dependency.

use-sound is used in packages/extension-polkagate; relying on root hoisting can break under stricter linking (e.g., PnP).

Run this to verify the dependency is declared in the package that uses it:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Imports of use-sound:"
rg -n -C1 -t ts -t tsx -P $'from\\s+[\'"]use-sound[\'"]'

PKG="packages/extension-polkagate/package.json"
if [[ -f "$PKG" ]]; then
  echo -n "packages/extension-polkagate depends on use-sound: "
  jq -r '.dependencies["use-sound"] // "MISSING"' "$PKG"
else
  echo "Missing $PKG"
fi

Length of output: 49


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for any occurrences of the literal 'use-sound' (imports/usages):"
rg -n -S --hidden --glob '!node_modules' "use-sound" || true
echo
echo "Searching for common import/require patterns:"
rg -n -S --hidden --glob '!node_modules' "from 'use-sound'" || true
rg -n -S --hidden --glob '!node_modules' 'from "use-sound"' || true
rg -n -S --hidden --glob '!node_modules' "require('use-sound')" || true
rg -n -S --hidden --glob '!node_modules' 'require("use-sound")' || true
echo

PKG="packages/extension-polkagate/package.json"
if [[ -f "$PKG" ]]; then
  echo "$PKG found — checking for use-sound in dependencies/devDependencies/peerDependencies:"
  jq -r '.dependencies["use-sound"] // .devDependencies["use-sound"] // .peerDependencies["use-sound"] // "MISSING"' "$PKG"
else
  echo "$PKG not found. Listing packages/ and searching package.json files for extension-polkagate:"
  ls -la packages || true
  rg -n --hidden --glob '!node_modules' --glob 'packages/**/package.json' '"name"\s*:\s*"?extension-polkagate"?' || true
fi

Length of output: 998


Declare use-sound in packages/extension-polkagate package.json dependencies

packages/extension-polkagate imports use-sound but its package.json does not list it (jq -> "MISSING"); add "use-sound" to packages/extension-polkagate/package.json -> dependencies to avoid breakage under PnP/strict linking.

🤖 Prompt for AI Agents
In package.json around lines 99 to 101, packages/extension-polkagate imports
use-sound but does not declare it in its dependencies; add "use-sound": "^5.0.0"
to the dependencies object in packages/extension-polkagate/package.json
(matching the workspace root version if present), then run the package manager
install to update the lockfile so PnP/strict linking will resolve the module.

"devDependencies": {
"@babel/core": "^7.18.2",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions packages/extension-polkagate/src/assets/sounds/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2019-2025 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

//@ts-nocheck
export { default as heavy } from './heavy_00.wav';
export { default as pingBing } from './ping-bing.wav';
export { default as quickUiOrEventDeep } from './quick-ui-or-event-deep.wav';
export { default as soft } from './soft_00.wav';
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/extension-polkagate/src/hooks/useAlerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import type { Severity } from '../util/types';

import { Chance } from 'chance';
import { useCallback, useContext, useMemo } from 'react';
import useSound from 'use-sound';

import { soft } from '../assets/sounds';
import { AlertContext } from '../components';
import { TIME_TO_REMOVE_ALERT } from '../util/constants';

export default function useAlerts () {
const { alerts, setAlerts } = useContext(AlertContext);
const [play] = useSound(soft, { volume: 0.4 });

const random = useMemo(() => new Chance(), []);

Expand All @@ -21,11 +24,12 @@ export default function useAlerts () {
const notify = useCallback((text: string, severity?: Severity) => {
const id = random.string({ length: 10 });

play();
setAlerts((prev) => [...prev, { id, severity: severity || 'info', text }]);
const timeout = setTimeout(() => removeAlert(id), TIME_TO_REMOVE_ALERT);

return () => clearTimeout(timeout);
}, [random, removeAlert, setAlerts]);
}, [play, random, removeAlert, setAlerts]);

return { alerts, notify, removeAlert };
}
6 changes: 5 additions & 1 deletion packages/extension-polkagate/src/partials/WebsitesAccess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import type { ExtensionPopupCloser } from '../util/handleExtensionPopup';
import { Box, Container, Stack, Typography } from '@mui/material';
import { Key, Link2, Profile, Trash } from 'iconsax-react';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import useSound from 'use-sound';

import { emptyList } from '../assets/icons/index';
import { heavy } from '../assets/sounds';
import { ActionButton, FadeOnScroll, MySnackbar, MyTooltip, SearchField } from '../components';
import { useIsExtensionPopup, useSelectedAccount, useTranslation } from '../hooks';
import { getAuthList, removeAuthorization } from '../messaging';
Expand Down Expand Up @@ -48,6 +50,7 @@ function AccessList ({ filteredAuthorizedDapps, setAccessToEdit, setRefresh, set
const selectedAccount = useSelectedAccount();
const refContainer = useRef(null);
const isExtension = useIsExtensionPopup();
const [play] = useSound(heavy, { volume: 0.2 });

const [isBusy, setIsBusy] = useState<boolean>();
const [showSnackbar, setShowSnackbar] = useState(false);
Expand All @@ -61,10 +64,11 @@ function AccessList ({ filteredAuthorizedDapps, setAccessToEdit, setRefresh, set
removeAuthorization(url)
.catch(console.error)
.finally(() => {
play();
setIsBusy(false);
setShowSnackbar(true);
});
}, []);
}, [play]);

const onEditList = useCallback((info: AuthUrlInfo) => {
setAccessToEdit(info);
Expand Down
4 changes: 4 additions & 0 deletions packages/extension/webpack.shared.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ module.exports = (entry, alias = {}) => ({
}
}
]
},
{
test: /\.(wav|mp3|ogg)$/,
type: 'asset/resource'
}
]
},
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13139,6 +13139,13 @@ __metadata:
languageName: node
linkType: hard

"howler@npm:^2.2.4":
version: 2.2.4
resolution: "howler@npm:2.2.4"
checksum: 10/e4177f6581ede99fdec68c2dc16a01e74ed3e4f3b28d4804030246f74f15a50311bd3d4d332a6e968a296e6bae1d0a8c8703e8e22d98ef8f5a3299e545e2fe55
languageName: node
linkType: hard

"hpack.js@npm:^2.1.6":
version: 2.1.6
resolution: "hpack.js@npm:2.1.6"
Expand Down Expand Up @@ -19512,6 +19519,7 @@ __metadata:
style-loader: "npm:^3.3.2"
typedoc: "npm:^0.27.9"
umi-request: "npm:^1.4.0"
use-sound: "npm:^5.0.0"
webpack-bundle-analyzer: "npm:^4.9.0"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -22103,6 +22111,17 @@ __metadata:
languageName: node
linkType: hard

"use-sound@npm:^5.0.0":
version: 5.0.0
resolution: "use-sound@npm:5.0.0"
dependencies:
howler: "npm:^2.2.4"
peerDependencies:
react: ">=16.8"
checksum: 10/36f701c65efd93c9d864d855ca758193b4fd8788a542a7954e6563176bf1cb0ca29ab19bdb29139c1e723a2f69e256c6bdccbc45a9dadaffcacda1460f716a0e
languageName: node
linkType: hard

"utf-8-validate@npm:^5.0.2":
version: 5.0.10
resolution: "utf-8-validate@npm:5.0.10"
Expand Down
Loading