This repository has been archived by the owner on Jan 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Reintroduce the QR code image on address view. - Hide the total count, which was just confusing. - Prepare time column with a <time> tag. Indexer need fix before displaying the date.
- Loading branch information
Showing
6 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Globalization; | ||
using Blockcore.Explorer.Settings; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Blockcore.Explorer.TagHelpers | ||
{ | ||
public class TimeTagHelper : TagHelper | ||
{ | ||
private readonly ExplorerSettings settings; | ||
|
||
private readonly ChainSettings chainSettings; | ||
|
||
private readonly ILogger<TimeTagHelper> log; | ||
|
||
public TimeTagHelper(IOptions<ExplorerSettings> settings, IOptions<ChainSettings> chainSettings, ILogger<TimeTagHelper> log) | ||
{ | ||
this.settings = settings.Value; | ||
this.chainSettings = chainSettings.Value; | ||
this.log = log; | ||
} | ||
|
||
public override void Process(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
// TODO: When the Blockcore Indexer returns correct time for transactions, enable the code below! | ||
output.Content.SetContent("-"); | ||
return; | ||
|
||
string input = output.GetChildContentAsync().Result.GetContent(); | ||
bool success = long.TryParse(input, out long value); | ||
|
||
if (success) | ||
{ | ||
try | ||
{ | ||
string text = DateTimeOffset.FromUnixTimeSeconds(value).ToString("F"); | ||
string html = $"<span class=\"time-value\">{text}</span>"; | ||
output.Content.SetHtmlContent(html); | ||
} | ||
catch (Exception ex) | ||
{ | ||
log.LogError(ex, $"Failed to parse in TimeTagHelper. Input was {input} and parsed value was {value}."); | ||
output.Content.SetContent(input); | ||
} | ||
} | ||
else | ||
{ | ||
output.Content.SetContent(input); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters