Skip to content

Commit d99d023

Browse files
committed
display muted status
1 parent 456fbc4 commit d99d023

File tree

6 files changed

+54
-13
lines changed

6 files changed

+54
-13
lines changed

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.1",
3+
"version": "1.5.2",
44
"description": "A chrome extension that presents your tabs vertically.",
55
"license": "MIT",
66
"repository": {

src/pages/Sidebar/Sidebar.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ class Sidebar extends Component {
106106
]
107107
.join(' ')
108108
.toLowerCase(),
109+
mutedInfo: tab.mutedInfo,
110+
audible: tab.audible,
109111
};
110112

111113
tabOrders.push({
112114
id: tab.id,
113115
index: tab.index,
114116
active: tab.active,
115-
muted: tab.muted,
116117
});
117118
if (tab.active) {
118119
this.setState({
119120
activeTab: {
120121
id: tab.id,
121122
index: tab.index,
122123
active: tab.active,
123-
muted: tab.muted,
124124
},
125125
});
126126
}
@@ -160,6 +160,8 @@ class Sidebar extends Component {
160160
]
161161
.join(' ')
162162
.toLowerCase(),
163+
mutedInfo: tab.mutedInfo,
164+
audible: tab.audible,
163165
};
164166
this.setState({ tabsDict });
165167
};
@@ -182,7 +184,6 @@ class Sidebar extends Component {
182184
id: tab.id,
183185
index: tab.index,
184186
active: tab.active,
185-
muted: tab.muted,
186187
};
187188
tabOrders.push(tabObj);
188189
if (tab.active) {
@@ -204,7 +205,9 @@ class Sidebar extends Component {
204205
changes.status === 'complete' ||
205206
changes.title ||
206207
changes.pinned === true ||
207-
changes.pinned === false
208+
changes.pinned === false ||
209+
changes.mutedInfo ||
210+
changes.audible !== undefined
208211
) {
209212
this.updateTabsDictWithTab(tab, getFavicon(tab.url));
210213
if (changes.status === 'complete') {

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
border-top-right-radius: 8px;
6262
/* border-radius: 6px; */
6363

64-
transition: 0.1s all ease-in;
64+
transition: all 0.1s ease-in;
6565

6666
position: relative;
6767
}
@@ -117,14 +117,34 @@
117117
.TabTitleContainer {
118118
flex: 1;
119119
min-width: 0;
120+
121+
display: flex;
122+
align-items: center;
120123
}
121124

122125
.TabTitle {
126+
flex: 1;
127+
}
128+
129+
.Truncated {
123130
white-space: nowrap;
124131
overflow-x: hidden;
125132
text-overflow: ellipsis;
126133
}
127134

135+
.MutedIconContainer {
136+
margin-left: 2px;
137+
margin-right: 2px;
138+
width: 16px;
139+
height: 16px;
140+
align-items: center;
141+
color: rgb(124, 128, 130);
142+
}
143+
144+
.MutedIconContainer.Dark {
145+
color: rgb(190, 193, 198);
146+
}
147+
128148
.Ordinal {
129149
width: 20px;
130150
text-align: right;

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +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';
1213
import { FaThumbtack } from 'react-icons/fa';
1314

1415
import './Tab.css';
@@ -19,7 +20,8 @@ const Tab = ({
1920
index,
2021
active,
2122
pinned,
22-
muted,
23+
mutedInfo,
24+
audible,
2325
faviconUrl,
2426
title,
2527
url,
@@ -106,9 +108,9 @@ const Tab = ({
106108
chrome.tabs.update(id, { pinned: !pinned });
107109
};
108110

109-
const muteTabClickedHandler = (e, tabId) => {
110-
chrome.tabs.update(id, { muted: !muted });
111-
};
111+
// const muteTabClickedHandler = (e, tabId) => {
112+
// chrome.tabs.update(id, { muted: !muted });
113+
// };
112114

113115
const closeTabClickedHandler = (e, tabId) => {
114116
e.stopPropagation();
@@ -212,13 +214,29 @@ const Tab = ({
212214
/>
213215
)}
214216
</div>
217+
215218
<div
216219
className="TabTitleContainer"
217220
title={displayTabInFull ? url : `${title}\n\n${url}`}
218221
>
219-
<div className={displayTabInFull ? null : 'TabTitle'}>
222+
<div
223+
className={[
224+
'TabTitle',
225+
displayTabInFull ? null : 'Truncated',
226+
].join(' ')}
227+
>
220228
{title}
221229
</div>
230+
{mutedInfo.muted && audible && (
231+
<div
232+
className={[
233+
'MutedIconContainer',
234+
isDark ? 'Dark' : null,
235+
].join(' ')}
236+
>
237+
<MdVolumeOff size={'16px'} />
238+
</div>
239+
)}
222240
</div>
223241

224242
<div

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ class TabsList extends Component {
135135
index={tabOrder.index}
136136
active={tabOrder.active}
137137
pinned={tabOrder.pinned}
138-
muted={tabOrder.muted}
138+
mutedInfo={tabOrder.mutedInfo}
139+
audible={tabOrder.audible}
139140
faviconUrl={tabOrder.faviconUrl}
140141
title={tabOrder.title}
141142
url={tabOrder.url}

src/pages/Sidebar/containers/TabsList/react-contextmenu.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
.react-contextmenu-item:hover {
4343
color: #fff;
4444
background-color: rgb(31, 92, 209);
45-
border-color: rgb(31, 92, 209);
4645
}
4746

4847
.react-contextmenu-item:focus {

0 commit comments

Comments
 (0)