Skip to content

Commit

Permalink
Few updates and fixes (#65)
Browse files Browse the repository at this point in the history
* update dependencies

* proposal route rules

* nuxt og image update

* route rules

* add latest directus version

* explain pagefilter

* fix access token for portal search

* add password to login form

* fix dynamic user name

* portal user avatar fix

* remove base render route

* fix lockfile

* svg cleanup

* lint fixes

* type fixes

* form type

* form cleanup

* lint fixes

* typescript fixes
  • Loading branch information
bryantgillespie committed Jan 7, 2024
1 parent ac21604 commit 38a319c
Show file tree
Hide file tree
Showing 69 changed files with 2,976 additions and 3,664 deletions.
2 changes: 1 addition & 1 deletion .directus/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
image: redis:6

directus:
image: directus/directus:10.6.3
image: directus/directus:10.8.3
ports:
- 8055:8055
volumes:
Expand Down
9 changes: 9 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ export default defineAppConfig({
},
},
},
avatar: {
default: {},
rounded: 'rounded-button',
},
breadcrumb: {
default: {
divider: 'material-symbols:chevron-right',
},
},
pagination: {
rounded: 'first:rounded-l-button last:rounded-r-button',
default: {
Expand Down
4 changes: 2 additions & 2 deletions components/PageBuilder.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { Page, PageBlock, BlockType } from '~/types';
import type { Page, OsProposal, PageBlock, BlockType } from '~/types';
const componentMap: Record<BlockType, any> = {
block_hero: resolveComponent('BlocksHero'),
Expand All @@ -20,7 +20,7 @@ const componentMap: Record<BlockType, any> = {
};
const props = defineProps<{
page: Page;
page: Page | OsProposal;
}>();
const blocks = computed(() => {
Expand Down
5 changes: 3 additions & 2 deletions components/TeamCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ const flipped = ref(false);
<div class="relative w-full h-full overflow-hidden group rounded-card">
<!-- Front of Team Card -->
<NuxtImg
v-if="person.image"
class="object-cover w-full h-full transition duration-300 grayscale group-hover:grayscale-0"
:src="person.image"
:alt="person.name"
:src="person.image as string"
:alt="person.name ?? ''"
/>
<!-- Back of Team Card -->
<Motionable
Expand Down
17 changes: 8 additions & 9 deletions components/base/Author.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script setup lang="ts">
import type { Team } from '~/types';
export interface AuthorProps {
image?: string;
name?: string;
job_title?: string;
author?: Team;
size?: 'sm' | 'md' | 'lg';
}
Expand All @@ -15,8 +14,8 @@ const { fileUrl } = useFiles();
<template>
<div class="flex items-center flex-none group dark:text-gray-100">
<div class="mr-3">
<img
v-if="image"
<NuxtImg
v-if="author?.image"
:class="[
{
'w-8 h-8 sm:h-10 sm:w-10': size === 'sm',
Expand All @@ -25,7 +24,7 @@ const { fileUrl } = useFiles();
},
'object-cover rounded-full dark:brightness-90',
]"
:src="fileUrl(image)"
:src="fileUrl(author.image as string)"
/>
</div>
Expand All @@ -39,10 +38,10 @@ const { fileUrl } = useFiles();
' ',
]"
>
<span class="font-semibold font-display">{{ name }}</span>
<span class="font-semibold font-display">{{ author?.name }}</span>
<span
v-if="job_title"
v-if="author?.job_title"
:class="[
{
'text-xs': size === 'sm',
Expand All @@ -52,7 +51,7 @@ const { fileUrl } = useFiles();
'block pt-0.5',
]"
>
{{ job_title }}
{{ author.job_title }}
</span>
</div>
</div>
Expand Down
15 changes: 10 additions & 5 deletions components/base/FormCustom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Form from '#ui/components/forms/Form.vue';
import type { Form } from '~/types';
import * as UForm from '#ui/components/forms/Form.vue';
import FormGroup from '#ui/components/forms/FormGroup.vue';
import Input from '#ui/components/forms/Input.vue';
import Textarea from '#ui/components/forms/Textarea.vue';
Expand Down Expand Up @@ -37,8 +38,8 @@ function renderInput(item: { [key: string]: any }, name: string, state: any) {
export default defineComponent({
props: {
schema: {
type: Array,
default: () => [],
type: Array as PropType<Form['schema']>,
required: true,
},
state: {
type: Object,
Expand All @@ -52,7 +53,7 @@ export default defineComponent({
},
},
setup(props) {
const groups = props.schema.map((item) => {
const groups = props.schema?.map((item) => {
const { name, label, placeholder, width, description } = item as { [key: string]: any };

Check warning on line 57 in components/base/FormCustom.ts

View workflow job for this annotation

GitHub Actions / Lint

'placeholder' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 57 in components/base/FormCustom.ts

View workflow job for this annotation

GitHub Actions / Lint

'width' is assigned a value but never used. Allowed unused vars must match /^_/u

// @ts-ignore
Expand All @@ -64,6 +65,10 @@ export default defineComponent({
]);
});

if (!groups) {
return () => null;
}

// Add the submit button to the groups array
groups.push(
h(
Expand All @@ -83,6 +88,6 @@ export default defineComponent({
);

// @ts-ignore
return () => h(Form, { state: props.state, validate: props.validate }, () => groups);
return () => h(UForm, { state: props.state, validate: props.validate }, () => groups);
},
});
23 changes: 17 additions & 6 deletions components/base/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
color="rose"
variant="outline"
icon="material-symbols:warning-rounded"
>
Error: {{ error }}
</UAlert>
/>

<form class="grid gap-4" @submit.prevent="attemptLogin">
<UFormGroup label="Email" required>
Expand All @@ -25,6 +23,17 @@
placeholder="john@example.com"
/>
</UFormGroup>
<UFormGroup label="Password" required>
<UInput
v-model="credentials.password"
type="password"
:disabled="loading"
size="lg"
name="email"
label="Password"
placeholder="Your Password"
/>
</UFormGroup>
<UButton
type="submit"
:loading="loading"
Expand All @@ -36,15 +45,16 @@
/>
</form>

<div class="mt-6">
<!-- @TODO Remove password once magic link authentication is added -->
<!-- <div class="mt-6">
<VText>
<UIcon name="material-symbols:info-rounded" class="mr-2" />
<span>What about a password?</span>
</VText>
<VText text-color="light" size="xs" class="mt-2">
Not needed 😃. Just enter your email above and we'll send you a magic link to login to your dashboard.
</VText>
</div>
</div> -->
</div>
</template>

Expand All @@ -53,6 +63,7 @@ const { login } = useDirectusAuth();
const loading = ref(false);
const error = ref(null);
// You'll want to remove these preset credentials before you deploy your site
const credentials = reactive({
email: 'ashley@example.com',
password: 'password',
Expand All @@ -64,7 +75,7 @@ async function attemptLogin() {
error.value = null;
try {
// Be careful when using the login function because you have to pass the email and password as arguments.
// Be careful when using the login function because you have to pass the email and password as separate arguments instead of an object.
await login(email, password);
} catch (err) {
error.value = err.message;
Expand Down
6 changes: 0 additions & 6 deletions components/base/UForm.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { Form } from '~/types';
import type { FormError } from '@nuxt/ui/dist/runtime/types';
import { transformSchema } from '~/utils/formkit';
const props = defineProps<{
form: Form;
Expand All @@ -16,8 +15,6 @@ const loading = ref(false);
const error: any = ref(null);
const success = ref(false);
// const schema = transformSchema(props.form.schema);
const validate = (state: any): FormError[] => {
const errors = [];
if (!state.email) errors.push({ path: 'email', message: 'Required' });
Expand Down Expand Up @@ -64,7 +61,6 @@ watch(
{{ form.success_message ?? 'Success! Your form has been submitted.' }}
</VAlert>
</div>
<!-- <FormKit v-if="!success" type="form" v-model="formData" @submit="submitForm" :submit-label="form.submit_label"> -->
<div>
<FormCustom
v-if="!success"
Expand All @@ -74,8 +70,6 @@ watch(
class="grid gap-6 md:grid-cols-6"
:on-submit="submitForm"
/>
<!-- <FormKitSchema :schema="schema" /> -->
</div>
<!-- </FormKit> -->
</div>
</template>
6 changes: 3 additions & 3 deletions components/base/VBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
export interface BreadcrumbsProps {
items: Array<{
title: string;
href: string;
href?: string | null | undefined;
}>;
}
defineProps<BreadcrumbsProps>();
</script>
<template>
<div class="flex flex-wrap items-center space-x-2 text -sm dark:text-gray-200">
<div class="flex flex-wrap items-center space-x-1 text -sm dark:text-gray-200">
<template v-for="(item, itemIdx) in items" :key="itemIdx">
<template v-if="item.href">
<NuxtLink :href="item.href" class="hover:text-primary">
{{ item.title }}
</NuxtLink>
<div v-if="itemIdx !== items.length - 1">
<Icon name="heroicons:chevron-right" class="h-5" />
<Icon name="material-symbols:chevron-right-rounded" class="h-6 w-6 text-gray-500" />
</div>
</template>
<span v-else class="font-bold">
Expand Down
9 changes: 2 additions & 7 deletions components/base/VGallery.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<script setup lang="ts">
import type { File } from '~/types';
import { TransitionRoot } from '@headlessui/vue';
export interface GalleryProps {
items: [
{
id?: string;
title?: string;
description?: string;
},
];
items: File[];
}
const props = defineProps<GalleryProps>();
Expand Down
10 changes: 4 additions & 6 deletions components/base/VHorizontalNavigation.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<script setup lang="ts">
export interface HorizontalNavigationProps {
items: [
{
name: string;
href: string;
},
];
items: Array<{
name: string;
href: string;
}>;
}
const props = defineProps<HorizontalNavigationProps>();

Check warning on line 9 in components/base/VHorizontalNavigation.vue

View workflow job for this annotation

GitHub Actions / Lint

'props' is assigned a value but never used. Allowed unused vars must match /^_/u
Expand Down
1 change: 1 addition & 0 deletions components/base/VSignature.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
// @ts-expect-error - VPerfectSignature is not typed
import { VPerfectSignature } from 'v-perfect-signature';
const colorMode = useColorMode();
Expand Down
4 changes: 2 additions & 2 deletions components/base/VVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { generateVideoEmbed } from '~~/utils/embed';
interface VideoProps {
url: string;
title?: string;
title?: string | null | undefined;
name?: string;
}
Expand All @@ -19,7 +19,7 @@ defineProps<VideoProps>();
frameborder="0"
allow="autoplay; fullscreen; picture-in-picture"
allowfullscreen
:title="title"
:title="title as string"
></iframe>
</template>

Expand Down
2 changes: 1 addition & 1 deletion components/blocks/ButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getUrl(button: BlockButton): string | undefined {
:color="button?.color"
:variant="button?.variant"
:target="button?.external_url ? '_blank' : '_self'"
:label="button?.label"
:label="button?.label ?? undefined"
size="xl"
trailing-icon="material-symbols:arrow-forward-rounded"
/>
Expand Down
7 changes: 4 additions & 3 deletions components/blocks/Columns.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { BlockColumn, BlockColumnRow, File } from '~/types';
import type { BlockButtonGroup, BlockColumn, BlockColumnRow } from '~/types';
defineProps<{
data: BlockColumn;
Expand All @@ -20,7 +20,7 @@ defineProps<{
<TypographyTitle v-if="row?.title">{{ row?.title }}</TypographyTitle>
<TypographyHeadline v-if="row?.headline" :content="row?.headline" />
<TypographyProse v-if="row?.content" :content="row?.content" class="mt-4" />
<BlocksButtonGroup v-if="row?.button_group" :data="row?.button_group" class="mt-4" />
<BlocksButtonGroup v-if="row?.button_group" :data="row?.button_group as BlockButtonGroup" class="mt-4" />
</div>
<div
class="order-first block w-full overflow-hidden border aspect-square dark:border-gray-700 rounded-card"
Expand All @@ -39,8 +39,9 @@ defineProps<{
:delay="250"
>
<NuxtImg
v-if="row.image"
:alt="safeRelation(row.image)?.description ?? ''"
:src="safeRelationId(row.image)"
:src="safeRelationId(row.image) ?? ''"
class="object-cover object-center w-full h-full bg-gray-100 rounded-card dark:brightness-90"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/blocks/Cta.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { BlockCta } from '~/types';
import type { BlockButtonGroup, BlockCta } from '~/types';
defineProps<{
data: BlockCta;
Expand All @@ -19,7 +19,7 @@ defineProps<{
<TypographyProse v-if="data.content" :content="data.content" class="mt-2" />
</div>
<div class="flex-shrink-0 mt-4 md:mt-0">
<BlocksButtonGroup v-if="data.button_group" :data="data.button_group" />
<BlocksButtonGroup v-if="data.button_group" :data="data.button_group as BlockButtonGroup" />
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 38a319c

Please sign in to comment.