refactor: ♻️ Disable Nuxt component auto-importing (obscures code flow)

This commit is contained in:
Jesse Wierzbinski 2024-06-20 16:09:09 -10:00
parent 32d1acb4c1
commit e309c56a86
No known key found for this signature in database
58 changed files with 440 additions and 292 deletions

View file

@ -13,25 +13,25 @@
</div>
<VeeField name="identifier" as="div" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="identifier">Username or Email</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsText id="identifier" placeholder="joemama" autocomplete="email username" required
<Field>
<LabelAndError>
<Label for="identifier">Username or Email</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<TextInput id="identifier" placeholder="joemama" autocomplete="email username" required
v-bind="field" :is-invalid="!!errorMessage" />
</InputsField>
</Field>
</VeeField>
<VeeField name="password" as="div" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="password">Password</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsPassword id="password" placeholder="hunter2" autocomplete="current-password" required
<Field>
<LabelAndError>
<Label for="password">Password</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<PasswordInput id="password" placeholder="hunter2" autocomplete="current-password" required
v-bind="field" :is-invalid="!!errorMessage" />
</InputsField>
</Field>
</VeeField>
<div v-if="ssoConfig && ssoConfig.providers.length > 0" class="w-full space-y-3">
@ -42,13 +42,13 @@
<div class="grid md:grid-cols-2 md:[&:has(>:last-child:nth-child(1))]:grid-cols-1 gap-4 w-full">
<a v-for="provider of ssoConfig.providers" :key="provider.id"
:href="`/oauth/sso?issuer=${provider.id}&redirect_uri=${params.redirect_uri}&response_type=${params.response_type}&client_id=${params.client_id}&scope=${params.scope}`">
<ButtonsSecondary class="flex flex-row w-full items-center justify-center gap-3">
<ButtonSecondary class="flex flex-row w-full items-center justify-center gap-3">
<img crossorigin="anonymous" :src="provider.icon" :alt="`${provider.name}'s logo'`"
class="w-6 h-6" />
<div class="flex flex-col gap-0 justify-center">
<h3 class="font-bold">{{ provider.name }}</h3>
</div>
</ButtonsSecondary>
</ButtonSecondary>
</a>
</div>
</div>
@ -58,7 +58,7 @@
here, please close this page.
</p>
<ButtonsPrimary type="submit" class="w-full">Sign in</ButtonsPrimary>
<ButtonPrimary type="submit" class="w-full">Sign in</ButtonPrimary>
</VeeForm>
</div>
<div v-else class="mx-auto max-w-md">
@ -100,6 +100,14 @@
import { LysandClient } from "@lysand-org/client";
import { toTypedSchema } from "@vee-validate/zod";
import { z } from "zod";
import ButtonPrimary from "~/components/buttons/button-primary.vue";
import ButtonSecondary from "~/components/buttons/button-secondary.vue";
import FieldError from "~/components/inputs/field-error.vue";
import Field from "~/components/inputs/field.vue";
import LabelAndError from "~/components/inputs/label-and-error.vue";
import Label from "~/components/inputs/label.vue";
import PasswordInput from "~/components/inputs/password-input.vue";
import TextInput from "~/components/inputs/text-input.vue";
const schema = toTypedSchema(
z.object({

View file

@ -40,9 +40,9 @@
</div>
<div class="flex flex-col gap-3">
<ButtonsPrimary type="submit">Authorize</ButtonsPrimary>
<ButtonPrimary type="submit">Authorize</ButtonPrimary>
<NuxtLink href="/" class="w-full">
<ButtonsSecondary class="w-full">Cancel</ButtonsSecondary>
<ButtonSecondary class="w-full">Cancel</ButtonSecondary>
</NuxtLink>
</div>
</form>
@ -83,6 +83,9 @@
</template>
<script setup lang="ts">
import ButtonPrimary from "~/components/buttons/button-primary.vue";
import ButtonSecondary from "~/components/buttons/button-secondary.vue";
const url = useRequestURL();
const params = useUrlSearchParams();

View file

@ -14,32 +14,32 @@
</div>
<VeeField name="password" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="password">New password</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsPassword id="password" placeholder="hunter2" autocomplete="new-password" required
<Field>
<LabelAndError>
<Label for="password">New password</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<PasswordInput id="password" placeholder="hunter2" autocomplete="new-password" required
v-bind="field" :is-invalid="!!errorMessage" :show-strength="true" />
</InputsField>
</Field>
</VeeField>
<VeeField name="password-confirm" as="div" v-slot="{ errors, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="password-confirm">Confirm password</InputsLabel>
<InputsError v-if="errors.length > 0">{{ errors[0] }}</InputsError>
</InputsLabelAndError>
<InputsPassword id="password-confirm" placeholder="hunter2" autocomplete="new-password" required
<Field>
<LabelAndError>
<Label for="password-confirm">Confirm password</Label>
<FieldError v-if="errors.length > 0">{{ errors[0] }}</FieldError>
</LabelAndError>
<PasswordInput id="password-confirm" placeholder="hunter2" autocomplete="new-password" required
v-bind="field" :is-invalid="errors.length > 0" />
</InputsField>
</Field>
</VeeField>
<p class="text-xs font-semibold text-red-300">This will reset your
password. Make sure to put it in a password manager.
</p>
<ButtonsPrimary type="submit" class="w-full">Reset</ButtonsPrimary>
<ButtonPrimary type="submit" class="w-full">Reset</ButtonPrimary>
</VeeForm>
</div>
<div v-else-if="params.success">
@ -69,6 +69,12 @@
<script setup lang="ts">
import { toTypedSchema } from "@vee-validate/zod";
import { z } from "zod";
import ButtonPrimary from "~/components/buttons/button-primary.vue";
import FieldError from "~/components/inputs/field-error.vue";
import Field from "~/components/inputs/field.vue";
import LabelAndError from "~/components/inputs/label-and-error.vue";
import Label from "~/components/inputs/label.vue";
import PasswordInput from "~/components/inputs/password-input.vue";
const identity = useCurrentIdentity();
identity.value = null;