Skip to content

Commit

Permalink
Merge branch 'main' into 66-inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
claireolmstead authored Jan 12, 2024
2 parents beb8df6 + eb256cd commit 83f97b2
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/components/AddControlKey.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
classOverrides="border-2 rounded-lg"
/>
<div class="flex w-350 justify-between">
<button on:click|preventDefault={addControlKey} class="btn-primary action-btn-l">Add It</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel action-btn-r">Cancel Add </button>
<button on:click|preventDefault={addControlKey} class="btn-primary">Add It</button>
<button on:click|preventDefault={cancelAction} class="btn-no-fill">Cancel Add </button>
</div>
</form>
</div>
Expand Down
8 changes: 0 additions & 8 deletions src/components/Banner.svelte

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Capacity.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let signingAddress = ''; // eslint-disable-line no-unused-vars
let epochNumber = 0n;
let connected;
let connected: boolean;
storeConnected.subscribe((val) => (connected = val));
let msaInfo: MsaInfo = { isProvider: false, msaId: 0, providerName: '' };
Expand Down Expand Up @@ -74,7 +74,7 @@
});
</script>

<div class="p-14 ml-8 w-500 action-card font-semibold tracking-wider bg-gradient-to-br">
<div class="p-14 ml-8 flex-grow action-card font-semibold tracking-wider bg-bg-black">
<p class="text-2xl pb-6">Capacity</p>
{#if !connected}
<p>Not connected</p>
Expand Down
13 changes: 7 additions & 6 deletions src/components/ChainStatus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
export let epochNumber = 0n;
</script>

<div id="chain-status"
class=" p-8 h-fit shadow-md flex items-stretch rounded-xl font-semibold tracking-wider"
<div
id="chain-status"
class="p-8 h-fit shadow-md flex items-stretch bg-bg-black rounded-xl font-semibold tracking-wider"
>
<div class="text-3xl self-center text-right border-r-2 pr-10 pl-4">
<div class="height-fit">Overview:</div>
</div>
<div class="border-r-2 px-8 grow shrink-0">
<p class="text-lg" id="connection-status-title">Connection status:</p>
<p class="text-3xl" id="connection-status-value">{connected ? 'Connected' : 'Not connected'}</p>
<p class="text-aqua text-3xl" id="connection-status-value">{connected ? 'Connected' : 'Not connected'}</p>
</div>
<div class="border-r-2 basis-1/4 px-8">
<p class="text-lg" id="block-number-title">Current Block:</p>
<p class="text-3xl" id="block-number-value">{blockNumber}</p>
<p class="text-3xl text-aqua" id="block-number-value">{blockNumber}</p>
</div>
<div class="border-r-2 basis-1/6 px-8">
<p class="text-lg" id="epoch-number-title">Epoch:</p>
<p class="text-3xl" id="epoch-number-value">{epochNumber}</p>
<p class="text-3xl text-aqua" id="epoch-number-value">{epochNumber}</p>
</div>
<div class="basis-1/6 pl-8">
<p class="text-lg" id="token-title">Token:</p>
<p class="text-3xl" id="token-value">{token}</p>
<p class="text-3xl text-aqua" id="token-value">{token}</p>
</div>
</div>
18 changes: 18 additions & 0 deletions src/components/ConnectionStatus.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script lang="ts">
export let connected = false;
</script>

<div class="flex gap-6 items-center">
<!-- {#if connected} -->
<!-- TODO: ADD REAL DATA WHEN STORE IS CONNECTED -->
<div class="flex gap-2 items-center">
<div class="bg-green-success h-1 w-1 p-1 rounded-full" />
<p class="text-md uppercase">name_OF_NETWORK</p>
</div>
<p class="text-md">NETWORK_ENDPOINT_URL</p>

<!-- TODO: CHANGE ICON WHEN APPROVED -->
<!-- TODO: ADD ONCLICK WHEN BUILDING SWITCH MODAL -->
<button on:click={() => {}}>SWITCH_ICON</button>
<!-- {/if} -->
</div>
4 changes: 2 additions & 2 deletions src/components/CreateMsa.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
</p>
<form class="flex w-350 justify-between">
<button id="create-msa-btn" on:click|preventDefault={doCreateMsa}
class="btn-primary action-btn-l">
class="btn-primary">
Create an MSA
</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel action-btn-r">Cancel</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel">Cancel</button>
</form>
</div>
<TransactionStatus bind:showSelf={showTransactionStatus} statuses={txnStatuses} />
4 changes: 2 additions & 2 deletions src/components/CreateProvider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@
<label for="providerNameCB">Provider name</label>
<input id="providerNameCB" required placeholder="Short name" maxlength={100} bind:value={newProviderName} />
<div class="flex w-350 justify-between">
<button id="create-provider-btn" on:click|preventDefault={doCreateProvider} class="btn-primary action-btn-l">
<button id="create-provider-btn" on:click|preventDefault={doCreateProvider} class="btn-primary">
Create Provider
</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel action-btn-r">Cancel</button>
<button on:click|preventDefault={cancelAction} class="btn-no-fill">Cancel</button>
</div>
</form>
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/components/Header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
import logo from '$lib/assets/logo.png';
import ConnectionStatus from './ConnectionStatus.svelte';
</script>

<header class="flex items-start justify-between mb-14">
<div>
<img alt="The project logo" src={logo} class="h-11" />
<p class="text-md font-semibold tracking-wider pl-3">Provider Dashboard</p>
</div>
<ConnectionStatus />
</header>
2 changes: 1 addition & 1 deletion src/components/Provider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
});
</script>

<div class="p-14 action-card w-500 min-w-fit font-semibold tracking-wider bg-gradient-to-br align-top">
<div class="p-14 action-card flex-grow min-w-fit font-semibold tracking-wider bg-bg-black align-top">
<table>
<tr>
<td colspan="2" class="text-2xl pb-6">Provider</td>
Expand Down
4 changes: 2 additions & 2 deletions src/components/RequestToBeProvider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<div class="flex w-350 justify-between">

<button on:click|preventDefault={doProposeToBeProvider} id="request-2b-provider-btn"
class="btn-primary action-btn-l">
class="btn-primary">
Submit Request To Be Provider</button
>
<button on:click|preventDefault={cancelAction} class="btn-cancel action-btn-r">Cancel</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel">Cancel</button>
</div>
</form>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Stake.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
</div>
</div>
<div class="flex w-350 justify-between">
<button on:click|preventDefault={stake} class="btn-primary action-btn-l">Stake</button>
<button on:click|preventDefault={cancelAction} class="btn-cancel action-btn-r">Cancel</button>
<button on:click|preventDefault={stake} class="btn-primary">Stake</button>
<button on:click|preventDefault={cancelAction} class="btn-no-fill">Cancel</button>
</div>
</form>
</div>
Expand Down
Binary file added src/lib/assets/bg-wave.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/lib/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
import Header from '../components/Header.svelte';
import wave from '$lib/assets/bg-wave.png';
</script>

<div>
<img alt="The project logo" src={wave} class="fixed w-[100%] top-0 right-0 z-[-1]" />
<Header />
<slot class="z-10" />
</div>
;
26 changes: 10 additions & 16 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import {
storeBlockNumber, storeChainInfo,
storeBlockNumber,
storeChainInfo,
storeConnected,
storeMsaInfo,
storeToken,
Expand All @@ -13,11 +14,8 @@
import KeySelection from '$components/KeySelection.svelte';
import ProviderActions from '$components/ProviderActions.svelte';
import ChainStatus from '$components/ChainStatus.svelte';
import Banner from '$components/Banner.svelte';
import logo from '$lib/assets/logo.png';
import topright from '$lib/assets/top-right-bars.png';
import bottomleft from '$lib/assets/bottom-left-bars.png';
import type {ChainInfo, MsaInfo} from "$lib/storeTypes";
import type { ChainInfo, MsaInfo } from '$lib/storeTypes';
let token = '';
let blockNumber = 0n;
Expand All @@ -34,21 +32,19 @@
const onChangeTxnSigningAddress = (evt: Event) => {
let option = evt.target as HTMLOptionElement;
storeMsaInfo.set({isProvider: false, msaId: 0, providerName: ''});
storeMsaInfo.set({ isProvider: false, msaId: 0, providerName: '' });
transactionSigningAddress.set(option.value);
};
</script>
<img alt="decoration-top-left" src={topright} class="mt-0 absolute top right-8 -z-40"/>

<Banner />
<ChainStatus {blockNumber} {connected} {token} {epochNumber}/>
<ChainStatus {blockNumber} {connected} {token} {epochNumber} />
<div class="flex justify-center">
<Provider/>
<Capacity bind:token/>
<Provider />
<Capacity bind:token />
</div>
<div class="mt-8 text-white">
<form id="setupForm">
<Connect/>
<Connect />
<div class:hidden={!connected} class="mt-8">
<KeySelection
component="TransactionSigningKey"
Expand All @@ -59,7 +55,5 @@
/>
</div>
</form>
<ProviderActions {validAccounts}/>
<ProviderActions {validAccounts} />
</div>
<Banner />
<img alt="decoration-bottom-left" src={bottomleft} class="mt-20 fixed bottom-0 left-8 -z-40"/>
32 changes: 24 additions & 8 deletions src/style/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
/* */
@layer components {
.btn-primary {
@apply mt-6 px-8 p-3 h-14 rounded-full text-white text-lg bg-blue border-black shadow-md;
@apply w-[225px] h-10 rounded-full text-white bg-blue disabled:bg-disabled text-base font-bold;
}
.btn-cancel {
@apply mt-6 px-8 p-3 rounded-full text-white text-lg border-black shadow-md;
.btn-no-fill {
@apply text-white underline text-sm;
}
.action-card {
@apply mt-8 p-8 shrink-0 rounded-lg text-white shadow-md;
Expand All @@ -21,11 +21,27 @@
.action-card-title {
@apply font-semibold text-2xl;
}
.action-btn-l {
@apply grow mr-3;

/* typeography */
/* headers */
.section-title {
@apply font-bold text-xl;
}
.action-btn-r {
@apply grow ml-3;
.label {
@apply font-bold text-base tracking-wide;
}
/* data */
.data-value-sm {
@apply font-data text-green text-sm;
}
.data-value-base {
@apply font-data text-green text-base;
}
.data-value-lg {
@apply font-data text-green text-lg;
}
.data-value-2xl {
@apply font-data text-green text-2xl;
}
}

Expand All @@ -34,7 +50,7 @@
color: white;
min-height: 100vh;
margin: 2em;
background: linear-gradient(to bottom right, #293b59, #007da1);
background: linear-gradient(to top, #2c333d, #007da1);
}

button {
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ describe('End to End Tests', () => {
// TODO: @testing-library/svelte claims to add this automatically but it doesn't work without explicit afterEach
afterEach(() => cleanup());

test('check connection status: not connected', async () => {
const { container } = render(Page);
expect(container.querySelector('#connection-status-title')).toHaveTextContent('Connection status:');
expect(container.querySelector('#connection-status-value')).toHaveTextContent('Not connected');
});

test('connect to localhost', async () => {
const { container, getByLabelText } = render(Page);
const statusBar = container.querySelector('#chain-status');
Expand Down

0 comments on commit 83f97b2

Please sign in to comment.