Skip to content

Commit

Permalink
Merge pull request #21 from lxieyang/mute-feature
Browse files Browse the repository at this point in the history
fix #20, bump version to 1.6.0
  • Loading branch information
lxieyang committed Jan 7, 2020
2 parents d99d023 + 3e6eca8 commit 80ddc96
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
26 changes: 19 additions & 7 deletions src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -233,10 +234,22 @@ const Tab = ({
'MutedIconContainer',
isDark ? 'Dark' : null,
].join(' ')}
onClick={(e) => muteTabClickedHandler(e, id)}
>
<MdVolumeOff size={'16px'} />
</div>
)}
{!mutedInfo.muted && audible && (
<div
className={[
'MutedIconContainer',
isDark ? 'Dark' : null,
].join(' ')}
onClick={(e) => muteTabClickedHandler(e, id)}
>
<MdVolumeUp size={'16px'} />
</div>
)}
</div>

<div
Expand Down Expand Up @@ -321,10 +334,9 @@ const Tab = ({
<MenuItem onClick={(e) => pinTabClickedHandler(e, id)}>
{pinned ? 'Unpin' : 'Pin'} Tab
</MenuItem>
{/*
<MenuItem onClick={(e) => muteTabClickedHandler(e, id)}>
{muted ? 'Unmute' : 'Mute'} Tab
</MenuItem> */}
{mutedInfo.muted ? 'Unmute' : 'Mute'} This Tab
</MenuItem>

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

Expand Down
9 changes: 9 additions & 0 deletions src/pages/Sidebar/context/audio-context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';

const audioContext = React.createContext({
mutedHostnames: [],
muteHostname: () => {},
unmuteHostname: () => {},
});

export default audioContext;

0 comments on commit 80ddc96

Please sign in to comment.