WIP New app layout
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Basti 2022-02-19 22:46:12 -06:00
parent a2889705ed
commit 4f2b35ccb9
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
12 changed files with 372 additions and 318 deletions

View File

@ -3,9 +3,9 @@
@apply leading-none @apply leading-none
} }
h1, h2, h3 { /* h1, h2, h3 { */
@apply font-light; /* @apply font-light; */
} /* } */
h1 { h1 {
@apply text-3xl uppercase; @apply text-3xl uppercase;

View File

@ -1,6 +1,22 @@
@import "variables"; @import "variables";
@import "mediaqueries"; @import "mediaqueries";
body {
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(13,79,153,0.8) 100%),
url('/img/bg-1.jpg');
background-size: cover;
background-attachment: fixed;
}
.ks-site-icon {
svg {
display: inline-block;
height: 1.875rem;
vertical-align: top;
width: auto;
}
}
#wrapper { #wrapper {
width: 100%; width: 100%;
text-align: center; text-align: center;
@ -23,17 +39,6 @@
span.project-name { span.project-name {
display: none; display: none;
} }
span.icon {
svg {
display: inline-block;
height: 1.875rem;
vertical-align: top;
width: auto;
}
margin-right: 0.5rem;
}
} }
p.current-user { p.current-user {
@ -94,19 +99,6 @@ body#admin-panel {
} }
main { main {
width: $content-width;
max-width: $content-max-width;
margin: 4rem auto 6rem auto;
text-align: left;
@include media-max(medium) {
max-width: 90%;
}
@include media-max(small) {
margin: 3rem auto;
}
p { p {
line-height: 1.5rem; line-height: 1.5rem;
margin-bottom: 1rem; margin-bottom: 1rem;
@ -126,10 +118,6 @@ main {
section { section {
margin-bottom: 3rem; margin-bottom: 3rem;
h2 {
display: none;
}
} }
table { table {

View File

@ -2,4 +2,12 @@ module ApplicationHelper
def sats_to_btc(sats) def sats_to_btc(sats)
sats.to_f / 100000000 sats.to_f / 100000000
end end
def main_nav_class(current_section, link_to_section)
if current_section == link_to_section
"bg-gray-900/50 text-white px-3 py-2 rounded-md text-sm font-medium"
else
"text-gray-300 hover:bg-gray-900/30 hover:text-white px-3 py-2 rounded-md text-sm font-medium"
end
end
end end

View File

@ -0,0 +1,5 @@
<header class="py-10">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
<h1 class="text-3xl font-bold text-white"><%= page_title %></h1>
</div>
</header>

View File

@ -1,58 +1,63 @@
<section> <%= render partial: "components/header", locals: { page_title: "Services" } %>
<h2>Services</h2>
<p> <main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
Your Kosmos account and password currently give you access to these <div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
services: <section>
</p> <p>
<div class="grid services mt-12"> Your Kosmos account and password currently give you access to these
<div> services:
<h3 class="mb-3.5">
<%= link_to "Chat", "https://wiki.kosmos.org/Services:Chat", class: "ks-text-link" %>
</h3>
<p class="text-gray-500">
Chat rooms and instant messaging (XMPP/Jabber)
</p> </p>
</div> <div class="grid services mt-12">
<div> <div>
<h3 class="mb-3.5"> <h3 class="mb-3.5">
<%= link_to "Discourse", "https://community.kosmos.org", class: "ks-text-link" %> <%= link_to "Chat", "https://wiki.kosmos.org/Services:Chat", class: "ks-text-link" %>
</h3> </h3>
<p class="text-gray-500"> <p class="text-gray-500">
Kosmos community forums and user support/help site Chat rooms and instant messaging (XMPP/Jabber)
</p> </p>
</div> </div>
<div> <div>
<h3 class="mb-3.5"> <h3 class="mb-3.5">
<span class="text-yellow-500">🗲</span> <%= link_to "Discourse", "https://community.kosmos.org", class: "ks-text-link" %>
<%= link_to "Lightning Wallet", wallet_path, class: "ks-text-link" %> </h3>
</h3> <p class="text-gray-500">
<p class="text-gray-500"> Kosmos community forums and user support/help site
Send and receive sats over the Bitcoin Lightning Network </p>
</p> </div>
</div> <div>
<div> <h3 class="mb-3.5">
<h3 class="mb-3.5"> <span class="text-yellow-500">🗲</span>
<%= link_to "Wiki", "https://wiki.kosmos.org", class: "ks-text-link" %> <%= link_to "Lightning Wallet", wallet_path, class: "ks-text-link" %>
</h3> </h3>
<p class="text-gray-500"> <p class="text-gray-500">
Kosmos documentation and knowledge base Send and receive sats over the Bitcoin Lightning Network
</p> </p>
</div> </div>
<div> <div>
<h3 class="mb-3.5"> <h3 class="mb-3.5">
<%= link_to "Gitea", "https://gitea.kosmos.org", class: "ks-text-link" %> <%= link_to "Wiki", "https://wiki.kosmos.org", class: "ks-text-link" %>
</h3> </h3>
<p class="text-gray-500"> <p class="text-gray-500">
Code hosting and collaboration for software projects Kosmos documentation and knowledge base
</p> </p>
</div> </div>
<div> <div>
<h3 class="mb-3.5"> <h3 class="mb-3.5">
<%= link_to "Drone CI", "https://drone.kosmos.org", class: "ks-text-link" %> <%= link_to "Gitea", "https://gitea.kosmos.org", class: "ks-text-link" %>
</h3> </h3>
<p class="text-gray-500"> <p class="text-gray-500">
Continuous integration for software projects on Gitea Code hosting and collaboration for software projects
</p> </p>
</div> </div>
<div>
<h3 class="mb-3.5">
<%= link_to "Drone CI", "https://drone.kosmos.org", class: "ks-text-link" %>
</h3>
<p class="text-gray-500">
Continuous integration for software projects on Gitea
</p>
</div>
</div>
</section>
</div> </div>
</section> </main>

View File

@ -1,41 +1,46 @@
<section> <%= render partial: "components/header", locals: { page_title: "Donations" } %>
<h2>Donations</h2>
<p>
Your financial contributions to the development and
upkeep of Kosmos software and services.
</p>
</section>
<section> <main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<% if @donations.any? %> <div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
<ul class="donations list-none"> <section>
<% @donations.each do |donation| %> <p>
<li class="mb-8 grid gap-y-2 gap-x-8 grid-cols-2 items-center"> Your financial contributions to the development and upkeep of Kosmos
<h3 class="mb-0"> software and services.
<%= donation.paid_at.strftime("%B %d, %Y") %> </p>
</h3> </section>
<p class="row-span-2 font-mono text-right mb-0">
<span class="text-xl"> <section>
<%= number_with_delimiter donation.amount_sats %> sats <% if @donations.any? %>
</span> <ul class="donations list-none">
<br> <% @donations.each do |donation| %>
<span class="text-sm text-gray-500"> <li class="mb-8 grid gap-y-2 gap-x-8 grid-cols-2 items-center">
(~ <%= number_to_currency donation.amount_eur / 100, unit: "" %> EUR) <h3 class="mb-0">
</span> <%= donation.paid_at.strftime("%B %d, %Y") %>
</p> </h3>
<p class="mb-0"> <p class="row-span-2 font-mono text-right mb-0">
<% if donation.public_name.present? %> <span class="text-xl">
Public name: <%= donation.public_name %> <%= number_with_delimiter donation.amount_sats %> sats
<% else %> </span>
Anonymous <br>
<% end %> <span class="text-sm text-gray-500">
</p> (~ <%= number_to_currency donation.amount_eur / 100, unit: "" %> EUR)
</li> </span>
</p>
<p class="mb-0">
<% if donation.public_name.present? %>
Public name: <%= donation.public_name %>
<% else %>
Anonymous
<% end %>
</p>
</li>
<% end %>
</ul>
<% else %>
<p>
No donations to show.
</p>
<% end %> <% end %>
</ul> </section>
<% else %> </div>
<p> </main>
No donations to show.
</p>
<% end %>
</section>

View File

@ -1,56 +1,61 @@
<section> <%= render partial: "components/header", locals: { page_title: "Invitations" } %>
<h2>Invitations</h2>
<% if @invitations_unused.any? %>
<p>
Invite your friends to a Kosmos account by sharing an invitation URL with them:
</p>
<% end %>
</section>
<section> <main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<% if @invitations_unused.any? %> <div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
<table> <section>
<thead> <% if @invitations_unused.any? %>
<tr> <p>
<th>URL</th> Invite your friends to a Kosmos account by sharing an invitation URL with them:
</tr> </p>
</thead> <% end %>
<tbody> </section>
<% @invitations_unused.each do |invitation| %>
<tr>
<td><%= invitation_url(invitation.token) %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>
You do not have any invitations to give away yet. All good
things come in time.
</p>
<% end %>
</section>
<% if @invitations_used.any? %> <section>
<section> <% if @invitations_unused.any? %>
<h3>Accepted Invitations</h3> <table>
<table> <thead>
<thead> <tr class="text-left">
<tr> <th>URL</th>
<th class="hide-small">ID</th> </tr>
<th>Accepted</th> </thead>
<th>Invited user</th> <tbody>
</tr> <% @invitations_unused.each do |invitation| %>
</thead> <tr>
<tbody> <td class="font-mono"><%= invitation_url(invitation.token) %></td>
<% @invitations_used.each do |invitation| %> </tr>
<tr> <% end %>
<td class="hide-small"><%= invitation.token %></td> </tbody>
<td><%= invitation.used_at.strftime("%Y-%m-%d") %></td> </table>
<td><%= User.find(invitation.invited_user_id).address %></td> <% else %>
</tr> <p>
<% end %> You do not have any invitations to give away yet. All good
</tbody> things come in time.
</table> </p>
</section> <% end %>
<% end %> </section>
<% if @invitations_used.any? %>
<section>
<h3>Accepted Invitations</h3>
<table>
<thead>
<tr>
<th class="hide-small">ID</th>
<th>Accepted</th>
<th>Invited user</th>
</tr>
</thead>
<tbody>
<% @invitations_used.each do |invitation| %>
<tr>
<td class="hide-small"><%= invitation.token %></td>
<td><%= invitation.used_at.strftime("%Y-%m-%d") %></td>
<td><%= User.find(invitation.invited_user_id).address %></td>
</tr>
<% end %>
</tbody>
</table>
</section>
<% end %>
</div>
</main>

View File

@ -11,29 +11,68 @@
<%= javascript_importmap_tags %> <%= javascript_importmap_tags %>
</head> </head>
<body> <body>
<div class="">
<nav class="">
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="border-b border-gray-200/10">
<div class="flex items-center justify-between h-16 px-4 sm:px-0">
<div class="flex items-center">
<div class="ks-site-icon flex-shrink-0">
<%= render partial: "shared/icons/comet" %>
<!-- <img class="h&#45;8 w&#45;8" src="https://tailwindui.com/img/logos/workflow&#45;mark&#45;indigo&#45;500.svg" alt="Workflow"> -->
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<%= render partial: 'shared/main_nav' %>
</div>
</div>
</div>
<div class="hidden md:block">
<%= render partial: 'shared/header_account' %>
</div>
</div>
</div>
</div>
<!-- Mobile menu, show/hide based on menu state. -->
<div class="border-b border-gray-700 md:hidden" id="mobile-menu">
<div class="pt-4 pb-3 border-t border-gray-700">
<div class="flex items-center px-5">
<div class="flex-shrink-0">
<img class="h-10 w-10 rounded-full" src="" alt="">
</div>
<div class="ml-3">
<div class="text-base font-medium leading-none text-white">Tom Cook</div>
<div class="text-sm font-medium leading-none text-gray-400">tom@example.com</div>
</div>
<button type="button" class="ml-auto bg-gray-800 flex-shrink-0 p-1 text-gray-400 rounded-full hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white">
<span class="sr-only">View notifications</span>
<!-- Heroicon name: outline/bell -->
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
</svg>
</button>
</div>
<div class="mt-3 px-2 space-y-1">
<a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700">Your Profile</a>
<a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700">Settings</a>
<a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700">Sign out</a>
</div>
</div>
</div>
</nav>
<%= yield %>
</div>
<div id="wrapper"> <div id="wrapper">
<header>
<h1>
<span class ="icon"><%= render partial: "shared/icons/comet" %></span>
<span class ="project-name">Kosmos</span>
<span class ="site-name">Account</span>
</h1>
<%= render partial: 'shared/header_account' %>
</header>
<% if user_signed_in? && current_user.confirmed? %>
<%= render partial: 'shared/main_nav' %>
<% end %>
<% flash.each do |type, msg| %> <% flash.each do |type, msg| %>
<div class="flash-msg <%= type %>"> <div class="flash-msg <%= type %>">
<p><%= msg %></p> <p><%= msg %></p>
</div> </div>
<% end %> <% end %>
<main>
<%= yield %>
</main>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,12 +1,18 @@
<section> <%= render partial: "components/header", locals: { page_title: "Account" } %>
<h2>Security</h2>
</section>
<section> <main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<h3>Password change</h3> <div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
<p> <section>
<%= form_with(url: settings_reset_password_path, method: :post) do %> <h2>Security</h2>
<%= submit_tag("Send me a password reset link", class: 'btn-md btn-gray') %> </section>
<% end %>
</p> <section>
</section> <h3>Password change</h3>
<p>
<%= form_with(url: settings_reset_password_path, method: :post) do %>
<%= submit_tag("Send me a password reset link", class: 'btn-md btn-gray') %>
<% end %>
</p>
</section>
</div>
</main>

View File

@ -1,6 +1,10 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<p class="current-user mt-8"> <div class="flex items-baseline space-x-4 text-gray-200/80 text-sm font-medium">
Signed in as <strong class="text-white font-normal"><%= current_user.cn %>@kosmos.org</strong>. <span>
<%= link_to "Log out", destroy_user_session_path, class: 'underline' %> Signed in as <strong class="text-white font-normal"><%= current_user.cn %>@kosmos.org</strong>
</p> </span>
<span>
<%= link_to "Log out", destroy_user_session_path, class: 'underline hover:text-white' %>
</span>
</div>
<% end %> <% end %>

View File

@ -1,26 +1,10 @@
<nav id="main-nav"> <%= link_to "Services", root_path,
<div class="wrapper"> class: main_nav_class(@current_section, :dashboard) %>
<ul class="pages"> <%= link_to "Invitations", invitations_path,
<li> class: main_nav_class(@current_section, :invitations) %>
<%= link_to "Services", root_path, <%= link_to "Donations", donations_path,
class: @current_section == :dashboard ? "active" : nil %> class: main_nav_class(@current_section, :contributions) %>
</li> <%= link_to "Wallet", wallet_path,
<li> class: main_nav_class(@current_section, :wallet) %>
<%= link_to "Invitations", invitations_path, <%= link_to "Account", security_path,
class: @current_section == :invitations ? "active" : nil %> class: main_nav_class(@current_section, :security) %>
</li>
<li>
<%= link_to "Donations", donations_path,
class: @current_section == :contributions ? "active" : nil %>
</li>
<li>
<%= link_to "Wallet", wallet_path,
class: @current_section == :wallet ? "active" : nil %>
</li>
<li>
<%= link_to "Security", security_path,
class: @current_section == :security ? "active" : nil %>
</li>
</ul>
</div>
</nav>

View File

@ -1,87 +1,92 @@
<section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0"> <%= render partial: "components/header", locals: { page_title: "Wallet" } %>
<div class="md:col-span-8">
<h2>Wallet</h2>
<p>
Send and receive sats via the Bitcoin Lightning Network.
</p>
</div>
<div class="md:col-span-4 mt-4 md:mt-0">
<p class="font-mono md:text-right mb-0 p-4 border border-gray-300 rounded-lg overflow-hidden">
<% if @balance %>
<span class="text-xl"><%= number_with_delimiter @balance %> sats</span><br>
<span class="text-sm text-gray-500">Available balance</span>
<% else %>
<span class="text-xl">n/a sats</span><br>
<span class="text-sm text-gray-500">Balance unavailable</span>
<% end %>
</p>
</div>
</section>
<section> <main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<h3>Lightning Address</h3> <div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
<p> <section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0">
Your Kosmos user address is also a <div class="md:col-span-8">
<a class="ks-text-link" href="https://lightningaddress.com/" target="_blank">Lightning Address</a>! <p>
The easiest way to receive sats is by just giving out your address: Send and receive sats via the Bitcoin Lightning Network.
</p> </p>
<p> </div>
<strong><%= current_user.address %></strong> <div class="md:col-span-4 mt-4 md:mt-0">
</p> <p class="font-mono md:text-right mb-0 p-4 border border-gray-300 rounded-lg overflow-hidden">
</section> <% if @balance %>
<span class="text-xl"><%= number_with_delimiter @balance %> sats</span><br>
<span class="text-sm text-gray-500">Available balance</span>
<% else %>
<span class="text-xl">n/a sats</span><br>
<span class="text-sm text-gray-500">Balance unavailable</span>
<% end %>
</p>
</div>
</section>
<section> <section>
<h3>Wallet Apps</h3> <h3>Lightning Address</h3>
<p> <p>
You can connect various wallet apps to your Kosmos account. This allows Your Kosmos user address is also a
you to both receive and send sats. Any wallet that supports <a class="ks-text-link" href="https://lightningaddress.com/" target="_blank">Lightning Address</a>!
<a href="https://bluewallet.io/lndhub/" class="ks-text-link" target="_blank">LNDHub</a> The easiest way to receive sats is by just giving out your address:
accounts should be able to add/import your account using our setup </p>
code/URL: <p>
</p> <strong><%= current_user.address %></strong>
<p class="my-6 text-center md:text-left"> </p>
<button id="copy-setup-code" class="btn-md btn-blue">Copy setup code/URL</button> </section>
<span class="mx-2 my-2 md:my-0 block md:inline">or</span>
<button id="show-setup-code" class="btn-md btn-blue">Show setup QR code</button>
<button id="hide-setup-code" class="btn-md btn-blue hidden">Hide setup QR code</button>
</p>
<p id="setup-code" class="hidden my-10 w-full text-center">
<%= raw @svg %>
</p>
</section>
<section> <section>
<h3>Recommended Apps</h3> <h3>Wallet Apps</h3>
<div class="w-full grid grid-cols-1 gap-y-4 md:grid-cols-12 <p>
md:gap-y-6 md:gap-x-4 md:items-center"> You can connect various wallet apps to your Kosmos account. This allows
<h4 class="md:col-span-3"> you to both receive and send sats. Any wallet that supports
<a href="https://bluewallet.io" class="ks-text-link text-xl" <a href="https://bluewallet.io/lndhub/" class="ks-text-link" target="_blank">LNDHub</a>
title="Blue Wallet" target="_blank"> accounts should be able to add/import your account using our setup
<%= image_tag("/img/logos/bluewallet.svg", class: 'h-16') %> code/URL:
</a> </p>
</h4> <p class="my-6 text-center md:text-left">
<p class="md:col-span-4 mb-0 text-gray-500"> <button id="copy-setup-code" class="btn-md btn-blue">Copy setup code/URL</button>
Android / iOS / macOS <span class="mx-2 my-2 md:my-0 block md:inline">or</span>
</p> <button id="show-setup-code" class="btn-md btn-blue">Show setup QR code</button>
<p class="md:col-span-5 mb-0"> <button id="hide-setup-code" class="btn-md btn-blue hidden">Hide setup QR code</button>
When adding a wallet, choose "Import wallet" on the bottom of the screen, </p>
then scan the setup QR code. <p id="setup-code" class="hidden my-10 w-full text-center">
</p> <%= raw @svg %>
<h4 class="md:col-span-3"> </p>
<a href="https://getalby.com/" class="ks-text-link text-xl" </section>
title="Alby" target="_blank">
<%= image_tag("/img/logos/alby.svg", class: 'h-16') %> <section>
</a> <h3>Recommended Apps</h3>
</h4> <div class="w-full grid grid-cols-1 gap-y-4 md:grid-cols-12
<p class="md:col-span-4 mb-0 text-gray-500"> md:gap-y-6 md:gap-x-4 md:items-center">
Firefox / Chrome (Opera, Brave, Chromium-based browsers) <h4 class="md:col-span-3">
</p> <a href="https://bluewallet.io" class="ks-text-link text-xl"
<p class="md:col-span-5 mb-0"> title="Blue Wallet" target="_blank">
Choose "LNDHub (Bluewallet)" in the connect dialog and paste the setup <%= image_tag("/img/logos/bluewallet.svg", class: 'h-16') %>
URL in the "LNDHub Export URI" field. </a>
</p> </h4>
<p class="md:col-span-4 mb-0 text-gray-500">
Android / iOS / macOS
</p>
<p class="md:col-span-5 mb-0">
When adding a wallet, choose "Import wallet" on the bottom of the screen,
then scan the setup QR code.
</p>
<h4 class="md:col-span-3">
<a href="https://getalby.com/" class="ks-text-link text-xl"
title="Alby" target="_blank">
<%= image_tag("/img/logos/alby.svg", class: 'h-16') %>
</a>
</h4>
<p class="md:col-span-4 mb-0 text-gray-500">
Firefox / Chrome (Opera, Brave, Chromium-based browsers)
</p>
<p class="md:col-span-5 mb-0">
Choose "LNDHub (Bluewallet)" in the connect dialog and paste the setup
URL in the "LNDHub Export URI" field.
</p>
</div>
</section>
</div> </div>
</section> </main>
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {