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

Document model V0 + UI/Engine Syncing with Redux + Project structuring #10

Merged
merged 17 commits into from Apr 8, 2022

Conversation

tonyketcham
Copy link
Collaborator

@tonyketcham tonyketcham commented Apr 6, 2022

@tonyketcham tonyketcham added documentation Improvements or additions to documentation help wanted Extra attention is needed DocumentModel labels Apr 6, 2022
package.json Outdated Show resolved Hide resolved
- 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
@nbennett320 nbennett320 marked this pull request as ready for review April 7, 2022 21:40
Comment on lines 1 to 18
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()
}
Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

src/state/store.ts Outdated Show resolved Hide resolved
import {
selectPlaylistPlaying,
PlayPausePlaylistState
} from '../../state/slices/playPausePlaylistSlice'
Copy link
Collaborator Author

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 😉

Copy link
Owner

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 (?)

@nbennett320 nbennett320 changed the title Document model V0 Document model V0 + UI/Engine Syncing with Redux + Project structuring Apr 7, 2022
@nbennett320 nbennett320 added this to In Progress 🤠 in Roadmap via automation Apr 7, 2022
@nbennett320 nbennett320 removed this from In Progress 🤠 in Roadmap Apr 7, 2022
@nbennett320
Copy link
Owner

can we merge 💀

@tonyketcham
Copy link
Collaborator Author

Still trying to get Clippy workin in CI... might need to bounce it out to a separate PR. in the meantime run:
cargo clippy && cargo check

@tonyketcham
Copy link
Collaborator Author

can we merge 💀

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.

@nbennett320 nbennett320 merged commit 623b7c1 into main Apr 8, 2022
@nbennett320 nbennett320 deleted the feature/state branch April 8, 2022 14:10
nbennett320 added a commit that referenced this pull request Jun 24, 2022
Document model V0 + UI/Engine Syncing with Redux + Project structuring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation DocumentModel help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants