Skip to content

Commit

Permalink
Nearly ready for merging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Mar 6, 2024
1 parent 639a12b commit 0268a5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions Damselfly.Web.Client/Shared/PersonTile.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inject IUserStatusService statusService
@inject ViewDataService ViewDataService
@inject IJSRuntime JsRuntime
@inject IDialogService dialogService

<div class="damselfly-exportitem">
<div title="@Person.PersonGuid" class="damselfly-personimg">
Expand All @@ -22,16 +23,30 @@
public string Name
{
get => Person.Name;
set => UpdateName(value);
set => _ = UpdateName(value);
}

public string FaceLink => $"/face/{Person.PersonId}?nocache={Person.LastUpdated:yyyyMMddHHmmss}";
public string PersonLink => $"/?personid={Person.PersonId}";

private void UpdateName(string newName)
private async Task UpdateName(string newName)
{
if( !string.IsNullOrEmpty(newName) && !newName.Equals(Person.Name) )
{
var allNames = await peopleService.GetPeopleNames(newName);
if( Person.State == Person.PersonState.Unknown && allNames.Contains(newName,StringComparer.OrdinalIgnoreCase))
{
bool? result = await dialogService.ShowMessageBox(
$"Merge with existing {newName}?",
$"A person with the name '{newName}' exists already. Would you like to merge the two?",
yesText:"Merge", cancelText:"Create New Person");

if( result != null && result.Value )
{
statusService.UpdateStatus("Merging people is not yet implemented!");
return;
}
}
_ = JsRuntime.InvokeAsync<string>("clearFocus");
_ = peopleService.UpdatePerson(Person, newName);

Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/wwwroot/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const CACHE_VERSION='4.1.0-20240306215536'
const CACHE_VERSION='4.1.0-20240306233049'

0 comments on commit 0268a5e

Please sign in to comment.