fix some homepage stuff

This commit is contained in:
Kendell R 2023-09-11 17:06:09 -07:00
parent a6c8804552
commit 5b1f6b1013
No known key found for this signature in database
GPG key ID: 64314E306EEF6109
2 changed files with 40 additions and 45 deletions

View file

@ -22,8 +22,6 @@
let state = UIState.Idle; let state = UIState.Idle;
let stateStr = ""; let stateStr = "";
let dialogConnection = false;
let devTransport: Transport; let devTransport: Transport;
async function onOpen() { async function onOpen() {
console.log("[TRANSPORT DEV] opened"); console.log("[TRANSPORT DEV] opened");
@ -112,34 +110,29 @@
</div> </div>
{:else} {:else}
<div class="h-full flex flex-col p-4 gap-6"> <div class="h-full flex flex-col p-4 gap-6">
<div class="flex items-center text-3xl"> <div class="flex">
<div class="flex flex-col flex-1 items-center gap-2 text-3xl px-2">
<Icon icon="material-symbols:sailing" /> <Icon icon="material-symbols:sailing" />
<p class="text-2xl ml-3">Adrift</p> <p>Adrift</p>
</div> </div>
<Card <div class="flex flex-col flex-1 text-center justify-end px-2">
type="elevated" <p class="sm:text-xl lg:text-2xl">
extraOptions={{ class: "m3-container type-elevated lg:w-3/4" }} A fast and modern decentralized proxy network
> </p>
<h2 class="text-6xl">Surf the web, Adrift</h2> </div>
<h2 class="text-2xl">A fast and modern decentralized proxy network</h2> <div class="flex flex-col flex-1 items-center justify-center px-2">
<div class="mt-6 flex gap-4">
<Button type="filled" on:click={() => (dialogConnection = true)}>
Start browsing
</Button>
{#if !import.meta.env.VITE_ADRIFT_SINGLEFILE} {#if !import.meta.env.VITE_ADRIFT_SINGLEFILE}
<Button <Button
type="text" type="tonal"
on:click={() => downloadShortcut("adrift.html", "Homework")} on:click={() => downloadShortcut("adrift.html", "Homework")}
> >
Get shortcut Get shortcut
</Button> </Button>
{/if} {/if}
</div> </div>
</Card> </div>
<Card <ConnectionCmp bind:state bind:stateStr />
type="elevated" <Card type="elevated">
extraOptions={{ class: "m3-container type-elevated mt-auto" }}
>
<div class="flex gap-8 items-center"> <div class="flex gap-8 items-center">
<a class="mr-auto" href="https://mercurywork.shop"> <a class="mr-auto" href="https://mercurywork.shop">
© 2023 Mercury Workshop © 2023 Mercury Workshop
@ -154,7 +147,6 @@
</div> </div>
</Card> </Card>
</div> </div>
<ConnectionCmp bind:dialogConnection bind:state bind:stateStr />
{/if} {/if}
<StyleFromScheme <StyleFromScheme

View file

@ -2,21 +2,22 @@
import { initializeApp } from "firebase/app"; import { initializeApp } from "firebase/app";
import { import {
Auth, Auth,
browserLocalPersistence,
createUserWithEmailAndPassword, createUserWithEmailAndPassword,
getAuth, getAuth,
setPersistence,
signInWithEmailAndPassword, signInWithEmailAndPassword,
browserLocalPersistence,
setPersistence,
} from "firebase/auth"; } from "firebase/auth";
import { import {
Button, Button,
Dialog, Dialog,
SnackbarAnim,
TextField,
Divider, Divider,
ListItemLabel, ListItemLabel,
RadioAnim2, RadioAnim2,
SnackbarAnim,
TextField,
} from "m3-svelte"; } from "m3-svelte";
import Icon from "@iconify/svelte";
import { setBareClientImplementation } from "@mercuryworkshop/bare-client-custom"; import { setBareClientImplementation } from "@mercuryworkshop/bare-client-custom";
import { import {
@ -29,8 +30,6 @@
import { UIState } from "./state"; import { UIState } from "./state";
type valueof<T> = T[keyof T]; type valueof<T> = T[keyof T];
export let dialogConnection: boolean;
let tlsWarningShown = false; let tlsWarningShown = false;
let selectedTracker = Object.keys(trackerList)[0] as keyof typeof trackerList; let selectedTracker = Object.keys(trackerList)[0] as keyof typeof trackerList;
@ -119,8 +118,12 @@
} }
</script> </script>
<Dialog bind:open={dialogConnection} headline="Connect to a tracker"> <div
<div class="flex flex-col -mx-4"> class="vertical-container m-auto rounded-2xl bg-surface-container-high p-6"
>
<Icon icon="ic:round-cable" height={24} class="text-secondary" />
<p class="m3-font-headline-small">Connect to a tracker</p>
<div class="flex flex-col w-full -mx-4">
{#each Object.entries(trackerList) as [trackerId, tracker], i} {#each Object.entries(trackerList) as [trackerId, tracker], i}
{#if i != 0} {#if i != 0}
<Divider /> <Divider />
@ -144,15 +147,12 @@
</ListItemLabel> </ListItemLabel>
{/each} {/each}
</div> </div>
<p class="font-bold mt-4" class:hide-warning={!tlsWarningShown}> <p class="tls-warning mt-4" class:hidden={!tlsWarningShown}>
Your data is not end-to-end encrypted, and will not be private. While TLS Your data is not end-to-end encrypted, and will not be private. While TLS
will be implemented later, for now do not enter any private information. will be implemented later, for now do not enter any private information.
Click connect again to continue. Click connect again to continue.
</p> </p>
<svelte:fragment slot="buttons"> <div class="flex gap-2 items-center mt-2 px-6">
<Button type="text" on:click={() => (dialogConnection = false)}>
Cancel
</Button>
<Button <Button
type="text" type="text"
on:click={() => { on:click={() => {
@ -163,27 +163,25 @@
if (auth.currentUser) { if (auth.currentUser) {
connectNode(); connectNode();
} else { } else {
dialogConnection = false;
dialogAccount = true; dialogAccount = true;
} }
}} }}
> >
Connect to your node Connect to home node
</Button> </Button>
<Button <Button
type="tonal" type="tonal"
on:click={() => { on:click={() => {
if (tlsWarningShown) { if (tlsWarningShown) {
connectSwarm(); connectSwarm();
dialogConnection = false;
} }
tlsWarningShown = true; tlsWarningShown = true;
}} }}
> >
Connect Connect
</Button> </Button>
</svelte:fragment> </div>
</Dialog> </div>
<Dialog bind:open={dialogAccount} headline="Sign in"> <Dialog bind:open={dialogAccount} headline="Sign in">
<div class="flex gap-4 flex-col"> <div class="flex gap-4 flex-col">
<TextField name="Email" bind:value={email} /> <TextField name="Email" bind:value={email} />
@ -226,9 +224,14 @@
<SnackbarAnim bind:show={snackbar} /> <SnackbarAnim bind:show={snackbar} />
<style> <style>
.hide-warning { .vertical-container {
margin: 0; display: flex;
height: 0; flex-direction: column;
visibility: hidden; align-items: center;
gap: 1rem;
}
.tls-warning {
font-weight: bold;
max-width: 60ch;
} }
</style> </style>