Added loading indicators via htmx-indicator, removed unattributable ASCII art and replaced with the project logo from the README, minor touches on stylesheet and added clickable links in the display.

This commit is contained in:
James Eversole 2022-07-19 15:57:30 -05:00
parent cb013e5bf7
commit 10e3724a1a
8 changed files with 76 additions and 15 deletions

View File

@ -58,6 +58,7 @@ library
, text >=1.2 , text >=1.2
, time >=1.9 , time >=1.9
, wai-extra >=3.1.12.1 , wai-extra >=3.1.12.1
, wai-middleware-static >=0.5
default-language: Haskell2010 default-language: Haskell2010
executable Purr-exe executable Purr-exe
@ -91,6 +92,7 @@ executable Purr-exe
, text >=1.2 , text >=1.2
, time >=1.9 , time >=1.9
, wai-extra >=3.1.12.1 , wai-extra >=3.1.12.1
, wai-middleware-static >=0.5
default-language: Haskell2010 default-language: Haskell2010
test-suite Purr-test test-suite Purr-test
@ -125,4 +127,5 @@ test-suite Purr-test
, text >=1.2 , text >=1.2
, time >=1.9 , time >=1.9
, wai-extra >=3.1.12.1 , wai-extra >=3.1.12.1
, wai-middleware-static >=0.5
default-language: Haskell2010 default-language: Haskell2010

View File

@ -42,6 +42,7 @@ dependencies:
- time >= 1.9 - time >= 1.9
- text >= 1.2 - text >= 1.2
- wai-extra >= 3.1.12.1 - wai-extra >= 3.1.12.1
- wai-middleware-static >= 0.5
library: library:
source-dirs: src source-dirs: src

View File

@ -7,12 +7,14 @@ import Feature.Sharing.HTTP as Sharing
import Data.Maybe (Maybe (Nothing)) import Data.Maybe (Maybe (Nothing))
import Network.Wai.Middleware.RequestLogger (logStdoutDev) import Network.Wai.Middleware.RequestLogger (logStdoutDev)
import Network.Wai.Middleware.Static
import Web.Scotty.Trans import Web.Scotty.Trans
app :: PurrApp () app :: PurrApp ()
app = do app = do
-- Middleware definition -- Middleware definition
middleware logStdoutDev middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "views/public")
-- Core Routes -- Core Routes
get "/" $ do get "/" $ do

View File

@ -15,12 +15,18 @@ body
p p
margin: 0.4em 0 0.4em 0 margin: 0.4em 0 0.4em 0
a
color: #{colorThree}
.htmx-indicator
display: none
::placeholder ::placeholder
color: #{colorOne} color: #{colorOne}
opacity: 1 opacity: 1
.asciiCat .logo
margin: 2% 3% 0 0 margin: 4% 3% 0 0
font-size: 1.2vw font-size: 1.2vw
color: #{colorFour} color: #{colorFour}
text-align: center text-align: center
@ -91,16 +97,16 @@ p
text-align: center text-align: center
font-size: 16px font-size: 16px
.asciiCat
display: none
.mainInput .mainInput
width: 95% width: 95%
text-align: center text-align: center
.title .title
margin: 8% auto margin: 8% auto 2% auto
font-size: 3em font-size: 3em
.title h1
margin-bottom: 0
.pwUtils .pwUtils
width: 100% width: 100%

View File

@ -7,25 +7,24 @@ $doctype 5
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/style.css">
<body> <body>
<pre #asciiCat .asciiCat> <div #logo .logo>
_._ _,-'""`-._ <img src="/purrlogo.png">
\ (,-.`._,'( |\`-/|
\ `-.-' \ )-`( , o o)
\ `- \`_`"'-
<div #content .content> <div #content .content>
<div #title .title> <div #title .title>
<h1> <h1>
<a #titleLink .titleLink href="/">Purr <a #titleLink .titleLink href="/">Purr
<div #pwUtils .pwUtils> <div #pwUtils .pwUtils>
$# Below needs to be replaced with an HTMX onload request to /pw/#{link} to DRY
<div #requestedPw .requestedPw> <div #requestedPw .requestedPw>
$maybe pw <- password $maybe pw <- password
<p>Here's the secret for /pw/#{link}: <p>Here's the secret for <a href="/pw/#{link}">/pw/#{link}</a>:
<h2 .pwResult>#{pw} <h2 .pwResult>#{pw}
$nothing $nothing
$if (link == "/") $if (link == "/")
<p .emptyReq> <p .emptyReq>
$else $else
<p>No secret available at /pw/#{link} <p>No secret available at <a href="/pw/#{link}">/pw/#{link}</a>
$# Above needs to be replaced with an HTMX onload request to /pw/#{link} to DRY
<div #shareNew .shareNew> <div #shareNew .shareNew>
<p> <p>
@ -41,6 +40,7 @@ $doctype 5
hx-include="[name='newSec']" hx-include="[name='newSec']"
/> />
Share Secret Share Secret
<img class="htmx-indicator" src="/loading.svg" />
<div #requestNew .requestNew> <div #requestNew .requestNew>
<p> <p>
@ -56,3 +56,4 @@ $doctype 5
hx-include="[name='userLink']" hx-include="[name='userLink']"
/> />
Get Secret Get Secret
<img class="htmx-indicator" src="/loading.svg" />

48
views/public/loading.svg Normal file
View File

@ -0,0 +1,48 @@
<!--
The MIT License (MIT)
Copyright (c) 2014 Sam Herbert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<svg width="14" height="14" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#f0f6f0">
<g fill="none" fill-rule="evenodd" stroke-width="2">
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="0s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="0s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="-0.9s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="-0.9s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
</g>
</svg>

BIN
views/public/purrlogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,6 +1,6 @@
<div #requestedPw .requestedPw> <div #requestedPw .requestedPw>
$maybe pw <- password $maybe pw <- password
<p>Here's the secret for /pw/#{link}: <p>Here's the secret for <a href="/pw/#{link}">/pw/#{link}</a>:
<h2 .pwResult>#{pw} <h2 .pwResult>#{pw}
$nothing $nothing
<p>No secret available at /pw/#{link} <p>No secret available at <a href="/pw/#{link}">/pw/#{link}</a>