diff --git a/portal/dashboard.go b/portal/dashboard.go index a359652..0738e94 100644 --- a/portal/dashboard.go +++ b/portal/dashboard.go @@ -2,7 +2,6 @@ package portal import ( "encoding/hex" - "fmt" "math" "net/http" "strconv" @@ -21,7 +20,7 @@ type ( // averages. sensibleHostAverages struct { NumHosts uint64 `json:"numhosts"` - Duration string `json:"duration"` + Duration uint64 `json:"duration"` StoragePrice float64 `json:"storageprice"` Collateral float64 `json:"collateral"` DownloadBandwidthPrice float64 `json:"downloadbandwidthprice"` @@ -29,6 +28,7 @@ type ( ContractPrice float64 `json:"contractprice"` BaseRPCPrice float64 `json:"baserpcprice"` SectorAccessPrice float64 `json:"sectoraccessprice"` + SCRate float64 `json:"scrate"` } // hostsRequest contains the body of a /dashboard/hosts request. @@ -136,19 +136,6 @@ func (api *portalAPI) averagesHandlerGET(w http.ResponseWriter, req *http.Reques // readable format. rate is the exchange rate between SC and the // currency to display the values in. func convertHostAverages(ha modules.HostAverages, rate float64) sensibleHostAverages { - var d string - switch { - case ha.Duration < types.BlocksPerWeek: - d = fmt.Sprintf("%.1f days", float64(ha.Duration) / float64(types.BlocksPerDay)) - break - case ha.Duration < types.BlocksPerMonth: - d = fmt.Sprintf("%.1f weeks", float64(ha.Duration) / float64(types.BlocksPerWeek)) - break - default: - d = fmt.Sprintf("%.1f months", float64(ha.Duration) / float64(types.BlocksPerMonth)) - break - } - sp, _ := ha.StoragePrice.Mul(smodules.BlockBytesPerMonthTerabyte).Float64() c, _ := ha.Collateral.Mul(smodules.BlockBytesPerMonthTerabyte).Float64() dbp, _ := ha.DownloadBandwidthPrice.Mul(smodules.BytesPerTerabyte).Float64() @@ -161,14 +148,15 @@ func convertHostAverages(ha modules.HostAverages, rate float64) sensibleHostAver sha := sensibleHostAverages{ NumHosts: ha.NumHosts, - Duration: d, - StoragePrice: sp * rate / precision, - Collateral: c * rate / precision, - DownloadBandwidthPrice: dbp * rate / precision, - UploadBandwidthPrice: ubp * rate / precision, - ContractPrice: cp * rate / precision, - BaseRPCPrice: brp * rate / precision, - SectorAccessPrice: sap * rate / precision, + Duration: uint64(ha.Duration), + StoragePrice: sp / precision, + Collateral: c / precision, + DownloadBandwidthPrice: dbp / precision, + UploadBandwidthPrice: ubp / precision, + ContractPrice: cp / precision, + BaseRPCPrice: brp / precision, + SectorAccessPrice: sap / precision, + SCRate: rate, } return sha diff --git a/webportal/css/dashboard.css b/webportal/css/dashboard.css index 3035804..29417f1 100644 --- a/webportal/css/dashboard.css +++ b/webportal/css/dashboard.css @@ -99,21 +99,30 @@ section { display: flex; flex-direction: column; - width: 100%; align-items: flex-start; - border: 1px solid var(--textSecondary); - border-radius: 0.5rem; - padding: 0.5rem; - margin-bottom: 0.5rem; -} - -section:last-child { - margin-bottom: 0; + margin-bottom: 1rem; } section h2 { margin: 0; font-size: 1.2rem; + font-weight: normal; +} + +.flex { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.flex > * { + margin-right: 1rem; +} + +.flex-row { + display: flex; + flex-direction: row; + align-items: center; } label { @@ -131,27 +140,29 @@ label { } .input-actual { - max-width: 6rem; + flex-grow: 1; + height: 2rem; } -#payment-currency { +.input-unit { font-size: 1rem; color: var(--textSecondary); - margin-right: 0.5rem; -} - -.error { - color: var(--error); + margin: 0 0.5rem; } button { - width: 50%; - max-width: 12rem; + width: 12rem; height: 2.5rem; margin-top: 0.5rem; font-size: 1rem; } +.link { + color: var(--link); + cursor: pointer; + text-decoration: none; +} + .password { position: relative; width: 100%; @@ -183,7 +194,7 @@ button { font-size: 0.8rem; width: 1rem; height: 1rem; - color: #001f8f; + color: var(--hint); background-color: var(--textSecondary); position: relative; border: 1px solid var(--textSecondary); @@ -195,8 +206,8 @@ button { .hint { position: absolute; - left: 1.5rem; - top: 0; + bottom: 1.5rem; + left: calc(50% - 5rem); color: var(--hint); background-color: var(--textSecondary); font-size: 0.8rem; @@ -207,57 +218,101 @@ button { min-width: 10rem; z-index: 2; display: none; + white-space: normal; } .hint-button:hover .hint { display: initial; } -.balance { - text-align: left; -} - .container { width: 100%; } .content { display: flex; - flex-direction: row; - flex-wrap: wrap; - margin-bottom: -0.5rem; + flex-direction: column; + border: 1px solid var(--textSecondary); + border-radius: 0.5rem; + min-width: 16rem; + padding: 0.5rem; } .content-item { display: flex; - flex-direction: column; - margin-right: 0.5rem; + flex-direction: row; margin-bottom: 0.5rem; - padding: 0.5rem; - border: 1px solid var(--textSecondary); - border-radius: 0.5rem; - min-width: 12rem; + align-items: center; } .content-item:last-child { - margin-right: 0; + margin-bottom: 0; +} + +.content-label { + flex-grow: 1; + margin-right: 1rem; + white-space: nowrap; } -.content-error { - border-color: #af0000; +.content-item-top .content-label { + align-self: flex-start; } -.average { +.content-subitem { + display: flex; + flex-direction: column; + align-items: flex-end; +} + +.content-primary { + font-family: 'Courier', monospace; + font-size: 1rem; + font-weight: bold; + margin: 0; +} + +.content-secondary { + font-family: 'Courier', monospace; font-size: 0.8rem; + margin: 0; } -#select-payment { - margin-top: 0.5rem; +.average { + font-size: 0.8rem; + align-self: flex-start; + margin-bottom: 0; + cursor: pointer; } select { - padding: 0.5rem; + padding: 0 0.5rem; font-size: 1rem; + height: 2rem; + border-style: inset; + outline: none; +} + +.result { + height: 2.5rem; + display: flex; + flex-grow: 1; + align-items: center; + margin-left: 1rem; + margin-top: 0.5rem; +} + +.result * { + color: var(--textSecondary); + font-size: 0.8rem; + text-align: center; + width: 100%; +} + +.error { + color: var(--error); + font-size: 0.8rem; + text-align: center; } .table-container { @@ -297,6 +352,7 @@ tbody > tr:nth-child(odd) { .history-button { width: 4rem; + height: 1.8rem; background-color: var(--backgroundForm); border: 1px solid var(--textSecondary); } @@ -341,10 +397,14 @@ tbody > tr:nth-child(odd) { fill: #ffffff; } -#payment-amount { +#reveal > div { width: 100%; } +label[for='reveal-text'] { + margin-top: 1rem; +} + #payment-message { color: rgb(105, 115, 134); font-size: 1rem; @@ -360,59 +420,46 @@ tbody > tr:nth-child(odd) { } #payment-element { + margin-top: 0.5rem; margin-bottom: 1.5rem; } -.spinner, -.spinner:before, -.spinner:after { - border-radius: 50%; +#stripe-logo { + height: 3rem; + margin-top: 2rem; } + .spinner { - color: var(--textSecondary); - font-size: 1.4rem; - text-indent: -99999px; - margin: 0 auto; + display: inline-block; position: relative; - width: 1.25rem; - height: 1.25rem; - box-shadow: inset 0 0 0 2px; - -webkit-transform: translateZ(0); - -ms-transform: translateZ(0); - transform: translateZ(0); -} -.spinner:before, -.spinner:after { + width: 2.5rem; + height: 2.5rem; + margin: 0 auto; +} + +.spinner div { + display: block; position: absolute; - content: ''; -} -.spinner:before { - width: 0.7rem; - height: 1.3rem; - background: var(--button); - border-radius: 1.3rem 0 0 1.3rem; - top: -0.2px; - left: -0.2px; - -webkit-transform-origin: 0.7rem 0.6rem; - transform-origin: 0.7rem 0.6rem; - -webkit-animation: loading 2s infinite ease 1.5s; - animation: loading 2s infinite ease 1.5s; -} -.spinner:after { - width: 0.7rem; - height: 0.6rem; - background: var(--button); - border-radius: 0 0.6rem 0.6rem 0; - top: -0.1px; - left: 0.6rem; - -webkit-transform-origin: 0px 0.6rem; - transform-origin: 0px 0.6rem; - -webkit-animation: loading 2s infinite ease; - animation: loading 2s infinite ease; -} -button:hover .spinner:before, -button:hover .spinner:after { - background: var(--buttonHovered); + width: 50%; + height: 50%; + left: 25%; + top: 25%; + border: 0.25rem solid var(--textSecondary); + border-radius: 50%; + animation: loading 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: var(--textSecondary) transparent transparent transparent; +} + +.spinner div:nth-child(1) { + animation-delay: -0.45s; +} + +.spinner div:nth-child(2) { + animation-delay: -0.3s; +} + +.spinner div:nth-child(3) { + animation-delay: -0.15s; } @-webkit-keyframes loading { @@ -464,4 +511,24 @@ button:hover .spinner:after { table { font-size: 0.8rem; } + + section, .content, .flex { + width: 100%!important; + margin-right: 0!important; + } + + #payment-element { + margin: 0 auto; + margin-top: 0.5rem; + margin-bottom: 1.5rem; + } + + #stripe-logo { + margin: 0 auto; + margin-top: 2rem; + } + + #payment-submit, #payment-back { + align-self: center; + } } diff --git a/webportal/css/main.css b/webportal/css/main.css index 7c00872..eac4c03 100644 --- a/webportal/css/main.css +++ b/webportal/css/main.css @@ -10,7 +10,7 @@ --buttonEnd: #5f5f5f; --buttonHoverStart: #7f7f7f; --buttonHoverEnd: #3f3f3f; - --hint: #001f8f; + --hint: #070f1f; --tableRow: #00071f; } diff --git a/webportal/css/rent.css b/webportal/css/rent.css index 9f5ff2c..13d250a 100644 --- a/webportal/css/rent.css +++ b/webportal/css/rent.css @@ -1,8 +1,3 @@ -h1 a { - color: inherit; - text-decoration: none; -} - .frame { display: flex; flex-direction: column; diff --git a/webportal/dashboard.html b/webportal/dashboard.html index b8bcb47..c6b6fb7 100644 --- a/webportal/dashboard.html +++ b/webportal/dashboard.html @@ -36,45 +36,80 @@

Overview

-
-

Your balance:

-
-
-

Available:

-

+
+
+

Your balance:

+
+
+ +
+

+

+
+
+
+ +
+

+

+
+
-
-

Locked:

-

+
+
+

Network statistics:

+
+
+ +
+

+
+
+
+ +
+

+
+
-
-
+ +
-

Network statistics:

+

Network averages:

-

Block height:

-

-
-
-

Number of hosts:

-

-
-
-

Average storage price:

-

+ +
+

+

+
-

Average upload price:

-

+ +
+

+

+
-

Average download price:

-

+ +
+

+

+
-

Average contract duration:

-

+ +
+

+

+
@@ -101,7 +136,8 @@

Contract Information

- @@ -150,205 +186,325 @@

Contract Information

Current Spendings

-
-

Spendings in :

- - - - - - - - - - - - - -
Locked in contracts:
Used:
Satellite overhead:
-
-
-

Spendings in :

- - - - - - - - - - - - - -
Locked in contracts:
Used:
Satellite overhead:
-
+
+
+

Spendings in :

+
+
+ +
+

+

+
+
+
+ +
+

+

+
+
+
+ +
+

+

+
+
+
+
+
+

Spendings in :

+
+
+ +
+

+

+
+
+
+ +
+

+

+
+
+
+ +
+

+

+
+
+
+
+

Payment Plan

-
-

You haven't created a payment plan yet.

-
-
- - -
-
-