Skip to content

Commit c589a66

Browse files
committed
Added styling to the toggle record button. Updated Time Jump Sidebar view where toggle record button is hidden. Added comments for toggle record button
1 parent cb5bb84 commit c589a66

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,14 @@ function ActionContainer(props): JSX.Element {
132132
setActionView(true);
133133
}, [setActionView]);
134134

135+
// Function sends message to background.js which sends message to the content script
135136
const toggleRecord = () => {
136137
port.postMessage({
137138
action: 'toggleRecord',
138139
tabId: currentTab,
139140
});
141+
// Record button's icon is being togggled on click
140142
setRecordingActions(!recordingActions);
141-
// change color of record button or switch svg/img file
142143
};
143144

144145
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
@@ -156,7 +157,7 @@ function ActionContainer(props): JSX.Element {
156157
</div>
157158
<a
158159
type="button"
159-
className="recordBtn"
160+
id="recordBtn"
160161
onClick={toggleRecord}
161162
>
162163
<i />

src/app/containers/MainContainer.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ function MainContainer(): any {
3030
setActionView(!actionView);
3131
const toggleElem = document.querySelector('aside');
3232
toggleElem.classList.toggle('no-aside');
33+
// hides the record toggle button from Actions Container in Time Jump sidebar view
34+
const recordBtn = document.getElementById('recordBtn');
35+
if (recordBtn.style.display === 'none') {
36+
recordBtn.style.display = 'flex';
37+
} else {
38+
recordBtn.style.display = 'none';
39+
}
3340
};
3441
// let port;
3542
useEffect(() => {

src/app/styles/components/_buttons.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,15 @@
321321

322322
/* sidebar button open and closing functionality */
323323
aside {
324-
width: 250px;
324+
// width: 250px;
325325
background: #242529;
326326
color: #fff;
327327
transition: width 1s;
328328
}
329329

330330
.no-aside {
331331
width: 30px;
332+
margin-right: 15px;
332333
}
333334

334335
.toggle {
@@ -352,8 +353,8 @@ aside {
352353
}
353354

354355
.toggle i {
355-
top: 46%;
356-
left: 4%;
356+
top: 8px;
357+
left: 9px;
357358
display: block;
358359
background: $blue-brand;
359360
}

src/app/styles/layout/_actionContainer.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@
99
color: #fffeff;
1010
}
1111

12-
.recordBtn{
13-
position: relative;
14-
left: 80%;
15-
height: 100vw;
16-
// visibility: hidden;
12+
#recordBtn{
13+
height: 100%;
14+
display:flex;
1715
}
16+
17+
.actionToolContainer{
18+
display: flex;
19+
justify-content: space-between;
20+
align-items: center;
21+
}
22+
23+
#recordBtn .fa-regular{
24+
height: 100%;
25+
width: 28px;
26+
}

src/extension/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ chrome.runtime.onConnect.addListener(port => {
211211
return true; // attempt to fix message port closing error, consider return Promise
212212
case 'toggleRecord':
213213
chrome.tabs.sendMessage(tabId, msg);
214-
return true; // attempt to fix message port closing error, consider return Promise
214+
return true;
215215
default:
216216
return true;
217217
}

src/extension/contentScript.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ window.addEventListener('message', msg => {
4141
// Listening for messages from the UI of the Reactime extension.
4242
chrome.runtime.onMessage.addListener(request => {
4343
const { action }: { action: string; } = request;
44-
// this is only listening for Jump toSnap
45-
4644
if (action) {
45+
// Message being sent from background.js
46+
// This is toggling the record button on Reactime when clicked
4747
if (action === 'toggleRecord') {
4848
isRecording = !isRecording;
4949
}
50-
50+
// this is only listening for Jump toSnap
5151
if (action === 'jumpToSnap') {
5252
chrome.runtime.sendMessage(request);
5353
}

0 commit comments

Comments
 (0)