diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml b/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml
deleted file mode 100644
index 113a21d96..000000000
--- a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml.cs
deleted file mode 100644
index 5c131be6a..000000000
--- a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteView.axaml.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-using Avalonia.ReactiveUI;
-
-namespace Artemis.UI.Screens.Workshop.Entries;
-
-public partial class EntryVoteView : ReactiveUserControl
-{
- public EntryVoteView()
- {
- InitializeComponent();
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteViewModel.cs
deleted file mode 100644
index 14e449974..000000000
--- a/src/Artemis.UI/Screens/Workshop/Entries/EntryVoteViewModel.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using System;
-using System.Reactive.Disposables;
-using System.Threading.Tasks;
-using Artemis.UI.Shared;
-using Artemis.UI.Shared.Services;
-using Artemis.UI.Shared.Services.Builders;
-using Artemis.WebClient.Workshop;
-using Artemis.WebClient.Workshop.Services;
-using PropertyChanged.SourceGenerator;
-using ReactiveUI;
-
-namespace Artemis.UI.Screens.Workshop.Entries;
-
-public partial class EntryVoteViewModel : ActivatableViewModelBase
-{
- private readonly IEntrySummary _entry;
- private readonly INotificationService _notificationService;
- private readonly IVoteClient _voteClient;
- private bool _voting;
-
- [Notify] private int _score;
- [Notify] private bool _upvoted;
- [Notify] private bool _downvoted;
-
- public EntryVoteViewModel(IEntrySummary entry, IAuthenticationService authenticationService, INotificationService notificationService, IVoteClient voteClient)
- {
- _entry = entry;
- _notificationService = notificationService;
- _voteClient = voteClient;
-
- IsLoggedIn = authenticationService.IsLoggedIn;
- Score = entry.UpvoteCount - entry.DownvoteCount;
- this.WhenActivated(d => IsLoggedIn.Subscribe(l => _ = GetVoteStatus(l)).DisposeWith(d));
- }
-
- public IObservable IsLoggedIn { get; }
-
- public async Task CastVote(bool upvote)
- {
- // Could use a ReactiveCommand to achieve the same thing but that disables the button
- // while executing which grays it out for a fraction of a second and looks bad
- if (_voting)
- return;
-
- _voting = true;
- try
- {
- IVoteCount? result;
- // If the vote was removed, reset the upvote/downvote state
- if ((Upvoted && upvote) || (Downvoted && !upvote))
- {
- result = await _voteClient.ClearVote(_entry.Id);
- Upvoted = false;
- Downvoted = false;
- }
- else
- {
- result = await _voteClient.CastVote(_entry.Id, upvote);
- Upvoted = upvote;
- Downvoted = !upvote;
- }
-
- if (result != null)
- Score = result.UpvoteCount - result.DownvoteCount;
- else
- _notificationService.CreateNotification().WithTitle("Failed to cast vote").WithMessage("Please try again later.").WithSeverity(NotificationSeverity.Error).Show();
- }
- finally
- {
- _voting = false;
- }
- }
-
- private async Task GetVoteStatus(bool isLoggedIn)
- {
- if (!isLoggedIn)
- {
- Upvoted = false;
- Downvoted = false;
- }
- else
- {
- bool? vote = await _voteClient.GetVote(_entry.Id);
- if (vote != null)
- {
- Upvoted = vote.Value;
- Downvoted = !vote.Value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListInputView.axaml b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListInputView.axaml
index 476ae9bd2..8fdc91d29 100644
--- a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListInputView.axaml
+++ b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListInputView.axaml
@@ -21,7 +21,6 @@
Recently updated
Recently added
Download count
- Score
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemView.axaml b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemView.axaml
index 7473034d3..cae7a1934 100644
--- a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemView.axaml
+++ b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemView.axaml
@@ -3,7 +3,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
- xmlns:entries1="clr-namespace:Artemis.UI.Screens.Workshop.Entries"
xmlns:il="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
xmlns:list="clr-namespace:Artemis.UI.Screens.Workshop.Entries.List"
@@ -21,12 +20,9 @@
HorizontalContentAlignment="Stretch"
Command="{CompiledBinding NavigateToEntry}"
IsVisible="{CompiledBinding Entry, Converter={x:Static ObjectConverters.IsNotNull}}">
-
-
-
-
+
-
-
+
@@ -82,7 +78,7 @@
-
+
@@ -92,7 +88,7 @@
-
+
installed
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemViewModel.cs
index a02325bc4..d129f9be6 100644
--- a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemViewModel.cs
+++ b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListItemViewModel.cs
@@ -1,4 +1,5 @@
using System;
+using System.Reactive;
using System.Reactive.Disposables;
using System.Threading.Tasks;
using Artemis.UI.Shared;
@@ -17,12 +18,12 @@ public partial class EntryListItemViewModel : ActivatableViewModelBase
[Notify] private bool _isInstalled;
[Notify] private bool _updateAvailable;
- public EntryListItemViewModel(IEntrySummary entry, IRouter router, IWorkshopService workshopService, Func getEntryVoteViewModel)
+ public EntryListItemViewModel(IEntrySummary entry, IRouter router, IWorkshopService workshopService)
{
_router = router;
Entry = entry;
- VoteViewModel = getEntryVoteViewModel(entry);
+ NavigateToEntry = ReactiveCommand.CreateFromTask(ExecuteNavigateToEntry);
this.WhenActivated((CompositeDisposable _) =>
{
@@ -33,9 +34,9 @@ public partial class EntryListItemViewModel : ActivatableViewModelBase
}
public IEntrySummary Entry { get; }
- public EntryVoteViewModel VoteViewModel { get; }
+ public ReactiveCommand NavigateToEntry { get; }
- public async Task NavigateToEntry()
+ private async Task ExecuteNavigateToEntry()
{
switch (Entry.EntryType)
{
diff --git a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListViewModel.cs
index 48388aeb5..a6b5309c7 100644
--- a/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListViewModel.cs
+++ b/src/Artemis.UI/Screens/Workshop/Entries/List/EntryListViewModel.cs
@@ -137,9 +137,6 @@ public partial class EntryListViewModel : RoutableScreen
if (InputViewModel.SortBy == 2)
return new[] {new EntrySortInput {Downloads = SortEnumType.Desc}};
- // Sort by score
- if (InputViewModel.SortBy == 3)
- return new[] {new EntrySortInput {Score = SortEnumType.Desc}};
// Sort by latest release, then by created at
return new[]
diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemView.axaml b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemView.axaml
index b8347c3df..71ab5983c 100644
--- a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemView.axaml
+++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemView.axaml
@@ -11,6 +11,7 @@
x:DataType="tabs:InstalledTabItemViewModel">
+