Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UT-206: Adding soft-delete of thumbnails #78

Merged
merged 28 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c2885d0
UT-206: adds initially needed booleans to keep track of hidden/hiding…
andr9528 Feb 10, 2023
7480933
UT-206: continues on adding a functional button for UT-207.
andr9528 Feb 10, 2023
e1639d7
UT-206: renames new constants to match other similar ones.
andr9528 Feb 10, 2023
f9803a6
UT-206: fixes 'hiding' button not toggling. Finishes UT-207.
andr9528 Feb 13, 2023
2e97520
UT-206: mainly applies changes suggested in PR for UT-207.
andr9528 Feb 13, 2023
c833dac
UT-206: applies some skyling to a ternary operator.
andr9528 Feb 13, 2023
d504673
UT-206: makes files hideable.
andr9528 Feb 14, 2023
1f2d4af
UT-206: enables persisting of hiddenFiles between sessions.
andr9528 Feb 14, 2023
fbd71e1
UT-206: removes leftover console.logs
andr9528 Feb 14, 2023
593697e
UT-206: Applies changes for PR (UT-208) comments and updating of hidd…
andr9528 Feb 15, 2023
3561e5f
UT-206: Adds Footer and moves some styling to CSS. UT-209 ready for r…
andr9528 Feb 16, 2023
2468297
UT-206: Improves footer and moves the new button to under settings.
andr9528 Feb 17, 2023
fcb0c33
UT-206: applies changes requested in PR.
andr9528 Feb 20, 2023
7a09156
UT-206: chore: updates content of constant that i missed earlier.
andr9528 Feb 20, 2023
779b3db
UT-206: fixes single channel view not working.
andr9528 Feb 22, 2023
0bcd958
UT-206: Fixes hidden files wiping if attempting to hide on multiple o…
andr9528 Feb 22, 2023
e4023d8
UT-206: Adds missing question mark for undefined check.
andr9528 Feb 22, 2023
6bf1df1
Revert "UT-206: Fixes hidden files wiping if attempting to hide on mu…
andr9528 Feb 23, 2023
06597e0
UT-206: fix: fixes hidden files being cleared on load, while keeping …
andr9528 Feb 23, 2023
5a0a950
UT-206: breaks up footer into smaller components
andr9528 Feb 24, 2023
f49cc6e
UT-206: makes adjustments in response to PR comments.
andr9528 Feb 24, 2023
5791d9e
UT-206: makes more adjustments in response to PR comments.
andr9528 Feb 24, 2023
f78ebae
UT-206: revert changes to redux related switches.
andr9528 Feb 27, 2023
84a7201
UT-206: applies changes from PR comments.
andr9528 Feb 28, 2023
0db0cf6
UT-206: fixes being able to hide a used file via another output.
andr9528 Mar 1, 2023
55db8a8
UT-206: applies changes for comments on PR.
andr9528 Mar 1, 2023
3fdbe6f
UT-206: refactor: renames some functions and eliminates a loop in fav…
andr9528 Mar 6, 2023
f425a33
UT-206: refactor: manually cherry picked footer changes from UT-211/r…
andr9528 Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ ehthumbs.db
# Windows shortcuts #
#####################
*.lnk
/storage/hiddenFiles.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this JSON do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a file generated by Cliptool now, that contains a Record of which files are hidden, with their size and changed values.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use localStorage?

7 changes: 5 additions & 2 deletions src/client/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import React from 'react'
import { Tabs } from 'rmc-tabs'
import { reduxStore, reduxState } from '../../model/reducers/store'
import { useSelector } from 'react-redux'
import { setActiveTab } from '../../model/reducers/appNavAction'

// Components:
import { Thumbnail } from './Thumbnail'
import { RenderFullHeader } from './Header'

//CSS files:
import '../css/Rmc-tabs.css'
import '../css/App.css'
import { setActiveTab } from '../../model/reducers/appNavAction'
import { RenderFullHeader } from './Header'
import { OperationModeFooter } from './Footer/OperationModeFooter'

const channel = new URLSearchParams(window.location.search).get('channel')
const specificChannel = parseInt(channel) || 0
Expand All @@ -29,6 +30,7 @@ export const App = () => {
<Thumbnail />
</div>
</div>
<OperationModeFooter />
</div>
)
} else {
Expand All @@ -44,6 +46,7 @@ export const App = () => {
{renderTabData()}
</Tabs>
</div>
<OperationModeFooter />
</div>
)
}
Expand Down
16 changes: 16 additions & 0 deletions src/client/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import '../../css/Footer.css'



interface FooterProps {
children: React.ReactNode
}

export function Footer({ children }: FooterProps): JSX.Element {
return (
<footer className='Footer'>
{ children }
</footer>
)
}
33 changes: 33 additions & 0 deletions src/client/components/Footer/OperationModeEditVisibilityFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react"
import { OperationMode } from "../../../model/reducers/mediaReducer"
import { reduxState } from "../../../model/reducers/store"
import * as IO from '../../../model/SocketIoConstants'
import { socket } from '../../util/SocketClientHandlers'
import { Footer } from "./Footer"
import "../../css/Operation-mode-edit-visibility-footer.css"

const BUTTON_TEXT = 'Exit Edit Visibility'
const DESCRIPTION_TEXT = 'You are currently editing the visibility of files.'.toUpperCase()

function resetOperationMode(): void {
socket.emit(
IO.SET_OPERATION_MODE,
reduxState.appNav[0].activeTab,
OperationMode.CONTROL
)
}

export function OperationModeEditVisibilityFooter(): JSX.Element {
return (
<Footer>
<div className="operation-mode-edit-visibility-footer">
<div className="operation-mode-edit-visibility-footer__text">
{ DESCRIPTION_TEXT }
</div>
<div className="operation-mode-edit-visibility-footer__controls">
<button onClick={ resetOperationMode }>{ BUTTON_TEXT }</button>
</div>
</div>
</Footer>
)
}
20 changes: 20 additions & 0 deletions src/client/components/Footer/OperationModeFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { useSelector } from 'react-redux'
import { OperationMode } from '../../../model/reducers/mediaReducer'
import { reduxState } from '../../../model/reducers/store'
import { OperationModeEditVisibilityFooter } from './OperationModeEditVisibilityFooter'

export function OperationModeFooter(): JSX.Element {
const operationMode: OperationMode = useSelector((storeUpdate: any) =>
storeUpdate.media[0].output[reduxState.appNav[0].activeTab]?.operationMode)

switch (operationMode) {
case OperationMode.EDIT_VISIBILITY: {
return <OperationModeEditVisibilityFooter />
}
case OperationMode.CONTROL:
default: {
return <></>
}
}
}
15 changes: 7 additions & 8 deletions src/client/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { secondsToTimeCode } from '../util/TimeCodeToString'
import { TOGGLE_SHOW_SETTINGS } from '../../model/reducers/appNavAction'

import * as IO from '../../model/SocketIoConstants'
import { findThumbPix } from './Thumbnail'
import { findThumbnail } from './Thumbnail'
import { SettingsPage } from './Settings'

const OFF_COLOR = { backgroundColor: 'grey' }
Expand All @@ -30,7 +30,7 @@ const RenderTime = () => {
)}
</button>
<img
src={findThumbPix(
src={findThumbnail(
reduxState.media[0].output[reduxState.appNav[0].activeTab]
?.tallyFile,
reduxState.appNav[0].activeTab
Expand Down Expand Up @@ -98,6 +98,7 @@ const handleManualStartStatus = () => {
.manualstartState
)
}

export const RenderFullHeader = () => {
// Redux hook:
useSelector((storeUpdate) => storeUpdate, shallowEqual)
Expand All @@ -123,9 +124,7 @@ export const RenderFullHeader = () => {
<div className="App-button-background">
<button
className="App-switch-button"
onClick={() => {
handleLoopStatus()
}}
onClick={handleLoopStatus}
style={loopStateStyle()}
>
LOOP
Expand All @@ -134,7 +133,7 @@ export const RenderFullHeader = () => {
<div className="App-button-background">
<button
className="App-switch-button"
onClick={() => handleMixStatus()}
onClick={handleMixStatus}
style={mixStateStyle()}
>
MIX
Expand All @@ -143,7 +142,7 @@ export const RenderFullHeader = () => {
<div className="App-button-background">
<button
className="App-switch-button"
onClick={() => handleWebState()}
onClick={handleWebState}
style={webStateStyle()}
>
OVERLAY
Expand All @@ -157,7 +156,7 @@ export const RenderFullHeader = () => {
<div className="App-button-background">
<button
className="App-switch-button"
onClick={() => handleManualStartStatus()}
onClick={handleManualStartStatus}
style={
reduxState.media[0].output[
reduxState.appNav[0].activeTab
Expand Down
36 changes: 31 additions & 5 deletions src/client/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import { setGenerics } from '../../model/reducers/settingsAction'
import { socket } from '../util/SocketClientHandlers'
import * as IO from '../../model/SocketIoConstants'
import { TOGGLE_SHOW_SETTINGS } from '../../model/reducers/appNavAction'
import { OperationMode } from '../../model/reducers/mediaReducer'

// Check if URL has specifiet a channel:
const channel = new URLSearchParams(window.location.search).get('channel')
const specificChannel = parseInt(channel) || 0

const OFF_COLOR = { backgroundColor: 'rgb(41, 41, 41)' }
const ON_COLOR = { backgroundColor: 'rgb(28, 115, 165)' }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be CSS classes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be extracted to CSS, along with a few other areas with similar created styling code, during my refactor of the code structure.


//Set style for Select dropdown component:
const selectorColorStyles = {
control: (styles) => ({
Expand All @@ -27,6 +31,23 @@ const selectorColorStyles = {
singleValue: (styles) => ({ ...styles, color: 'white' }),
}

function emitSetOperationMode() {
socket.emit(
IO.SET_OPERATION_MODE,
reduxState.appNav[0].activeTab,
reduxState.media[0].output[reduxState.appNav[0].activeTab]
.operationMode !== OperationMode.EDIT_VISIBILITY
? OperationMode.EDIT_VISIBILITY
: OperationMode.CONTROL
)
}

function getEditVisibilityStyle(): { backgroundColor: string } {
return reduxState.media[0].output[reduxState.appNav[0].activeTab]?.operationMode === OperationMode.EDIT_VISIBILITY
? ON_COLOR
: OFF_COLOR
}

export const SettingsPage = () => {
const handleSettingsPage = () => {
reduxStore.dispatch({
Expand Down Expand Up @@ -132,16 +153,14 @@ export const SettingsPage = () => {
<div className="Settings-channel-form">
<button
className="save-button"
onClick={() => {
handleSave()
}}
onClick={handleSave}
>
UPDATE CLIPTOOL SETTINGS
</button>
{!specificChannel ? (
<button
className="save-button"
onClick={() => handleRestart()}
onClick={handleRestart}
>
RESTART CLIPTOOL
</button>
Expand All @@ -150,10 +169,17 @@ export const SettingsPage = () => {
)}
<button
className="save-button"
onClick={() => handleSettingsPage()}
onClick={handleSettingsPage}
>
EXIT
</button>
<button
className="save-button"
onClick={emitSetOperationMode}
style={getEditVisibilityStyle()}
>
EDIT VISIBILITY
</button>
</div>
</div>
)
Expand Down
Loading