mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 07:03:24 +00:00
add inactive icon if the domain is not whitelisted
This commit is contained in:
BIN
assets/active.png
Normal file
BIN
assets/active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
assets/icon.development.png
Normal file
BIN
assets/icon.development.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/inactive.png
Normal file
BIN
assets/inactive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
13
package.json
13
package.json
@@ -54,6 +54,17 @@
|
||||
"gecko": {
|
||||
"id": "{3fd86354-c73f-4395-9e26-2c5c984579bf}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": [
|
||||
"assets/active.png",
|
||||
"assets/inactive.png"
|
||||
],
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
|
||||
import { usePermission } from '~hooks/usePermission';
|
||||
import { useDomainStorage } from '~utils/storage';
|
||||
@@ -27,6 +27,11 @@ export function useToggleWhitelistDomain(domain: string) {
|
||||
const { domainWhitelist, addDomain, removeDomain } = useDomainWhitelist();
|
||||
const isWhitelisted = domainWhitelist.includes(domain);
|
||||
const { grantPermission } = usePermission();
|
||||
const iconPath = (chrome || browser).runtime.getURL(isWhitelisted ? 'assets/active.png' : 'assets/inactive.png');
|
||||
|
||||
(chrome || browser).action.setIcon({
|
||||
path: iconPath,
|
||||
});
|
||||
|
||||
const toggle = useCallback(() => {
|
||||
if (!isWhitelisted) {
|
||||
|
Reference in New Issue
Block a user