Skip to content

Commit

Permalink
fix: profile changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Jul 11, 2024
1 parent 340e987 commit 11d98b3
Show file tree
Hide file tree
Showing 18 changed files with 270 additions and 390 deletions.
9 changes: 6 additions & 3 deletions apps/console/project.inlang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@
"dashboard_labels_create_list": "Klicken Sie auf Erstellen, um zu beginnen.",
"dashboard_messages_tagline": "Präsentiert das ultimative YouTube-Erlebnis. Egal, ob Sie auf der Suche nach neuen Inhalten zum Ansehen sind oder Ihre eigene kuratierte Liste mit Freunden teilen möchten, unsere App ist genau das Richtige für Sie.",
"error_page_message": "Entschuldigung. Irgendwas ist schief gelaufen",
"profile_skey_forms_nickname_label": "Spitzname",
"profile_skey_forms_nickname_placeholder": "Spitzname für das Gerät (optional)",
"profile_skey_forms_nickname_description": "Merken Sie sich unbedingt den Namen Ihres Geräts",
"profile_forms_change_password_label": "Kennwort ändern",
"profile_forms_change_email_label": "Ändern Sie die E-Mail",
"profile_forms_create_pat_button": "Persönlichen Zugriffstoken erstellen",
"profile_forms_nickname_label": "Spitzname",
"profile_forms_nickname_placeholder": "Spitzname für das Gerät (optional)",
"profile_forms_nickname_description": "Merken Sie sich unbedingt den Namen Ihres Geräts",
"profile_hasura_jwt_claims_label": "Hasura JWT-Ansprüche",
"profile_nhost_refresh_session_label": "Aktualisierungstoken"
}
9 changes: 6 additions & 3 deletions apps/console/project.inlang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@
"dashboard_labels_create_list": "Click Create to get started.",
"dashboard_messages_tagline": "Presenting the ultimate YouTube experience. Whether you're looking for new content to watch or want to share your own curated list with friends, our app has got you covered.",
"error_page_message": "We're sorry, something went wrong",
"profile_skey_forms_nickname_label": "Nickname",
"profile_skey_forms_nickname_placeholder": "Nickname for the device (optional)",
"profile_skey_forms_nickname_description": "Be sure to to remember your device name",
"profile_forms_change_password_label": "Change Password",
"profile_forms_change_email_label": "Change Email",
"profile_forms_create_pat_button": "Create Personal Access Token",
"profile_forms_nickname_label": "Nickname",
"profile_forms_nickname_placeholder": "Nickname for the device (optional)",
"profile_forms_nickname_description": "Be sure to to remember your device name",
"profile_hasura_jwt_claims_label": "Hasura JWT Claims",
"profile_nhost_refresh_session_label": "Refresh Token"
}
10 changes: 10 additions & 0 deletions apps/console/src/lib/schema/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,13 @@ function checkConfirmPassword(ctx: z.RefinementCtx, confirmPassword: string, pas
});
}
}

// create a new PAT token
export const createPATSchema = z.object({
name: z
.string({ required_error: 'Name is required' })
.min(6, { message: 'Name must contain at least 6 character(s)' })
.max(256)
.trim(),
expiryDate: z.string().date(),
});
2 changes: 1 addition & 1 deletion apps/console/src/lib/server/hooks/guard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { building } from '$app/environment';
import { i18n } from '$lib/i18n.js';
import { i18n } from '$lib/i18n';
import { Logger, startsWith } from '@spectacular/utils';
import type { Handle } from '@sveltejs/kit';
import { redirect as redirectWithFlash } from 'sveltekit-flash-message/server';
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/routes/(app)/groups/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { dev } from '$app/environment';
import { searchGroupKeys as searchKeys } from '$lib/schema/group.js';
import { searchGroupKeys as searchKeys } from '$lib/schema/group';
import type { PopupSettings } from '@skeletonlabs/skeleton';
import { popup } from '@skeletonlabs/skeleton';
import { DebugShell } from '@spectacular/skeleton';
Expand Down
53 changes: 46 additions & 7 deletions apps/console/src/routes/(app)/organizations/create/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import { organizationsCreateSchema as schema } from '$lib/schema/organization';
import { InputChip } from '@skeletonlabs/skeleton';
import { DebugShell } from '@spectacular/skeleton/components';
import { Alerts } from '@spectacular/skeleton/components/form';
import { Control, Description, Field, FieldErrors, Fieldset, Label, Legend } from 'formsnap';
import { fade } from 'svelte/transition';
import { superForm } from 'sveltekit-superforms';
import SuperDebug from 'sveltekit-superforms';
import { zodClient } from 'sveltekit-superforms/adapters';
export let data;
const form = superForm(data.form, {
Expand All @@ -17,6 +20,7 @@ const {
message,
errors,
tainted,
reset,
isTainted,
submitting,
delayed,
Expand All @@ -41,12 +45,15 @@ function isValidEmailDomain(value: string): boolean {
<meta name="description" content="Showcase formsnap" />
</svelte:head>
<div class="page-container">
<h1 class="pb-8 text-3xl font-semibold tracking-tight">Create Stream</h1>
<form
{form}
submitButtonText="Create"
class=" variant-ghost-surface space-y-6 rounded-md p-4 shadow-md "
>
<h1 class="pb-8 text-3xl font-semibold tracking-tight">Create Organization</h1>
<form
method="POST"
class=" variant-ghost-surface space-y-6 rounded-md p-4 shadow-md"
use:enhance
>

<!-- Form Level Errors / Messages -->
<Alerts errors={$errors._errors} message={$message} />
<div class="md:grid-cols-col-span-3 mb-6 grid gap-6 lg:grid-cols-6">
<div class="col-span-3">
<Field {form} name="organization">
Expand Down Expand Up @@ -93,7 +100,39 @@ function isValidEmailDomain(value: string): boolean {
</Field>
</div>
</div>
</form>
<!-- Form Action Buttons -->
<button
type="button"
class="variant-ghost-secondary btn"
on:click={() => history.back()}>Back</button
>
<button
type="button"
class="variant-ghost-warning btn"
disabled={!$tainted}
on:click={() => reset()}
>
Reset
</button>

<button
class="variant-ghost-success btn"
type="submit"
disabled={!$tainted || $submitting}
>
{#if $submitting}
<aside
class="alert rounded-sm"
transition:fade|local={{ duration: 400 }}
>
Saving..
</aside>
{:else}
Create
{/if}
</button>
</form>

<DebugShell>
<SuperDebug
label="Miscellaneous"
Expand Down
51 changes: 45 additions & 6 deletions apps/console/src/routes/(app)/organizations/update/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import { updateOrganizationsSchema as schema } from '$lib/schema/organization';
import { InputChip } from '@skeletonlabs/skeleton';
import { DebugShell } from '@spectacular/skeleton/components';
import { Alerts } from '@spectacular/skeleton/components/form';
import { Control, Field, FieldErrors, Label } from 'formsnap';
import { fade } from 'svelte/transition';
import { superForm } from 'sveltekit-superforms';
import SuperDebug from 'sveltekit-superforms';
import { zodClient } from 'sveltekit-superforms/adapters';
Expand All @@ -19,6 +21,7 @@ const {
message,
errors,
tainted,
reset,
isTainted,
submitting,
delayed,
Expand All @@ -41,12 +44,16 @@ function isValidEmailDomain(value: string): boolean {
<title>Organizations</title>
<meta name="description" content=" Update Organization" />
</svelte:head>

<div class="page-container">
<form
{form}
submitButtonText="Update"
class=" variant-ghost-surface space-y-6 rounded-md p-4 shadow-md "
>
<form
method="POST"
class=" variant-ghost-surface space-y-6 rounded-md p-4 shadow-md"
use:enhance
>

<!-- Form Level Errors / Messages -->
<Alerts errors={$errors._errors} message={$message} />

<div class="md:grid-cols-col-span-3 mb-6 grid gap-6 lg:grid-cols-6">
<div class="col-span-3">
Expand Down Expand Up @@ -109,7 +116,39 @@ function isValidEmailDomain(value: string): boolean {
</Field>
</div>
</div>
</form>
<!-- Form Action Buttons -->
<button
type="button"
class="variant-ghost-secondary btn"
on:click={() => history.back()}>Back</button
>
<button
type="button"
class="variant-ghost-warning btn"
disabled={!$tainted}
on:click={() => reset()}
>
Reset
</button>

<button
class="variant-ghost-success btn"
type="submit"
disabled={!$tainted || $submitting}
>
{#if $submitting}
<aside
class="alert rounded-sm"
transition:fade|local={{ duration: 400 }}
>
Saving..
</aside>
{:else}
Update
{/if}
</button>
</form>

<DebugShell>
<SuperDebug
label="Miscellaneous"
Expand Down
98 changes: 0 additions & 98 deletions apps/console/src/routes/(app)/policies/[id=uuid]/+page.server.ts

This file was deleted.

Loading

0 comments on commit 11d98b3

Please sign in to comment.