Commit Graph

7895 Commits

Author SHA1 Message Date
Nuwan fc2b263550 docs(02-01): confirm UAT-004 resolved 2026-01-14 11:53:27 +05:30
Nuwan 0db622ad64 docs(02-01): document UAT-004 seek to end issue and resolution
Added UAT-004 to Open Issues with full description, root cause analysis,
and resolution details. Also added to Resolved Issues section.
2026-01-14 11:30:14 +05:30
Nuwan ba93f1a270 fix(02-01): handle seek to end edge case in backing track player
UAT-004: When seeking to end while paused, then clicking play, the
player would break (slider jumps to 0, no audio, play button stops working).

Root cause: jamClient enters end-of-track state when position >= duration.
Calling SessionStartPlay() without resetting causes undefined behavior.

Solution:
- Detect when position is at/near end (within 100ms)
- Call SessionStopPlay() to reset jamClient state
- Seek to position 0
- Then start playback normally

Also added diagnostic logging to handlePlay, handleSeek, and polling
to help debug playback state transitions.
2026-01-14 11:29:37 +05:30
Nuwan 2c5ba2f4bc fix(uat-02-01): parse string values and add playback mode parameter
Fixes UAT-002 (continued): Slider not moving, time not updating

Two issues discovered:
1. jamClient returns string values ('0', '228818') not numbers
2. SessionStartPlay() requires playback mode parameter (missing in our code)

Solution:
- Use parseInt() to convert jamClient string returns to numbers
- Pass playback mode parameter 1 (normal playback) to SessionStartPlay()
- Matches legacy implementation: SessionStartPlay(1) or SessionStartPlay(data.playbackMode)

This should enable:
- Slider to move during playback (now has numeric position values)
- Audio to actually start playing (correct API call with parameter)
- Time displays to update correctly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 11:02:57 +05:30
Nuwan 2a435806e7 fix(uat-02-01): await async jamClient methods to fix NaN values
Fixes UAT-002: Player showing NaN:NaN and slider positioning incorrectly

Root Cause: jam-ui's jamClientProxy uses Proxy pattern where ALL methods
return Promises (via sendWhenReady → sendMessage → deferred.promise). Code
was calling SessionGetTracksPlayDurationMs(), SessionCurrrentPlayPosMs(),
and isSessionTrackPlaying() synchronously without await.

Result: Promise objects were passed to formatTime() and slider calculations,
causing NaN values and incorrect slider behavior.

Solution:
- Wrapped initialization duration fetch in async function with await
- Changed polling setInterval callback to async function with await for all calls
- Now correctly awaits all jamClient Promise-based methods

This matches jam-ui's async jamClient architecture (different from legacy
web's synchronous bridge API).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 10:45:08 +05:30
Nuwan 0561c8988b fix(uat-02-01): add defensive checks for NaN values in playback monitoring
Addresses UAT-002 (to be logged): Player showing NaN:NaN for time displays

Problem: jamClient methods returning undefined/null/NaN values causing
time displays to show "NaN:NaN" and slider to position incorrectly.

Solution:
- Add null/NaN checks to formatTime utility (return "0:00" for invalid values)
- Add validation in initialization useEffect for duration values
- Add validation in polling useEffect for position and duration values
- Add console logging to diagnose what jamClient methods are returning

This ensures the UI displays valid times even when jamClient returns
unexpected values, and provides logging to diagnose the root cause.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 10:40:39 +05:30
Nuwan 94d43fe9ce fix(uat-02-01): remove jamClient from Redux state to fix immutability violation
Fixes UAT-001: Backing track player not opening due to Redux state mutation error

Problem: jamClient object (non-serializable) was being stored in Redux state at
activeSession.backingTrackData.jamClient, causing Redux to throw immutability
violation errors when dispatching setBackingTrackData action.

Solution:
- Remove jamClient from Redux state in setBackingTrackData dispatch
- Pass jamClient directly as prop from JKSessionScreen component scope
- jamClient remains accessible to JKSessionBackingTrackPlayer without Redux storage

This fixes the blocker preventing backing track player from opening and allows
Phase 2 seek functionality testing to proceed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 23:54:27 +05:30
Nuwan 6e69c89743 docs(02-01): complete backing track seek controls plan
Tasks completed: 3/3
- Add state for position in milliseconds
- Wire slider to reflect current position
- Implement functional handleSeek

SUMMARY: .planning/phases/02-backing-track-seek-controls/02-01-SUMMARY.md

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 23:41:46 +05:30
Nuwan 18afc9370a feat(02-01): implement functional handleSeek
Replace placeholder handleSeek with functional implementation that
calls jamClient.SessionTrackSeekMs(). Uses optimistic UI update for
responsive UX, then seeks the native client. Polling useEffect will
sync actual position within 500ms to correct any drift.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 23:40:08 +05:30
Nuwan 491c0a68e0 feat(02-01): wire slider to reflect current position
Update seek slider inputs in both popup and modal versions to use
currentPositionMs state for value and durationMs for max range.
Slider now reflects live playback position and updates automatically
during playback via polling useEffect.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 23:39:54 +05:30
Nuwan 209cefcf22 feat(02-01): add state for position in milliseconds
Add currentPositionMs and durationMs state variables to track playback
position in numeric form for slider calculations, separate from formatted
string display values. Update initialization and polling useEffects to
maintain both numeric and formatted values. Reset position on stop.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 23:39:32 +05:30
Nuwan 2e312849a6 docs(02): plan backing track seek controls
Create executable plan for Phase 2 with 3 tasks:
- Add state for position/duration in milliseconds
- Wire slider to reflect current position
- Implement functional handleSeek with SessionTrackSeekMs()

Plan: .planning/phases/02-backing-track-seek-controls/02-01-PLAN.md
Updates: ROADMAP.md (Phase 2: 0/1 planned), STATE.md (Phase 2 current)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 20:35:30 +05:30
Nuwan 4a3f09436a docs(01-01): complete backing track playback monitoring plan
Tasks completed: 3/3
- Add formatTime utility function
- Add playback monitoring with 500ms polling
- Initialize duration on track load

SUMMARY: .planning/phases/01-backing-track-playback-monitoring/01-01-SUMMARY.md
2026-01-13 20:24:56 +05:30
Nuwan 84b3b2ccbe feat(01-01): initialize duration immediately when track loads
- Fetches duration via jamClient.SessionGetTracksPlayDurationMs() on open
- Displays duration before playback starts (e.g., "5:13" shown immediately)
- Error handling falls back to "0:00" if fetch fails
- Matches legacy web behavior of showing duration on load

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 20:22:17 +05:30
Nuwan e33983e150 feat(01-01): add 500ms playback monitoring with jamClient polling
- Polls jamClient.SessionCurrrentPlayPosMs() every 500ms when playing
- Updates currentTime and duration displays with formatted values
- Syncs isPlaying state with jamClient.isSessionTrackPlaying()
- Cleans up interval on pause/stop to prevent memory leaks
- Error handling logs to console but continues polling

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 20:22:06 +05:30
Nuwan df94ec7d08 feat(01-01): add formatTime utility function for M:SS time display
- Converts milliseconds to M:SS format matching legacy web prettyPrintSeconds
- No padding on minutes (1:02 not 01:02)
- Pads seconds with leading zero when needed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 20:21:51 +05:30
Nuwan cee0bf05f5 docs(1): create phase plan
Phase 1: Backing Track Playback Monitoring
- 1 plan created
- 3 total tasks defined
- Ready for execution
2026-01-13 20:19:19 +05:30
Nuwan 19115cf121 docs(1): capture phase context
Phase 1: Backing Track Playback Monitoring
- Vision and goals documented
- Essential requirements identified
- Scope boundaries defined
2026-01-13 20:15:56 +05:30
Nuwan 5566d487b1 docs: initialize JamKazam Media Features Modernization (7 phases)
Modernize media opening features (Backing Track, JamTrack, Metronome) from legacy jQuery/Rails to React patterns in jam-ui

Phases:
1. Backing Track Playback Monitoring: Implement 500ms polling, display duration and current time
2. Backing Track Seek Controls: Functional seek bar with drag-to-position
3. Backing Track Finalization: Error handling, edge cases, performance optimization
4. JamTrack Research & Design: Explore legacy implementation, design React patterns
5. JamTrack Implementation: Build player with mixdown selection and controls
6. Metronome Research & Design: Explore legacy implementation, design React patterns
7. Metronome Implementation: Build metronome with tempo/sound/cricket configuration
2026-01-13 20:02:23 +05:30
Nuwan 664eb47483 docs: initialize JamKazam Media Features Modernization
Modernize media opening features (Backing Track, JamTrack, Metronome) from legacy jQuery/Rails to React patterns in jam-ui

Creates PROJECT.md with requirements and constraints.
2026-01-13 19:40:53 +05:30
Nuwan aea78a65a8 more redux
convert media and mixer related state in to redux.
2026-01-13 18:17:14 +05:30
Nuwan 25e049c4f5 feat: Phase 4 - eliminate CurrentSessionContext, consolidate to Redux single source of truth
Complete migration from CurrentSessionContext to Redux for all session state management:

Core Redux enhancements:
- Add selectInSession selector to replace inSession() function
- Add updateSessionData action for partial session updates

Hooks migrated (6 files):
- useSessionModel.js: Complex migration with ref pattern for performance
- useSessionHelper.js: Migrate to Redux selectors
- useRecordingHelpers.js: Use selectSessionId from Redux
- useMixerStore.js: Use selectInSession from Redux
- useMixerHelper.js: Migrate currentSession and inSession to Redux
- Remove CurrentSessionContext usage across all hooks

Components migrated (3 files):
- JKSessionScreen.js: Remove context, add Redux with ref pattern
- JKSessionRemoteTracks.js: Migrate to Redux selectors
- JKSessionOpenMenu.js: Remove unused context import

Context cleanup:
- JKClientLayout.js: Remove CurrentSessionProvider from component tree
- CurrentSessionContext.js: Add comprehensive deprecation warning

Testing:
- Add 5 new Phase 4 unit tests for selectInSession and updateSessionData
- All 56 tests passing (21 Phase 1 + 25 Phase 2 + 5 Phase 3 + 5 Phase 4)

Migration benefits:
- Single source of truth in Redux for all session state
- No more duplicate state between context and Redux
- Better debugging with Redux DevTools
- Consistent patterns across all phases

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 17:46:08 +05:30
Nuwan 05c7b847fc feat: Phase 3 - migrate entity collections to Redux with comprehensive testing
Phase 3 - Entity Collections Migration:
- Migrated jam track state to Redux (selectedJamTrack, jamTrackStems)
- Migrated backing track data to Redux (backingTrackData)
- Added session metadata support (sessionRules, subscriptionRules) for future use
- Removed 3 unused legacy state variables from JKSessionScreen

Redux State Extensions (activeSessionSlice):
- Added sessionRules, subscriptionRules, backingTrackData to state
- Added setSessionRules, setSubscriptionRules actions
- Added setBackingTrackData, clearBackingTrackData actions
- Added setJamTrackStems action (was already in slice but not fully utilized)
- Added selectors for all Phase 3 state

Component Updates (JKSessionScreen):
- Removed unused state: sessionRules, subscriptionRules, currentOrLastSession
- Migrated selectedJamTrack, jamTrackStems to Redux
- Migrated backingTrackData to Redux
- Updated handleJamTrackSelect to dispatch Redux actions
- Updated handleJamTrackClose to dispatch Redux actions
- Updated handleBackingTrackSelected to dispatch Redux actions
- Updated handleBackingTrackClose to dispatch Redux actions

Testing:
- Added 15 comprehensive unit tests for Phase 3 functionality
  - 4 jam track action tests
  - 3 backing track action tests
  - 3 session metadata action tests
  - 5 selector tests
- All 72 tests passing (21 Phase 1 + 51 Phase 2 & 3)

Documentation:
- Created PHASE3_MIGRATION_SUMMARY.md with complete migration details
- Updated run-phase-tests.sh to reflect Phase 3 scope
- Test runner now displays "Phase 1, 2 & 3" messaging

Benefits:
- Complete entity collection state management in Redux
- Single source of truth for jam tracks and backing tracks
- Improved debugging with Redux DevTools visibility
- Cleaner component code with 3 fewer state variables
- Comprehensive test coverage for all Phase 3 features

Total Migration Progress:
- Phase 1: 8 modals migrated (21 tests)
- Phase 2: 6 lifecycle variables migrated (36 tests)
- Phase 3: 3 entity variables migrated (15 tests)
- Total: 17 state variables migrated to Redux with 72 unit tests

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 16:52:21 +05:30
Nuwan a1579788be updates to claude config files 2026-01-12 15:51:05 +05:30
Nuwan 9cfef7d562 feat: migrate JKSessionScreen state to Redux with comprehensive testing
Phase 1 - Modal State Migration:
- Migrated 8 modal useState hooks to Redux (sessionUISlice)
- Centralized all modal state management (settings, invite, volume, recording, leave, jamTrack, backingTrack, mediaControls)
- Added modal actions: openModal, closeModal, toggleModal, closeAllModals

Phase 2 - Session Lifecycle Migration:
- Migrated session lifecycle to Redux (activeSessionSlice)
- State: hasJoined, guardsPassed, userTracks, connectionStatus, participants, recordingState
- Added async thunks: fetchActiveSession, joinActiveSession, leaveActiveSession
- Integrated connection monitoring with Redux
- Added clearSession action for proper cleanup on leave
- Created useSessionWebSocket hook for WebSocket-to-Redux bridge
- Added leaveSession API endpoint to rest.js

Testing Infrastructure:
- Created 57 unit tests (21 for sessionUISlice, 36 for activeSessionSlice)
- Added automated test runner: run-phase-tests.sh
- Added test:unit script to package.json for Jest-based testing
- All tests passing

Documentation:
- Created docs/ folder for better organization
- Added comprehensive testing guide (TESTING_GUIDE_PHASE1_AND_2.md)
- Added quick reference card (TESTING_QUICK_REFERENCE.md)
- Added testing summary (TESTING_COMPLETE_SUMMARY.md)
- Documented Phase 1 changes (PHASE1_MIGRATION_SUMMARY.md)
- Documented Phase 2 changes (PHASE2_MIGRATION_SUMMARY.md)
- Included migration guide (REDUX_MIGRATION_GUIDE.md)

Benefits:
- Single source of truth for session state
- Predictable state updates
- Redux DevTools support for debugging
- Improved testability
- Cleaner component code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 15:47:17 +05:30
Nuwan f6d805b0f9 docs: map existing codebase
- STACK.md (118 lines) - Technologies and dependencies
- ARCHITECTURE.md (168 lines) - System design and patterns
- STRUCTURE.md (195 lines) - Directory layout
- CONVENTIONS.md (167 lines) - Code style and patterns
- TESTING.md (274 lines) - Test structure
- INTEGRATIONS.md (261 lines) - External services
- CONCERNS.md (251 lines) - Technical debt and issues

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-11 14:59:10 +05:30
Nuwan e39ebb5e23 get shit down (gsd) initialize 2026-01-11 14:46:52 +05:30
Nuwan e86726c4fc updates to CLAUDE.md 2026-01-09 22:00:49 +05:30
Nuwan c2a6e0f4d3 working on backing tracks 2026-01-08 21:07:55 +05:30
Nuwan ce30f5aabb Backing Track popup
select backing track file and open it in the backing track player
2026-01-07 16:44:22 +05:30
Nuwan 4844a2b530 media popup system implementation
- Create MediaContext - Unified state management for all media types
- Enhance WindowPortal - Better window lifecycle and communication
- Implement JKPopupMediaControls - Main media controls component
- Integrate MediaContext into JKSessionScreen
- Update JKSessionOpenMenu to use new media context
2026-01-07 11:55:20 +05:30
Nuwan 278de95a61 add claude 2026-01-06 14:58:35 +05:30
Nuwan e1c44505ab fix the timer leak issue.
The fix adds a cleanup useEffect that clears the
backendMixerAlertThrottleTimerRef when the component unmounts
2026-01-06 09:48:54 +05:30
Nuwan 3a196cdf0b __Problem__: Global handlers were registered on `window.JK` but never cleaned up, causing memory leaks when the hook unmounts.
__Solution__: Added a cleanup function to the `useEffect` that removes the handlers from `window.JK`
2026-01-03 10:32:46 +05:30
Nuwan d6ec0a3406 __Problem__: `window.jamClient = jamClient;` was polluting the global scope, preventing garbage collection of the jamClient object and creating potential memory leaks.
__Solution__: Removed the global assignment entirely since:

- The `jamClient` is already available through `JamServerContext`
- No usage of `window.jamClient` was found in the codebase
- The comment mentioned "iframe access" but this can be handled through proper React patterns if needed
2026-01-03 10:25:25 +05:30
Nuwan b193fb299a This fix ensures that WebSocket message listeners are properly cleaned up, preventing memory leaks when users leave sessions or navigate away from the component. 2026-01-03 10:16:54 +05:30
Nuwan a7499f9db1 update 2025-12-26 19:15:32 +05:30
Nuwan 98d234b4b3 add icons for tool bar 2025-12-26 17:57:22 +05:30
Nuwan ab6437e4ca connection stats and track pan feature 2025-12-25 13:52:48 +05:30
Nuwan d5969c7dd8 working on session screen base functionalities 2025-12-24 22:04:29 +05:30
Nuwan 3a856cd01d session jamtrack
user select jamtrack from the list
2025-12-22 09:46:47 +05:30
Nuwan 72f94fe023 session backing tracks.
opens file browser and let user to select the audio file.
currently shows a popup window with the player component which is
not yet complete. need to decide whether we do it via client native
popup or purely using react.
2025-12-17 09:33:57 +05:30
Nuwan 4769085e23 video button and broadcast button
handle when click on video and broadcast
buttons in session screen
2025-12-11 19:57:24 +05:30
Nuwan 782bf3a76b leave session feature 2025-12-11 15:38:05 +05:30
Nuwan 8676210d23 show tracks for audio inputs and session mix 2025-12-09 22:05:39 +05:30
Nuwan baba15693b wip sesssion screen base functions 2025-12-08 23:28:48 +05:30
Nuwan b2f378e01e show audio tracks and session mix 2025-12-08 15:15:47 +05:30
Nuwan f417e16319 add recording functionality 2025-12-07 13:37:46 +05:30
Nuwan 0fab4532c6 record modal ui wip 2025-12-01 01:08:04 +05:30
Nuwan 9b692bb200 recording modal wip 2025-11-30 00:11:36 +05:30