diff --git a/packages/pockethost.io/src/components/Button/Button.svelte b/packages/pockethost.io/src/components/Button/Button.svelte index 2a41159c..8bfab0dd 100644 --- a/packages/pockethost.io/src/components/Button/Button.svelte +++ b/packages/pockethost.io/src/components/Button/Button.svelte @@ -1,22 +1,31 @@ - +
+ +
+ + diff --git a/packages/pockethost.io/src/components/Button/types.ts b/packages/pockethost.io/src/components/Button/types.ts index a56634cb..534c6a69 100644 --- a/packages/pockethost.io/src/components/Button/types.ts +++ b/packages/pockethost.io/src/components/Button/types.ts @@ -1,5 +1,21 @@ -export enum ButtonStyles { +export enum ButtonSizes { Micro = 'micro', Normal = 'normal', - Wide = 'wide', + Wide = 'wide' +} + +/** + * | 'primary' + | 'secondary' + | 'success' + | 'danger' + | 'warning' + | 'info' + | 'light' + | 'dark' + | 'link'; + */ +export enum ButtonColors { + Primary = 'primary', + Light = 'light' } diff --git a/packages/pockethost.io/src/components/CodeSample.svelte b/packages/pockethost.io/src/components/CodeSample.svelte index 5f2fbf48..4ec85dc6 100644 --- a/packages/pockethost.io/src/components/CodeSample.svelte +++ b/packages/pockethost.io/src/components/CodeSample.svelte @@ -1,35 +1,32 @@
- -
- -
+ +
+ +
diff --git a/packages/pockethost.io/src/components/CopyButton.svelte b/packages/pockethost.io/src/components/CopyButton.svelte index 0c61ec2e..a3535e85 100644 --- a/packages/pockethost.io/src/components/CopyButton.svelte +++ b/packages/pockethost.io/src/components/CopyButton.svelte @@ -1,17 +1,17 @@ - + diff --git a/packages/pockethost.io/src/components/Icons/Github.svelte b/packages/pockethost.io/src/components/Icons/Github.svelte new file mode 100644 index 00000000..d114c5f5 --- /dev/null +++ b/packages/pockethost.io/src/components/Icons/Github.svelte @@ -0,0 +1,5 @@ + + + diff --git a/packages/pockethost.io/src/components/Navbar.svelte b/packages/pockethost.io/src/components/Navbar.svelte index 937b8a1c..4de57be1 100644 --- a/packages/pockethost.io/src/components/Navbar.svelte +++ b/packages/pockethost.io/src/components/Navbar.svelte @@ -1,9 +1,24 @@ @@ -12,7 +12,7 @@ diff --git a/packages/pockethost.io/src/routes/+page.svelte b/packages/pockethost.io/src/routes/+page.svelte index 4bff68eb..d4be5c9e 100644 --- a/packages/pockethost.io/src/routes/+page.svelte +++ b/packages/pockethost.io/src/routes/+page.svelte @@ -1,6 +1,6 @@ - - {#if instance} - {#if instance.status === InstanceStatuses.Started} - <Caption>Your PocketHost instance is now live.</Caption> - <div> - Admin URL: <a href={`${url}/_`} target="_blank">{`${url}/_`}</a> - </div> - <div> - JavaScript: - <CodeSample {code} /> - </div> + <main> + <Title /> + {#if instance} + {#if instance.status === InstanceStatuses.Started} + <ProvisioningStatus status={instance.status} /> + + <div> + Admin URL: <a href={`${url}/_`} target="_blank">{`${url}/_`}</a> + </div> + <div> + JavaScript: + <CodeSample {code} /> + </div> + {/if} + {#if instance.status !== InstanceStatuses.Started} + <Caption>Please stand by, your instance is starting now...</Caption> + <div class="provisioning"> + <ProvisioningStatus status={instance.status} size={ProvisioningSize.Hero} /> + </div> + {/if} {/if} - {#if instance.status !== InstanceStatuses.Started} - <Caption>Please stand by, your instance is starting now...</Caption> - <div class="provisioning"> - <ProvisioningStatus status={instance.status} size={ProvisioningSize.Hero} /> - </div> - {/if} - {/if} + <Button href="/dashboard">< Back to Dashboard</Button> + </main> </Protected> <style lang="scss"> - .provisioning { - text-align: center; + main { + margin: 10px; + .provisioning { + text-align: center; + } + a { + text-decoration: initial; + } } </style> diff --git a/packages/pockethost.io/src/routes/app/new/+page.svelte b/packages/pockethost.io/src/routes/app/new/+page.svelte index 57d2c8e6..bca427ec 100644 --- a/packages/pockethost.io/src/routes/app/new/+page.svelte +++ b/packages/pockethost.io/src/routes/app/new/+page.svelte @@ -1,7 +1,7 @@ <script lang="ts"> import { browser } from '$app/environment' import Button from '$components/Button/Button.svelte' - import { ButtonStyles } from '$components/Button/types' + import { ButtonColors, ButtonSizes } from '$components/Button/types' import Error from '$components/Error/Error.svelte' import { parseError } from '$components/Error/parseError' import Protected from '$components/Protected.svelte' @@ -48,13 +48,12 @@ </script> <Protected> - <Title /> + <Title first="New" second="App" /> <main> - <h2>New App</h2> <div class="caption">Choose a name for your PocketBase app.</div> <div class="subdomain"> <label for="instanceName">Instance Name</label> - <Button click={() => (instanceName = generateSlug(2))} style={ButtonStyles.Micro}> + <Button click={() => (instanceName = generateSlug(2))} size={ButtonSizes.Micro}> <Fa icon={faRefresh} /></Button > @@ -67,6 +66,7 @@ </div> <Error>{errorMessage}</Error> <Button click={handleCreate}>Create</Button> + <Button href={`/dashboard`} color={ButtonColors.Light}>Cancel</Button> </main> </Protected> diff --git a/packages/pockethost.io/src/routes/dashboard/+page.svelte b/packages/pockethost.io/src/routes/dashboard/+page.svelte index 52dac164..3c661843 100644 --- a/packages/pockethost.io/src/routes/dashboard/+page.svelte +++ b/packages/pockethost.io/src/routes/dashboard/+page.svelte @@ -1,12 +1,14 @@ <script lang="ts"> import Button from '$components/Button/Button.svelte' - import { ButtonStyles } from '$components/Button/types' + import { ButtonSizes } from '$components/Button/types' + import Gap from '$components/Gap.svelte' import Protected from '$components/Protected.svelte' import ProvisioningStatus from '$components/ProvisioningStatus/ProvisioningStatus.svelte' import Title from '$components/Title/Title.svelte' import { getAllInstancesById } from '@pockethost/common/src/pocketbase' import { InstanceStatuses, type Instance_Out_ByIdCollection } from '@pockethost/common/src/schema' import { values } from '@s-libs/micro-dash' + import { Col, Container, Row } from 'sveltestrap' let apps: Instance_Out_ByIdCollection = {} getAllInstancesById() @@ -19,39 +21,56 @@ </script> <Protected> - <Title /> + <Title first="Dash" second="board" /> <main> - <h2>Dashboard</h2> - <h4>Apps</h4> - {#each values(apps) as app} - <div> - <ProvisioningStatus status={app.status} /> - {app.subdomain}.pockethost.io + <h2>Apps</h2> + <Container> + {#each values(apps) as app} + <Row> + <Col> + <ProvisioningStatus status={app.status} /> + </Col> + <Col> + {app.subdomain}.pockethost.io + </Col> - <Button style={ButtonStyles.Micro} href={`/app/instances/${app.id}`}>Details</Button> - <Button - disabled={app.status !== InstanceStatuses.Started} - style={ButtonStyles.Micro} - click={() => { - window.open(`https://${app.subdomain}.pockethost.io/_`) - }}>Admin</Button - > - </div> - {/each} - <Button href="/app/new">+</Button> + <Col> + <Button size={ButtonSizes.Micro} href={`/app/instances/${app.id}`}>Details</Button> + + <Button + disabled={app.status !== InstanceStatuses.Started} + size={ButtonSizes.Micro} + click={() => { + window.open(`https://${app.subdomain}.pockethost.io/_`) + }}>Admin</Button + > + </Col> + </Row> + {/each} + </Container> + <Gap /> + <div class="newApp"> + <Button href="/app/new" size={ButtonSizes.Wide}>+ New App</Button> + </div> </main> </Protected> <style type="text/scss"> main { - padding: 1em; - margin-left: auto; + margin-top: 10px; margin-right: auto; - - .caption { - font-size: 30px; - margin-top: 20px; - margin-bottom: 20px; + margin-bottom: 10px; + margin-left: auto; + max-width: 600px; + padding: 10px; + h2 { + text-align: center; + } + .newApp { + width: 200px; + margin-left: auto; + margin-right: auto; + text-align: center; } } </style> diff --git a/packages/pockethost.io/src/routes/login/+page.svelte b/packages/pockethost.io/src/routes/login/+page.svelte index 2dc46268..31787a00 100644 --- a/packages/pockethost.io/src/routes/login/+page.svelte +++ b/packages/pockethost.io/src/routes/login/+page.svelte @@ -3,6 +3,7 @@ import Title from '$components/Title/Title.svelte' import { redirect } from '$util/redirect' import { authViaEmail } from '@pockethost/common/src/pocketbase' + import { Form, FormGroup, Input, Label } from 'sveltestrap' let email = '' let password = '' @@ -21,18 +22,21 @@ } </script> -<Title first="Log" second="In" /> +<Title first="Log" second="in" /> <main> <error>{loginError}</error> - <div> - <label for="email">Email</label> - <input name="email" type="email" bind:value={email} /> - </div> - <div> - <label for="password">Password</label> - <input name="password" type="password" bind:value={password} /> - </div> + <Form> + <FormGroup> + <Label for="email">Email</Label> + <Input type="email" id="email" bind:value={email} /> + </FormGroup> + <FormGroup> + <Label for="password">Password</Label> + <Input type="password" id="password" bind:value={password} /> + </FormGroup> + </Form> + <div> Need to <a href="/signup">create an account</a>? </div> @@ -40,25 +44,9 @@ </main> <style type="text/scss"> - error { - color: red; - display: block; - } - - label { - display: block; - font-weight: bold; - width: 200px; - } main { - padding: 1em; + max-width: 300px; margin-left: auto; margin-right: auto; } - - .caption { - font-size: 30px; - margin-top: 20px; - margin-bottom: 20px; - } </style> diff --git a/packages/pockethost.io/src/routes/signup/+page.svelte b/packages/pockethost.io/src/routes/signup/+page.svelte index 21a7373e..5de18eb9 100644 --- a/packages/pockethost.io/src/routes/signup/+page.svelte +++ b/packages/pockethost.io/src/routes/signup/+page.svelte @@ -1,12 +1,15 @@ <script lang="ts"> import Button from '$components/Button/Button.svelte' + import Error from '$components/Error/Error.svelte' import { parseError } from '$components/Error/parseError' import Title from '$components/Title/Title.svelte' + import { TitleSize } from '$components/Title/types' import { redirect } from '$util/redirect' import { authViaEmail, createUser } from '@pockethost/common/src/pocketbase' + import { Form, FormGroup, Input, Label } from 'sveltestrap' let email = '' - let errorMessage = '' + let emailError = '' let password = '' let passwordError = '' @@ -19,7 +22,7 @@ // .catch((e) => console.error(`user login error`, e)) const handleSignup = () => { - errorMessage = '' + emailError = '' passwordError = '' createUser(email, password) .then((user) => { @@ -33,25 +36,27 @@ .catch((e) => console.error(`user login error`, e)) }) .catch((e) => { - errorMessage = parseError(e) - console.error(errorMessage, e) + emailError = parseError(e) + console.error(emailError, e) }) } </script> -<Title first="Sign" second="Up" /> +<Title first="Sign" second="up" size={TitleSize.Normal} /> <main> - <div> - <label for="email">Email</label> - <input name="email" type="email" bind:value={email} /> - <error>{errorMessage}</error> - </div> - <div> - <label for="password">Password</label> - <input name="password" type="password" bind:value={password} /> - <error>{passwordError}</error> - </div> + <Form> + <FormGroup> + <Label for="email">Email Address</Label> + <Input type="email" bind:value={email} id="email" /> + <Error>{emailError}</Error> + </FormGroup> + <FormGroup> + <Label for="password">Password</Label> + <Input type="password" name="password" id="password" bind:value={password} /> + <Error>{passwordError}</Error> + </FormGroup> + </Form> <Button click={handleSignup} disabled={email.length === 0 || password.length === 0}> Sign Up </Button> @@ -61,25 +66,30 @@ </main> <style type="text/scss"> - error { - color: red; - display: block; - } - - label { - display: block; - font-weight: bold; - width: 200px; - } main { - padding: 1em; + max-width: 300px; margin-left: auto; margin-right: auto; - } + error { + color: red; + display: block; + } - .caption { - font-size: 30px; - margin-top: 20px; - margin-bottom: 20px; + label { + display: block; + font-weight: bold; + width: 200px; + } + main { + padding: 1em; + margin-left: auto; + margin-right: auto; + } + + .caption { + font-size: 30px; + margin-top: 20px; + margin-bottom: 20px; + } } </style>