Skip to content

Commit

Permalink
fix: remove showSelectingArea
Browse files Browse the repository at this point in the history
  • Loading branch information
maltoze committed Aug 24, 2023
1 parent a967e89 commit 15f8073
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
19 changes: 7 additions & 12 deletions src/entries/contentScript/primary/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function App({ appRoot }: AppProps) {
isRecording,
countdown,
area,
showSelectingArea,
showMouseClicks,
} = useStore((state) => ({
scrollbarHidden: state.scrollbarHidden,
Expand All @@ -38,7 +37,6 @@ function App({ appRoot }: AppProps) {
showCountdown: state.showCountdown,
isRecording: state.isRecording,
countdown: state.countdown,
showSelectingArea: state.showSelectingArea,
area: state.area,
showMouseClicks: state.showMouseClicks,
}))
Expand Down Expand Up @@ -88,11 +86,6 @@ function App({ appRoot }: AppProps) {
switch (message.type) {
case 'show-controlbar':
setShowControlbar(true)
if (recordingMode === 'area') {
useStore.setState({
showSelectingArea: true,
})
}
break
case 'start-recording':
setIsRecording(true)
Expand All @@ -102,7 +95,6 @@ function App({ appRoot }: AppProps) {
break
case 'stop-recording':
setIsRecording(false)
useStore.setState({ showSelectingArea: false })
tabCaptureModes.includes(recordingMode) &&
window.removeEventListener('keydown', handleKeyDown)
break
Expand Down Expand Up @@ -147,8 +139,8 @@ function App({ appRoot }: AppProps) {
setShowControlbar(false)

const recordingDelay = 100
setIsRecording(true)
setTimeout(() => {
setIsRecording(true)
chrome.runtime.sendMessage({
type: 'start-recording',
target: 'background',
Expand All @@ -165,19 +157,22 @@ function App({ appRoot }: AppProps) {

function handleOnClose() {
setShowControlbar(false)
useStore.setState({ showSelectingArea: false })
}

return (
<>
{showCountdown && (
<Countdown count={countdown} onFinish={startRecording} />
)}
<StrokeKeysDisplay strokeKeys={strokeKeys} />
{isRecording && showKeystrokes && (
<StrokeKeysDisplay strokeKeys={strokeKeys} />
)}
{showControlbar && (
<Controlbar appRoot={appRoot} onClose={handleOnClose} />
)}
{showSelectingArea && <SelectingArea />}
{recordingMode === 'area' && (isRecording || showControlbar) && (
<SelectingArea />
)}
{showMouseClicks && isRecording && <MouseClick />}
</>
)
Expand Down
3 changes: 0 additions & 3 deletions src/entries/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface IState {
showKeystrokes: boolean
showControlbar: boolean
showCountdown: boolean
showSelectingArea: boolean
recordingMode: RecordingMode
countdown: number
showMouseClicks: boolean
Expand All @@ -30,7 +29,6 @@ const persistKeys = [
'isRecording',
'countdown',
'showMouseClicks',
'showSelectingArea',
'area',
'recordingMode',
]
Expand All @@ -44,7 +42,6 @@ export const useStore = create<IState>()(
audio: false,
showControlbar: false,
showCountdown: false,
showSelectingArea: false,
recordingMode: 'tab',
countdown: 3,
area: {
Expand Down

0 comments on commit 15f8073

Please sign in to comment.