diff --git a/CHANGELOG.md b/CHANGELOG.md index d3fd325..196ef4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ All notable changes to this project will be documented in this file. # v1.x (official releases) +### [1.6.0](https://github.com/lxieyang/vertical-tabs-chrome-extension/releases/tag/v1.6.0) (2020-01-06) + +- **Mute** tabs with a single click. +- Fixed a bug regarding the context menu + ### [1.5.1](https://github.com/lxieyang/vertical-tabs-chrome-extension/releases/tag/v1.5.1) (2019-12-29) - Fixed a bug where the `new URL()` API returns invalid. diff --git a/package-lock.json b/package-lock.json index a75b52c..0d8589b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vertical-tabs-chrome-extension", - "version": "1.2.1", + "version": "1.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 888a74d..4b2f843 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vertical-tabs-chrome-extension", - "version": "1.5.2", + "version": "1.6.0", "description": "A chrome extension that presents your tabs vertically.", "license": "MIT", "repository": { diff --git a/src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx b/src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx index 1ea5367..1a37fcc 100644 --- a/src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx +++ b/src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx @@ -9,7 +9,7 @@ import { ContextMenu, MenuItem, ContextMenuTrigger } from 'react-contextmenu'; import { MdClose } from 'react-icons/md'; import { MdRefresh } from 'react-icons/md'; -import { MdVolumeOff } from 'react-icons/md'; +import { MdVolumeOff, MdVolumeUp } from 'react-icons/md'; import { FaThumbtack } from 'react-icons/fa'; import './Tab.css'; @@ -108,9 +108,10 @@ const Tab = ({ chrome.tabs.update(id, { pinned: !pinned }); }; - // const muteTabClickedHandler = (e, tabId) => { - // chrome.tabs.update(id, { muted: !muted }); - // }; + const muteTabClickedHandler = (e, tabId) => { + e.stopPropagation(); + chrome.tabs.update(id, { muted: mutedInfo.muted ? false : true }); + }; const closeTabClickedHandler = (e, tabId) => { e.stopPropagation(); @@ -233,10 +234,22 @@ const Tab = ({ 'MutedIconContainer', isDark ? 'Dark' : null, ].join(' ')} + onClick={(e) => muteTabClickedHandler(e, id)} > )} + {!mutedInfo.muted && audible && ( +
muteTabClickedHandler(e, id)} + > + +
+ )}
pinTabClickedHandler(e, id)}> {pinned ? 'Unpin' : 'Pin'} Tab - {/* muteTabClickedHandler(e, id)}> - {muted ? 'Unmute' : 'Mute'} Tab - */} + {mutedInfo.muted ? 'Unmute' : 'Mute'} This Tab + diff --git a/src/pages/Sidebar/context/audio-context.js b/src/pages/Sidebar/context/audio-context.js new file mode 100644 index 0000000..4efe040 --- /dev/null +++ b/src/pages/Sidebar/context/audio-context.js @@ -0,0 +1,9 @@ +import React from 'react'; + +const audioContext = React.createContext({ + mutedHostnames: [], + muteHostname: () => {}, + unmuteHostname: () => {}, +}); + +export default audioContext;