Skip to content

Commit

Permalink
Issue umputun#31: Replace separate UI with the embedded HTMX based
Browse files Browse the repository at this point in the history
   - added styles for about page
  • Loading branch information
oneils committed Sep 23, 2023
1 parent 9d7456e commit aa84467
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 30 deletions.
15 changes: 7 additions & 8 deletions backend/app/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func (s Server) routes() chi.Router {
})

router.Get("/", s.indexCtrl)
router.Handle("/static", http.NotFoundHandler())
router.Post("/secure-link", s.generateLink)
router.Get("/message/{key}", s.showMessageView)
router.Post("/load-message", s.loadMessage)
Expand Down Expand Up @@ -196,13 +195,13 @@ func (s Server) fileServer(r chi.Router, path string, root http.FileSystem) {

path += "*"

r.Get(path, func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/") {
http.NotFound(w, r)
return
}
fs.ServeHTTP(w, r)
})
//r.Get(path, func(w http.ResponseWriter, r *http.Request) {
// if strings.HasSuffix(r.URL.Path, "/") {
// http.NotFound(w, r)
// return
// }
// fs.ServeHTTP(w, r)
//})

r.Handle(path, http.StripPrefix("/static", fs))
}
Expand Down
82 changes: 69 additions & 13 deletions backend/ui/html/pages/about.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,78 @@

{{define "main"}}

<div>
<div class="about-description">
<p>SafeSecret is a simple service made for a single purpose: sharing confidential information in an easy, quick and secure
way. Think of it as writing a paper note, letting someone read it, then burning it.
</p>
<br/>
<p>Once the link is opened with the input of your 5-digit PIN, it can never be opened or seen again — the information
self-destructs without a trace.
</p>
</div>

<div class="how-it-works-container">
<h1>How it works</h1>
</div>
<div class="steps-container col-12">
<div class="col-12 line"></div>
<div class="step-card-container col-12">
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">1</span>
</div>
<div class="step-text">
<p>Simply type or paste any text into SafeSecret</p>
</div>
</div>
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">2</span>
</div>
<div class="step-text">
<p>Create a 5-digit PIN</p>
</div>
</div>
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">3</span>
</div>
<div class="step-text">
<p>Define for how long you’d like the information to be accessible</p>
</div>
</div>
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">4</span>
</div>
<div class="step-text">
<p>Copy the link generated by SafeSecret </p>
</div>
</div>
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">5</span>
</div>
<div class="step-text">
<p>Share it with someone in any way you’d like</p>
</div>
</div>
<div class="step-card col-12 col-xl-2">
<div>
<span class="circle">6</span>
</div>
<div class="step-text">
<p>Share your PIN using a different communication channel</p>
</div>
</div>
</div>
</div>

<p>SafeSecret is a simple service made for a single purpose: sharing confidential information in an easy, quick and secure way. Think of it as writing a paper note, letting someone read it, then burning it. </p>
<br/>
<p>Once the link is opened with the input of your 5-digit PIN, it can never be opened or seen again — the information self-destructs without a trace.</p>

<div class="how-it-works">
<h1>How it works</h1>
</div>
<div>
<img src="/static/img/how-it-works-steps.svg" alt="How it works"/>
</div>

<div class="main-btn-container col col-md-6">
<input type="submit" class="main-btn" role="button"
value="Generate Secure Link" />
<div class="info-main-btn-container col col-md-6">
<a href="/" class="main-btn-link" role="button">Generate Secure Link</a>
</div>
</div>

{{end}}
6 changes: 3 additions & 3 deletions backend/ui/html/partials/error.tmpl.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{define "error"}}
<div>
<div class="error-block">
<div class="row justify-content-center">
<div class="error-block col-12">
<label class='error'>{{.}}</label>
</div>

<a class="second-btn" href="/">Back to the main page</a>
<a class="second-btn col-md-6" href="/">Back to the main page</a>
</div>

{{end}}
2 changes: 1 addition & 1 deletion backend/ui/html/partials/footer.tmpl.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{define "footer"}}
<footer>
<div class="footer-text"><a href="/about">How SafeSecret works</a> </div>
<div class="footer-text"><a href="/about">How <span class="footer-text-logo">SafeSecret</span> works</a> </div>
<div class="footer-text">Source code available on <a href="https://github.com/umputun/secrets" target="_blank">GitHub</a></div>
</footer>
{{end}}
166 changes: 161 additions & 5 deletions backend/ui/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,19 @@ select {
appearance: none;
}

.select-container {position:relative; display: inline;}
.select-container:after {content:""; width:0; height:0; position:absolute; pointer-events: none;}
.select-container {
position: relative;
display: inline;
}

.select-container:after {
content: "";
width: 0;
height: 0;
position: absolute;
pointer-events: none;
}

.select-container:after {
border-left: 5px solid transparent;
border-right: 5px solid transparent;
Expand All @@ -91,6 +102,7 @@ select {
border-top: 8px solid #FFF;
opacity: 0.5;
}

select::-ms-expand {
display: none;
}
Expand Down Expand Up @@ -247,6 +259,40 @@ main {
text-decoration: none;
}

.main-btn-link {
border-radius: 10px;
border: 2px solid #3E65FB;
background: #3E65FB;
color: #FFF;
text-align: center;
font-size: 22px;
font-weight: 400;
display: block;
line-height: 40px;
white-space: nowrap;

width: 100%;
height: 54px;
padding: 5px 30px 5px 30px;
}

.main-btn-link:hover {
color: #FFF;
text-decoration: none;
background-image: linear-gradient(90deg, #3E65FB 0%, #7F9CF5 63.02%);
background-size: 100%;
transition-timing-function: ease;
}

.main-btn-link:active {
color: #FFF;
text-decoration: none;
background-color: #3E65FB;
background-image: linear-gradient(90deg, #7F9CF5 0%, #3E65FB 63.02%);
background-size: 100%;
transition-timing-function: ease;
}

.second-btn {
border-radius: 10px;
border: 2px solid #3E65FB;
Expand Down Expand Up @@ -357,12 +403,12 @@ main {
text-align: center;
}

.how-it-works {
.how-it-works-container {
margin-top: 60px;
margin-bottom: 20px;
}

.how-it-works h1 {
.how-it-works-container h1 {
font-family: 'Stick No Bills', sans-serif;
font-size: 32px;
color: #FFFFFF;
Expand Down Expand Up @@ -402,6 +448,14 @@ footer .footer-text {
margin: 15px 0;
}

.footer-text a {
font-weight: 300;
}

.footer-text-logo {
color: #3E65FB;
}

.popup {
position: fixed;
top: 0;
Expand Down Expand Up @@ -445,7 +499,7 @@ footer .footer-text {
text-align: center;
}

.close-popup{
.close-popup {
position: absolute;
top: 20px;
right: 20px;
Expand All @@ -458,3 +512,105 @@ footer .footer-text {
.close-popup:hover {
opacity: 0.5;
}

.steps-container {
display: flex;
justify-content: space-between;
margin-top: 25px;
margin-bottom: 25%;
}

@media (max-width: 1200px) {
.step-card-container {
position: relative !important;
flex-direction: column;
left: 0 !important;;
top: 0 !important;;
z-index: 0 !important;
padding-left: 0;
}

.line {
position: relative !important;
display: none;
z-index: 0 !important;
}

.circle {
position: relative !important;;
}

.step-card {
display: flex;
justify-content: left;
align-items: center;
gap: 15px;
}

.step-text {
margin-top: 0 !important;
}

.steps-container {
flex-direction: column;
margin-bottom: auto;
padding-left: 0;
}

.step-card p {
font-size: 20px;
}

.info-main-btn-container {
margin-top: 40px;
margin-bottom: 60px;
margin-left: -15px;
padding-left: 0;
}
}

.line {
height: 4px;
background: #FFF;
width: 100%;
z-index: 4;
}

.step-card-container {
display: flex;
z-index: 5;
position: absolute;
left: 50px;
top: -16px;
justify-content: space-around;
gap: 25px;
}

.step-card {
padding: 0;
}

.step-card p {
font-size: 18px;
}

.circle {
height: 45px;
width: 45px;
background: linear-gradient(90deg, #3E65FB 0%, #7F9CF5 63.02%);;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}

.step-text {
margin-top: 21px;
}

.info-main-btn-container {
margin-top: 40px;
margin-bottom: 60px;
margin-left: 0;
padding-left: 0;
}
File renamed without changes

0 comments on commit aa84467

Please sign in to comment.