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

@ -1,17 +1,19 @@
<template>
<div v-if="loaded" :defer="true" class="mx-auto max-w-2xl w-full pb-72">
<LazySocialElementsNotesNote v-for="note of context?.ancestors" :note="note" />
<Note v-for="note of context?.ancestors" :note="note" />
<div ref="element" class="first:rounded-t last:rounded-b overflow-hidden">
<LazySocialElementsNotesNote class="!rounded-none border-2 border-primary-500" v-if="note" :note="note" />
<Note class="!rounded-none border-2 border-primary-500" v-if="note" :note="note" />
</div>
<LazySocialElementsNotesNote v-for="note of context?.descendants" :note="note" />
<Note v-for="note of context?.descendants" :note="note" />
</div>
<div v-else class="mx-auto max-w-2xl w-full overflow-y-auto">
<LazySocialElementsNotesNote v-for="_ of 5" :skeleton="true" />
<Note v-for="_ of 5" :skeleton="true" />
</div>
</template>
<script setup lang="ts">
import Note from "~/components/social-elements/notes/note.vue";
definePageMeta({
layout: "app",
});

View file

@ -1,16 +1,20 @@
<template>
<ErrorsErrorBoundary>
<ErrorBoundary>
<div class="mx-auto max-w-2xl w-full">
<LazyTimelinesTimelineScroller>
<LazySocialElementsUsersAccount :account="account ?? undefined" />
<LazyTimelinesAccount :id="accountId" :key="accountId" />
</LazyTimelinesTimelineScroller>
<TimelineScroller>
<AccountProfile :account="account ?? undefined" />
<AccountTimeline :id="accountId" :key="accountId" />
</TimelineScroller>
</div>
</ErrorsErrorBoundary>
</ErrorBoundary>
</template>
<script setup lang="ts">
import type { Account } from "@lysand-org/client/types";
import ErrorBoundary from "~/components/errors/ErrorBoundary.vue";
import AccountProfile from "~/components/timelines/account.vue";
import AccountTimeline from "~/components/timelines/account.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",

View file

@ -1,13 +1,17 @@
<template>
<div class="mx-auto max-w-2xl w-full">
<LazyTimelinesTimelineScroller>
<LazyHeadersGreeting />
<LazyTimelinesHome />
</LazyTimelinesTimelineScroller>
<TimelineScroller>
<Greeting />
<Home />
</TimelineScroller>
</div>
</template>
<script setup lang="ts">
import Greeting from "~/components/headers/greeting.vue";
import Home from "~/components/timelines/home.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",
});

View file

@ -1,14 +1,18 @@
<template>
<div class="mx-auto max-w-2xl w-full">
<LazyTimelinesTimelineScroller>
<LazyHeadersGreeting />
<LazyTimelinesPublic />
</LazyTimelinesTimelineScroller>
<TimelineScroller>
<Greeting />
<Public />
</TimelineScroller>
</div>
</template>
<script setup lang="ts">
import Greeting from "~/components/headers/greeting.vue";
import Public from "~/components/timelines/public.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",
});

View file

@ -1,14 +1,18 @@
<template>
<div class="mx-auto max-w-2xl w-full">
<LazyTimelinesTimelineScroller>
<LazyHeadersGreeting />
<LazyTimelinesLocal />
</LazyTimelinesTimelineScroller>
<TimelineScroller>
<Greeting />
<Local />
</TimelineScroller>
</div>
</template>
<script lang="ts" setup>
import Greeting from "~/components/headers/greeting.vue";
import Local from "~/components/timelines/local.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",
});

View file

@ -11,16 +11,20 @@
sign in</span>
</button>
</div>
<LazyTimelinesTimelineScroller v-else>
<LazyHeadersGreeting />
<TimelineScroller v-else>
<Greeting />
<div class="rounded overflow-hidden ring-1 ring-white/10">
<LazyTimelinesNotifications />
<Notifications />
</div>
</LazyTimelinesTimelineScroller>
</TimelineScroller>
</div>
</template>
<script lang="ts" setup>
import Greeting from "~/components/headers/greeting.vue";
import Notifications from "~/components/timelines/notifications.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",
});

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;

View file

@ -1,13 +1,17 @@
<template>
<div class="mx-auto max-w-2xl w-full">
<LazyTimelinesTimelineScroller>
<LazyHeadersGreeting />
<TimelinesPublic />
</LazyTimelinesTimelineScroller>
<TimelineScroller>
<Greeting />
<Public />
</TimelineScroller>
</div>
</template>
<script setup lang="ts">
import Greeting from "~/components/headers/greeting.vue";
import Public from "~/components/timelines/public.vue";
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
definePageMeta({
layout: "app",
});

View file

@ -12,66 +12,65 @@
<h1 class="font-bold text-2xl text-gray-50 text-center tracking-tight">Account details</h1>
<VeeField name="username" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="username">Username</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsText id="username" type="text" placeholder="thespeedy" required v-bind="field"
<Field>
<LabelAndError>
<Label for="username">Username</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<TextInput id="username" type="text" placeholder="thespeedy" required v-bind="field"
:disabled="isLoading" :is-invalid="!!errorMessage" autocomplete="username"
:spellcheck="false" />
</InputsField>
</Field>
</VeeField>
<VeeField name="email" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="email">Email address</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsText id="email" type="email" placeholder="joseph.jones@gmail.com" required v-bind="field"
<Field>
<LabelAndError>
<Label for="email">Email address</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<TextInput id="email" type="email" placeholder="joseph.jones@gmail.com" required v-bind="field"
:disabled="isLoading" :is-invalid="!!errorMessage" autocomplete="email" />
</InputsField>
</Field>
</VeeField>
<VeeField name="password" 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" required v-bind="field"
:disabled="isLoading" :is-invalid="!!errorMessage" :show-strength="true"
autocomplete="new-password" />
</InputsField>
<Field>
<LabelAndError>
<Label for="password">Password</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<PasswordInput id="password" placeholder="hunter2" required v-bind="field" :disabled="isLoading"
:is-invalid="!!errorMessage" :show-strength="true" autocomplete="new-password" />
</Field>
</VeeField>
<VeeField name="password-confirm" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<InputsLabelAndError>
<InputsLabel for="password-confirm">Confirm password</InputsLabel>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsLabelAndError>
<InputsPassword id="password-confirm" placeholder="hunter2" required v-bind="field"
<Field>
<LabelAndError>
<Label for="password-confirm">Confirm password</Label>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</LabelAndError>
<PasswordInput id="password-confirm" placeholder="hunter2" required v-bind="field"
:disabled="isLoading" :is-invalid="!!errorMessage" autocomplete="new-password" />
</InputsField>
</Field>
</VeeField>
<VeeField name="tos" v-slot="{ errorMessage, field }" validate-on-change>
<InputsField>
<Field>
<div class="flex flex-row gap-x-2 items-center">
<InputsCheckbox :checked="true" id="tos" required :disabled="true" v-bind="field" />
<InputsLabel for="tos" class="!text-gray-200">
<CheckboxInput :checked="true" id="tos" required :disabled="true" v-bind="field" />
<Label for="tos" class="!text-gray-200">
I agree to the Terms of Service
</InputsLabel>
</Label>
</div>
<InputsError v-if="errorMessage">{{ errorMessage }}</InputsError>
</InputsField>
<FieldError v-if="errorMessage">{{ errorMessage }}</FieldError>
</Field>
</VeeField>
<Collapsible.Root>
<Collapsible.Trigger class="w-full">
<ButtonsSecondary type="button" class="w-full">View Terms of Service</ButtonsSecondary>
<ButtonSecondary type="button" class="w-full">View Terms of Service</ButtonSecondary>
</Collapsible.Trigger>
<Collapsible.Content
class="prose prose-invert prose-sm p-4 ring-1 ring-white/10 bg-dark-700 rounded mt-3">
@ -85,8 +84,8 @@
cannot see your password.
</p>
<ButtonsPrimary type="submit" class="w-full" :disabled="isLoading">{{ isLoading ? "Registering..." :
"Register" }}</ButtonsPrimary>
<ButtonPrimary type="submit" class="w-full" :disabled="isLoading">{{ isLoading ? "Registering..." :
"Register" }}</ButtonPrimary>
</VeeForm>
</div>
<div v-else>
@ -105,6 +104,15 @@ import { Collapsible } from "@ark-ui/vue";
import type { ResponseError } 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 CheckboxInput from "~/components/inputs/checkbox-input.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

View file

@ -1,30 +1,33 @@
<template>
<SidebarsSettings>
<SettingsSidebar>
<template #behaviour>
<SettingsRenderer :setting="setting" v-for="setting of getSettingsForPath(
<Renderer :setting="setting" v-for="setting of getSettingsForPath(
settings,
SettingPages.Behaviour,
)" :key="setting.id" />
</template>
<template #appearance>
<SettingsRenderer :setting="setting" v-for="setting of getSettingsForPath(
<Renderer :setting="setting" v-for="setting of getSettingsForPath(
settings,
SettingPages.Appearance,
)" :key="setting.id" />
</template>
<template #advanced>
<SettingsRenderer :setting="setting" v-for="setting of getSettingsForPath(
<Renderer :setting="setting" v-for="setting of getSettingsForPath(
settings,
SettingPages.Advanced,
)" :key="setting.id" />
</template>
<template #account>
<SettingsProfileEditor />
<ProfileEditor />
</template>
</SidebarsSettings>
</SettingsSidebar>
</template>
<script setup lang="ts">
import ProfileEditor from "~/components/settings/profile-editor.vue";
import Renderer from "~/components/settings/renderer.vue";
import SettingsSidebar from "~/components/sidebars/settings-sidebar.vue";
import { SettingPages, getSettingsForPath } from "~/settings";
definePageMeta({