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
Document model V0 + UI/Engine Syncing with Redux + Project structuring #10
Conversation
tonyketcham
commented
Apr 6, 2022
•
edited
edited
- Adds Redux as the central state manager
- Seeds the design of the document model
- initial design in docs/audio-graph.md
- https://whimsical.com/project-HNvThW62PrN9Gp33UfAuRf@2Ux7TurymNHcs4gAfi4M
- initial design in docs/audio-graph.md
- Adds TS and Rust CI linting jobs
- implementing redux slices for backend functions - creating basic input components - start topbar component - move functionality and state out of App.tsx - make eslint less annoying - move a lot of deps to devDependencies in package.json - temporarily removing nanoid from dependencies (at least until needed) - cleaning up App.tsx a lot - implementing runtime formatting functions - add util module Changes committed: modified: .eslintrc.cjs modified: backend/src/main.rs new file: backend/src/util/format.rs new file: backend/src/util/mod.rs modified: package.json modified: src/App.tsx new file: src/components/common/Button.tsx new file: src/components/common/Input.tsx new file: src/components/common/base/ButtonBase.tsx new file: src/components/common/base/InputBase.tsx new file: src/components/common/base/styles.module.scss new file: src/components/common/styles.module.scss new file: src/components/topbar/PlayPauseButton.tsx new file: src/components/topbar/TempoInput.tsx new file: src/components/topbar/Topbar.tsx new file: src/components/topbar/TopbarBase.tsx new file: src/components/topbar/TopbarTimer.tsx new file: src/hooks/redux.ts modified: src/index.tsx deleted: src/reportWebVitals.ts new file: src/state/slices/playPausePlaylistSlice.ts new file: src/state/slices/playlistMetronomeEnabledSlice.ts new file: src/state/slices/playlistRuntimeSlice.ts new file: src/state/slices/playlistTempoSlice.ts modified: src/state/store.ts modified: tsconfig.json
backend/src/util/format.rs
Outdated
use chrono; | ||
|
||
pub fn format_playlist_runtime(start_ms: i64) -> String { | ||
let now_ts = chrono::offset::Local::now().timestamp(); | ||
let dur = now_ts - start_ms; | ||
|
||
let format = || -> String { | ||
let m = (dur as f32 / 60_000.).floor() as i64; | ||
let s = ((dur - (m * 60_000)) as f32 / 1_000.).floor() as i64; | ||
let ms = dur - (m * 60_000) - (s * 1_000); | ||
let mbufc: &str = if m < 10 { "0" } else { "" }; | ||
let sbufc: &str = if s < 10 { "0" } else { "" }; | ||
let msbufc: &str = if ms < 10 { "0" } else { "" }; | ||
format!("{sbufc}{m}:{mbufc}{s}:{msbufc}{ms}") | ||
}; | ||
|
||
format() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the future we might want to do this kind of UI-specific unit formatting in TypeScript and keep all the data sent from the engine in ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be fine for now since there's no interactivity with the playtime as it's purely a computed property based on where the playhead is
import { | ||
selectPlaylistPlaying, | ||
PlayPausePlaylistState | ||
} from '../../state/slices/playPausePlaylistSlice' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could set the baseUrl = "src"
in tsconfig
to avoid having to do any ../../
action 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need any vite configuration..? i think with webpack it might have been needed (?)
can we merge 💀 |
Still trying to get Clippy workin in CI... might need to bounce it out to a separate PR. in the meantime run: |
yeah give it one last rinse but I think we've beaten this thing to death and can just follow up w/ more PRs to correct Types, etc. |
66be5b3
to
bad9a7d
Compare
Document model V0 + UI/Engine Syncing with Redux + Project structuring