summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-10-27 19:36:31 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-10-27 19:36:31 -0400
commit65f0fa625575592639a24a9b39330e4a6b500f22 (patch)
tree3e53748403ffced66f64e830bfb798f650ed5ee2
parent3d8bdacc8cb5c9d5514e052d5d4c1d5f2dbc6e9e (diff)
downloadSMAPI-65f0fa625575592639a24a9b39330e4a6b500f22.tar.gz
SMAPI-65f0fa625575592639a24a9b39330e4a6b500f22.tar.bz2
SMAPI-65f0fa625575592639a24a9b39330e4a6b500f22.zip
add scaffolding for web UI (#358)
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs (renamed from src/SMAPI.Web/Controllers/ModsController.cs)6
-rw-r--r--src/SMAPI.Web/Startup.cs1
-rw-r--r--src/SMAPI.Web/Views/Shared/_Layout.cshtml29
-rw-r--r--src/SMAPI.Web/Views/_ViewStart.cshtml3
-rw-r--r--src/SMAPI.Web/wwwroot/Content/main.css107
-rw-r--r--src/SMAPI.Web/wwwroot/Content/sidebar-bg.gifbin0 -> 1104 bytes
-rw-r--r--src/SMAPI.Web/wwwroot/favicon.icobin0 -> 15086 bytes
7 files changed, 143 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs
index a671ddca..1db5b59e 100644
--- a/src/SMAPI.Web/Controllers/ModsController.cs
+++ b/src/SMAPI.Web/Controllers/ModsApiController.cs
@@ -14,8 +14,8 @@ namespace StardewModdingAPI.Web.Controllers
{
/// <summary>Provides an API to perform mod update checks.</summary>
[Produces("application/json")]
- [Route("api/{version:semanticVersion}/[controller]")]
- internal class ModsController : Controller
+ [Route("api/{version:semanticVersion}/mods")]
+ internal class ModsApiController : Controller
{
/*********
** Properties
@@ -39,7 +39,7 @@ namespace StardewModdingAPI.Web.Controllers
/// <summary>Construct an instance.</summary>
/// <param name="cache">The cache in which to store mod metadata.</param>
/// <param name="configProvider">The config settings for mod update checks.</param>
- public ModsController(IMemoryCache cache, IOptions<ModUpdateCheckConfig> configProvider)
+ public ModsApiController(IMemoryCache cache, IOptions<ModUpdateCheckConfig> configProvider)
{
ModUpdateCheckConfig config = configProvider.Value;
diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs
index eaf14983..abce8f28 100644
--- a/src/SMAPI.Web/Startup.cs
+++ b/src/SMAPI.Web/Startup.cs
@@ -64,6 +64,7 @@ namespace StardewModdingAPI.Web
loggerFactory.AddDebug();
app
.UseRewriter(new RewriteOptions().Add(new RewriteSubdomainRule())) // convert subdomain.smapi.io => smapi.io/subdomain for routing
+ .UseStaticFiles() // wwwroot folder
.UseMvc();
}
}
diff --git a/src/SMAPI.Web/Views/Shared/_Layout.cshtml b/src/SMAPI.Web/Views/Shared/_Layout.cshtml
new file mode 100644
index 00000000..89b1866c
--- /dev/null
+++ b/src/SMAPI.Web/Views/Shared/_Layout.cshtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>@ViewData["Title"] - SMAPI.io</title>
+ <link rel="stylesheet" href="~/Content/main.css" />
+</head>
+<body>
+ <div id="sidebar">
+ <h4>SMAPI</h4>
+ <ul>
+ <li><a href="https://stardewvalleywiki.com/Modding:Index">FAQs & guides</a></li>
+ <li><a href="https://github.com/pathoschild/SMAPI/releases">Download SMAPI</a></li>
+ <li><a href="https://discord.gg/stardewvalley">Get help on Discord</a></li>
+ </ul>
+ </div>
+ <div id="content-column">
+ <div id="content">
+ <h1>@ViewData["Title"]</h1>
+ @RenderBody()
+ </div>
+ <div id="footer">
+ <div id="license">
+ Hi! You can <a href="https://github.com/pathoschild/SMAPI" title="view source">view the source code</a> or <a href="https://github.com/pathoschild/SMAPI/issues" title="report issue">report a bug or suggestion</a>.
+ </div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/src/SMAPI.Web/Views/_ViewStart.cshtml b/src/SMAPI.Web/Views/_ViewStart.cshtml
new file mode 100644
index 00000000..a5f10045
--- /dev/null
+++ b/src/SMAPI.Web/Views/_ViewStart.cshtml
@@ -0,0 +1,3 @@
+@{
+ Layout = "_Layout";
+}
diff --git a/src/SMAPI.Web/wwwroot/Content/main.css b/src/SMAPI.Web/wwwroot/Content/main.css
new file mode 100644
index 00000000..c8ce8d33
--- /dev/null
+++ b/src/SMAPI.Web/wwwroot/Content/main.css
@@ -0,0 +1,107 @@
+/* tags */
+html {
+ height: 100%;
+}
+
+body {
+ height: 100%;
+ font-family: sans-serif;
+}
+
+h1, h2, h3 {
+ font-weight: bold;
+ margin: 0.2em 0 0.1em 0;
+ padding-top: .5em;
+}
+
+h1 {
+ font-size: 1.5em;
+ color: #888;
+ margin-bottom: 0;
+}
+
+h2 {
+ font-size: 1.5em;
+ border-bottom: 1px solid #AAA;
+}
+
+h3 {
+ font-size: 1.2em;
+ border-bottom: 1px solid #AAA;
+ width: 50%;
+}
+
+a {
+ color: #006;
+}
+
+/* content */
+#content-column {
+ position: absolute;
+ top: 1em;
+ left: 10em;
+}
+
+#content {
+ min-height: 140px;
+ padding: 0 1em 1em 1em;
+ border-left: 1px solid #CCC;
+ background: #FFF;
+ font-size: 0.9em;
+}
+
+#content p {
+ max-width: 55em;
+}
+
+.section {
+ border: 1px solid #CCC;
+ padding: 0.5em;
+ margin-bottom: 1em;
+}
+
+/* sidebar */
+#sidebar {
+ margin-top: 3em;
+ min-height: 75%;
+ width: 12em;
+ background: url("sidebar-bg.gif") no-repeat top right;
+ color: #666;
+}
+
+#sidebar h4 {
+ margin: 0 0 0.2em 0;
+ width: 10em;
+ border-bottom: 1px solid #CCC;
+ font-size: 0.8em;
+ font-weight: normal;
+}
+
+#sidebar a {
+ color: #77B;
+ border: 0;
+}
+
+#sidebar ul, #sidebar li {
+ margin: 0;
+ padding: 0;
+ list-style: none none;
+ font-size: 0.9em;
+ color: #888;
+}
+
+#sidebar li {
+ margin-left: 1em;
+}
+
+/* footer */
+#footer {
+ margin: 1em;
+ padding: 1em;
+ font-size: 0.6em;
+ color: gray;
+}
+
+#footer a {
+ color: #669;
+}
diff --git a/src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif b/src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif
new file mode 100644
index 00000000..48e9af5a
--- /dev/null
+++ b/src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif
Binary files differ
diff --git a/src/SMAPI.Web/wwwroot/favicon.ico b/src/SMAPI.Web/wwwroot/favicon.ico
new file mode 100644
index 00000000..587a6e74
--- /dev/null
+++ b/src/SMAPI.Web/wwwroot/favicon.ico
Binary files differ