Skip to content

Commit 3e6eca8

Browse files
committed
support #20
1 parent d99d023 commit 3e6eca8

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ All notable changes to this project will be documented in this file.
1212

1313
# v1.x (official releases)
1414

15+
### [1.6.0](https://github.com/lxieyang/vertical-tabs-chrome-extension/releases/tag/v1.6.0) (2020-01-06)
16+
17+
- **Mute** tabs with a single click.
18+
- Fixed a bug regarding the context menu
19+
1520
### [1.5.1](https://github.com/lxieyang/vertical-tabs-chrome-extension/releases/tag/v1.5.1) (2019-12-29)
1621

1722
- Fixed a bug where the `new URL()` API returns invalid.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vertical-tabs-chrome-extension",
3-
"version": "1.5.2",
3+
"version": "1.6.0",
44
"description": "A chrome extension that presents your tabs vertically.",
55
"license": "MIT",
66
"repository": {

src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ContextMenu, MenuItem, ContextMenuTrigger } from 'react-contextmenu';
99

1010
import { MdClose } from 'react-icons/md';
1111
import { MdRefresh } from 'react-icons/md';
12-
import { MdVolumeOff } from 'react-icons/md';
12+
import { MdVolumeOff, MdVolumeUp } from 'react-icons/md';
1313
import { FaThumbtack } from 'react-icons/fa';
1414

1515
import './Tab.css';
@@ -108,9 +108,10 @@ const Tab = ({
108108
chrome.tabs.update(id, { pinned: !pinned });
109109
};
110110

111-
// const muteTabClickedHandler = (e, tabId) => {
112-
// chrome.tabs.update(id, { muted: !muted });
113-
// };
111+
const muteTabClickedHandler = (e, tabId) => {
112+
e.stopPropagation();
113+
chrome.tabs.update(id, { muted: mutedInfo.muted ? false : true });
114+
};
114115

115116
const closeTabClickedHandler = (e, tabId) => {
116117
e.stopPropagation();
@@ -233,10 +234,22 @@ const Tab = ({
233234
'MutedIconContainer',
234235
isDark ? 'Dark' : null,
235236
].join(' ')}
237+
onClick={(e) => muteTabClickedHandler(e, id)}
236238
>
237239
<MdVolumeOff size={'16px'} />
238240
</div>
239241
)}
242+
{!mutedInfo.muted && audible && (
243+
<div
244+
className={[
245+
'MutedIconContainer',
246+
isDark ? 'Dark' : null,
247+
].join(' ')}
248+
onClick={(e) => muteTabClickedHandler(e, id)}
249+
>
250+
<MdVolumeUp size={'16px'} />
251+
</div>
252+
)}
240253
</div>
241254

242255
<div
@@ -321,10 +334,9 @@ const Tab = ({
321334
<MenuItem onClick={(e) => pinTabClickedHandler(e, id)}>
322335
{pinned ? 'Unpin' : 'Pin'} Tab
323336
</MenuItem>
324-
{/*
325337
<MenuItem onClick={(e) => muteTabClickedHandler(e, id)}>
326-
{muted ? 'Unmute' : 'Mute'} Tab
327-
</MenuItem> */}
338+
{mutedInfo.muted ? 'Unmute' : 'Mute'} This Tab
339+
</MenuItem>
328340

329341
<MenuItem divider className={[isDark ? 'Dark' : null].join(' ')} />
330342

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
const audioContext = React.createContext({
4+
mutedHostnames: [],
5+
muteHostname: () => {},
6+
unmuteHostname: () => {},
7+
});
8+
9+
export default audioContext;

0 commit comments

Comments
 (0)