From a9e3458a3b93649f62919566c3ffacf27f16332c Mon Sep 17 00:00:00 2001
From: Jesse Plamondon-Willard <github@jplamondonw.com>
Date: Thu, 29 Mar 2018 00:39:25 -0400
Subject: add success/error banner to log parser page

---
 src/SMAPI.Web/Views/LogParser/Index.cshtml | 36 ++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 9 deletions(-)

(limited to 'src/SMAPI.Web/Views')

diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 7213e286..c909b203 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -44,11 +44,36 @@
 ** Intro
 *********@
 <p id="blurb">This page lets you upload, view, and share a SMAPI log to help troubleshoot mod issues.</p>
-<input type="button" id="upload-button" value="Share a new log" />
 
 @if (Model.ParsedLog?.IsValid == true)
 {
-    <h2>Parsed log</h2>
+    <div class="banner success" v-pre>
+        <strong>The log was uploaded successfully!</strong><br/>
+        Share this URL when asking for help: <code>@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))</code><br/>
+        (Or <a id="upload-button" href="#">upload a new log</a>.)
+    </div>
+}
+else if (Model.ParsedLog?.IsValid == false)
+{
+    <div class="banner error" v-pre>
+        <strong>Oops, couldn't parse that file. (Make sure you upload the log file, not the console text.)</strong><br />
+        Share this URL when asking for help: <code>@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))</code><br />
+        (Or <a id="upload-button" href="#">upload a new log</a>.)<br />
+        <br />
+        <small v-pre>Error details: @Model.ParsedLog.Error</small>
+    </div>
+}
+else
+{
+    <input type="button" id="upload-button" value="Share a new log" />
+}
+
+@*********
+** Parsed log
+*********@
+@if (Model.ParsedLog?.IsValid == true)
+{
+    <h2>Log info</h2>
     <div id="output">
         <table id="metadata">
             <caption>Game info:</caption>
@@ -148,12 +173,6 @@
 }
 else if (Model.ParsedLog?.IsValid == false)
 {
-    <h2>Parsed log</h2>
-    <div id="error" class="color-red">
-        <p><strong>We couldn't parse that file, but you can still share the link.</strong></p>
-        <p v-pre>Error details: @Model.ParsedLog.Error</p>
-    </div>
-
     <h3>Raw log</h3>
     <pre v-pre>@Model.ParsedLog.RawText</pre>
 }
@@ -166,7 +185,6 @@ else if (Model.ParsedLog?.IsValid == false)
                 <li><a href="https://stardewvalleywiki.com/Modding:Player_FAQs#SMAPI_log" target="_blank">Find your SMAPI log file</a> (not the console text).</li>
                 <li>Drag the file onto the textbox below (or paste the text in).</li>
                 <li>Click <em>Parse</em>.</li>
-                <li>Share the URL of the new page.</li>
             </ol>
             <textarea id="input" placeholder="Paste or drag the log here"></textarea>
             <div class="buttons">
-- 
cgit 


From d49eb880115fefae406edfdf38fbff54acf8ba44 Mon Sep 17 00:00:00 2001
From: Jesse Plamondon-Willard <github@jplamondonw.com>
Date: Thu, 29 Mar 2018 00:43:31 -0400
Subject: show game path on log parser page instead of mods path

---
 src/SMAPI.Web/Framework/LogParsing/LogParser.cs        | 1 +
 src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs | 3 +++
 src/SMAPI.Web/Views/LogParser/Index.cshtml             | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/SMAPI.Web/Views')

diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
index 9e44f163..f49fb05c 100644
--- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
@@ -135,6 +135,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
                         {
                             Match match = this.ModPathPattern.Match(message.Text);
                             log.ModPath = match.Groups["path"].Value;
+                            log.GamePath = new FileInfo(log.ModPath).Directory.FullName;
                         }
 
                         // log UTC timestamp line
diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs
index a82b6a1b..87b20eb0 100644
--- a/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs
@@ -32,6 +32,9 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
         /// <summary>The player's operating system.</summary>
         public string OperatingSystem { get; set; }
 
+        /// <summary>The game install path.</summary>
+        public string GamePath { get; set; }
+
         /// <summary>The mod folder path.</summary>
         public string ModPath { get; set; }
 
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index c909b203..7103e9a1 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -90,8 +90,8 @@ else
                 <td v-pre>@Model.ParsedLog.OperatingSystem</td>
             </tr>
             <tr>
-                <td>Mods path:</td>
-                <td v-pre>@Model.ParsedLog.ModPath</td>
+                <td>Game path:</td>
+                <td v-pre>@Model.ParsedLog.GamePath</td>
             </tr>
             <tr>
                 <td>Log started:</td>
-- 
cgit 


From 4cd77225837b541bd6032539aa0895bade95181f Mon Sep 17 00:00:00 2001
From: Jesse Plamondon-Willard <github@jplamondonw.com>
Date: Thu, 29 Mar 2018 00:51:23 -0400
Subject: tweak metadata formatting

---
 src/SMAPI.Web/Views/LogParser/Index.cshtml       | 18 +++++++-----------
 src/SMAPI.Web/wwwroot/Content/css/log-parser.css | 20 +++++++++++++++-----
 2 files changed, 22 insertions(+), 16 deletions(-)

(limited to 'src/SMAPI.Web/Views')

diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 7103e9a1..b739ebbb 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -78,23 +78,19 @@ else
         <table id="metadata">
             <caption>Game info:</caption>
             <tr>
-                <td>SMAPI version:</td>
-                <td v-pre>@Model.ParsedLog.ApiVersion</td>
-            </tr>
-            <tr>
-                <td>Game version:</td>
-                <td v-pre>@Model.ParsedLog.GameVersion</td>
+                <th>Stardew Valley:</th>
+                <td v-pre>@Model.ParsedLog.GameVersion on @Model.ParsedLog.OperatingSystem</td>
             </tr>
             <tr>
-                <td>Platform:</td>
-                <td v-pre>@Model.ParsedLog.OperatingSystem</td>
+                <th>SMAPI:</th>
+                <td v-pre>@Model.ParsedLog.ApiVersion</td>
             </tr>
             <tr>
-                <td>Game path:</td>
+                <th>Folder:</th>
                 <td v-pre>@Model.ParsedLog.GamePath</td>
             </tr>
             <tr>
-                <td>Log started:</td>
+                <th>Log started:</th>
                 <td>@Model.ParsedLog.Timestamp.UtcDateTime.ToString("yyyy-MM-dd HH:mm") UTC ({{localTimeStarted}} your time)</td>
             </tr>
         </table>
@@ -111,7 +107,7 @@ else
                 <tr v-on:click="toggleMod('@GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@GetSlug(mod.Name)'] }">
                     <td><input type="checkbox" v-bind:checked="showMods['@GetSlug(mod.Name)']" v-show="anyModsHidden" /></td>
                     <td v-pre>
-                        @mod.Name
+                        <strong>@mod.Name</strong>
                         @if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList))
                         {
                             <div class="content-packs">
diff --git a/src/SMAPI.Web/wwwroot/Content/css/log-parser.css b/src/SMAPI.Web/wwwroot/Content/css/log-parser.css
index 9d604072..789274e2 100644
--- a/src/SMAPI.Web/wwwroot/Content/css/log-parser.css
+++ b/src/SMAPI.Web/wwwroot/Content/css/log-parser.css
@@ -29,8 +29,12 @@ input#upload-button {
     background: #eef;
 }
 
+table caption {
+    font-weight: bold;
+}
+
 /*********
-** Log metadata & filters
+** Result banner
 *********/
 .banner {
     border: 2px solid gray;
@@ -48,15 +52,20 @@ input#upload-button {
     background: #FCC;
 }
 
+/*********
+** Log metadata & filters
+*********/
 #metadata, #mods, #filters {
-    font-weight: bold;
     border-bottom: 1px dashed #888888;
-    padding-bottom: 10px;
     margin-bottom: 5px;
 }
 
-table#metadata,
-table#mods {
+#metadata th {
+    text-align: right;
+    padding-right: 0.7em;
+}
+
+table#metadata, table#mods {
     border: 1px solid #000000;
     background: #ffffff;
     border-radius: 5px;
@@ -131,6 +140,7 @@ table#mods {
 #filters {
     margin: 1em 0 0 0;
     padding: 0;
+    font-weight: bold;
 }
 
 #filters span {
-- 
cgit 


From db0c88dbaf4af8622cb9b88fab7ea10d715fd7f6 Mon Sep 17 00:00:00 2001
From: Jesse Plamondon-Willard <github@jplamondonw.com>
Date: Thu, 29 Mar 2018 19:17:44 -0400
Subject: move version closer to mod name in log parser

---
 src/SMAPI.Web/Views/LogParser/Index.cshtml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src/SMAPI.Web/Views')

diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index b739ebbb..2d1c1b44 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -107,7 +107,7 @@ else
                 <tr v-on:click="toggleMod('@GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@GetSlug(mod.Name)'] }">
                     <td><input type="checkbox" v-bind:checked="showMods['@GetSlug(mod.Name)']" v-show="anyModsHidden" /></td>
                     <td v-pre>
-                        <strong>@mod.Name</strong>
+                        <strong>@mod.Name</strong> @mod.Version
                         @if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList))
                         {
                             <div class="content-packs">
@@ -118,7 +118,6 @@ else
                             </div>
                         }
                     </td>
-                    <td v-pre>@mod.Version</td>
                     <td v-pre>@mod.Author</td>
                     @if (mod.Errors == 0)
                     {
-- 
cgit