From 4b8bd989aa6a4dcdec1df423be1ef792b468bc61 Mon Sep 17 00:00:00 2001 From: NeoCoderMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:30:24 +0100 Subject: [PATCH] New component for tracklist control column --- .../Shared/TrackList/TrackListItem.razor | 117 +--------- .../TrackListItemControlColumn.razor | 212 ++++++++++++++++++ 2 files changed, 222 insertions(+), 107 deletions(-) create mode 100644 AudioCuesheetEditor/Shared/TrackList/TrackListItemControlColumn.razor diff --git a/AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor b/AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor index f9bf3450..cfb6e292 100644 --- a/AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor +++ b/AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor @@ -33,94 +33,7 @@ along with Foobar. If not, see - @switch (_sessionStateContainer.CurrentViewMode) - { - case ViewMode.ViewModeRecord: - - - - @track.Position - break; - case ViewMode.ViewModeFull: - case ViewMode.ViewModeImport: - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- - - - - - - - - - break; - } + @@ -217,10 +130,9 @@ along with Foobar. If not, see @code { - //TODO: More little components, like TrackLink, TrackSelection, etc. ;) //TODO: Localization - Validations? validations; EditTrackModal? modalTrackEdit; + Validations? validations; IEnumerable? autocompleteTrackArtists; IEnumerable? autocompleteTrackTitles; @@ -238,7 +150,7 @@ along with Foobar. If not, see [Parameter] public EventCallback> SelectedTracksChanged { get; set; } - [Parameter] + [Parameter, EditorRequired] public AudioPlayer? AudioPlayer { get; set; } public Cuesheet? Cuesheet @@ -301,14 +213,6 @@ along with Foobar. If not, see await EditTrackModal(copy); } - async Task OnPlayTrackClicked(Track track) - { - if (AudioPlayer != null) - { - await AudioPlayer.OnPlayTrackClicked(track); - } - } - void SelectedTrackChanged(Track track, bool selected) { var selectedTracks = new List(SelectedTracks); @@ -323,14 +227,6 @@ along with Foobar. If not, see SelectedTracksChanged.InvokeAsync(selectedTracks); } - void OnDeleteTrackClicked(Track track) - { - Cuesheet?.RemoveTrack(track); - var selectedTracks = new List(SelectedTracks); - selectedTracks.Remove(track); - SelectedTracksChanged.InvokeAsync(selectedTracks); - } - async Task OnReadDataAutocompleteTrackArtist(AutocompleteReadDataEventArgs autocompleteReadDataEventArgs) { if (!autocompleteReadDataEventArgs.CancellationToken.IsCancellationRequested) @@ -373,4 +269,11 @@ along with Foobar. If not, see break; } } + + void TrackDeleted(Track track) + { + var selectedTracks = new List(SelectedTracks); + selectedTracks.Remove(track); + SelectedTracksChanged.InvokeAsync(selectedTracks); + } } diff --git a/AudioCuesheetEditor/Shared/TrackList/TrackListItemControlColumn.razor b/AudioCuesheetEditor/Shared/TrackList/TrackListItemControlColumn.razor new file mode 100644 index 00000000..84a75095 --- /dev/null +++ b/AudioCuesheetEditor/Shared/TrackList/TrackListItemControlColumn.razor @@ -0,0 +1,212 @@ +