diff --git a/import-meta.d.ts b/import-meta.ts similarity index 58% rename from import-meta.d.ts rename to import-meta.ts index 3a28cb1..e7708dd 100644 --- a/import-meta.d.ts +++ b/import-meta.ts @@ -1,4 +1,4 @@ -interface ImportMeta { +export interface ImportMetaExtras extends ImportMeta { env: { APP_URL: string; [key: string]: string; diff --git a/resources/js/components/SMButton.vue b/resources/js/components/SMButton.vue index fa89825..f59fe9d 100644 --- a/resources/js/components/SMButton.vue +++ b/resources/js/components/SMButton.vue @@ -5,6 +5,7 @@ :class="[ 'sm-button', classType, + { 'sm-button-small': small }, { 'sm-button-block': block }, { 'sm-dropdown-button': dropdown }, ]" @@ -37,7 +38,12 @@ v-else-if="!isEmpty(to) && typeof to == 'string'" :href="to" :disabled="disabled" - :class="['sm-button', classType, { 'sm-button-block': block }]" + :class="[ + 'sm-button', + classType, + { 'sm-button-small': small }, + { 'sm-button-block': block }, + ]" :type="buttonType"> {{ label }} @@ -46,7 +52,12 @@ v-else-if="!isEmpty(to) && typeof to == 'object'" :to="to" :disabled="disabled" - :class="['sm-button', classType, { 'sm-button-block': block }]"> + :class="[ + 'sm-button', + classType, + { 'sm-button-small': small }, + { 'sm-button-block': block }, + ]"> {{ label }} @@ -67,7 +78,7 @@ const props = defineProps({ }, iconLocation: { type: String, - default: "before", + default: "after", required: false, validator: (value: string) => { return ["before", "after"].includes(value); @@ -89,6 +100,11 @@ const props = defineProps({ default: false, required: false, }, + small: { + type: Boolean, + default: false, + required: false, + }, dropdown: { type: Object, default: null, diff --git a/resources/js/components/SMForm.vue b/resources/js/components/SMForm.vue index 6ba071b..88c9bbc 100644 --- a/resources/js/components/SMForm.vue +++ b/resources/js/components/SMForm.vue @@ -27,8 +27,8 @@ const emits = defineEmits(["submit"]); /** * Handle the user submitting the form. */ -const handleSubmit = function () { - if (props.modelValue.validate()) { +const handleSubmit = async function () { + if (await props.modelValue.validate()) { emits("submit"); } }; diff --git a/resources/js/components/SMHTML.vue b/resources/js/components/SMHTML.vue index 601b3b2..001b94c 100644 --- a/resources/js/components/SMHTML.vue +++ b/resources/js/components/SMHTML.vue @@ -5,7 +5,7 @@ + + diff --git a/resources/js/components/SMPanel.vue b/resources/js/components/SMPanel.vue index 86e25fd..faaafe0 100644 --- a/resources/js/components/SMPanel.vue +++ b/resources/js/components/SMPanel.vue @@ -31,7 +31,11 @@ {{ computedContent }}
- +
@@ -288,5 +292,9 @@ watch( line-height: 130%; flex: 1; } + + .sm-panel-button { + margin-top: map-get($spacer, 4); + } } diff --git a/resources/js/components/SMToolbar.vue b/resources/js/components/SMToolbar.vue index ed6b93d..1171288 100644 --- a/resources/js/components/SMToolbar.vue +++ b/resources/js/components/SMToolbar.vue @@ -1,14 +1,25 @@ + + diff --git a/resources/js/helpers/api.ts b/resources/js/helpers/api.ts index 3ac6223..cb8db07 100644 --- a/resources/js/helpers/api.ts +++ b/resources/js/helpers/api.ts @@ -20,7 +20,7 @@ interface ApiOptions { export interface ApiResponse { status: number; message: string; - data: Record; + data: unknown; json?: Record; } @@ -84,10 +84,13 @@ export const api = { const fetchOptions: RequestInit = { method: options.method || "GET", headers: options.headers, - body: options.body, signal: options.signal || null, }; + if (typeof options.body == "string" && options.body.length > 0) { + fetchOptions.body = options.body; + } + const progressStore = useProgressStore(); progressStore.start(); diff --git a/resources/js/helpers/api.types.ts b/resources/js/helpers/api.types.ts index 143d7af..6de0bf0 100644 --- a/resources/js/helpers/api.types.ts +++ b/resources/js/helpers/api.types.ts @@ -1,6 +1,15 @@ export interface Event { + id: string; + title: string; + hero: string; + content: string; start_at: string; end_at: string; + location: string; + address: string; + status: string; + registration_type: string; + registration_data: string; } export interface EventResponse { @@ -8,7 +17,7 @@ export interface EventResponse { } export interface EventCollection { - events: Event; + events: Event[]; } export interface Media { @@ -50,6 +59,7 @@ export interface PostResponse { export interface PostCollection { posts: Array; + total: number; } export interface User { diff --git a/resources/js/helpers/form.ts b/resources/js/helpers/form.ts index 75e5119..1c00964 100644 --- a/resources/js/helpers/form.ts +++ b/resources/js/helpers/form.ts @@ -6,7 +6,7 @@ import { ValidationResult, } from "./validate"; -type FormObjectValidateFunction = (item: string | null) => boolean; +type FormObjectValidateFunction = (item: string | null) => Promise; type FormObjectLoadingFunction = (state: boolean) => void; type FormObjectMessageFunction = ( message?: string, @@ -30,26 +30,27 @@ export interface FormObject { } const defaultFormObject: FormObject = { - validate: function (item = null) { + validate: async function (item = null) { const keys = item ? [item] : Object.keys(this.controls); let valid = true; - keys.every(async (key) => { - if ( - typeof this[key] == "object" && - Object.keys(this[key]).includes("validation") - ) { - this[key].validation.result = await this[ - key - ].validation.validator.validate(this[key].value); + await Promise.all( + keys.map(async (key) => { + if ( + typeof this.controls[key] == "object" && + Object.keys(this.controls[key]).includes("validation") + ) { + const validationResult = await this.controls[ + key + ].validation.validator.validate(this.controls[key].value); + this.controls[key].validation.result = validationResult; - if (!this[key].validation.result.valid) { - valid = false; + if (!validationResult.valid) { + valid = false; + } } - } - - return true; - }); + }) + ); return valid; }, diff --git a/resources/js/router/index.js b/resources/js/router/index.js index 5aa868e..8ce11fe 100644 --- a/resources/js/router/index.js +++ b/resources/js/router/index.js @@ -37,14 +37,6 @@ export const routes = [ }, component: () => import("@/views/ResetPassword.vue"), }, - { - path: "/about", - name: "about", - meta: { - title: "About", - }, - component: () => import("@/views/About.vue"), - }, { path: "/privacy", name: "privacy", @@ -90,16 +82,16 @@ export const routes = [ children: [ { path: "", - name: "workshop-list", + name: "event-list", meta: { title: "Workshops", }, - component: () => import("@/views/WorkshopList.vue"), + component: () => import("@/views/EventList.vue"), }, { path: ":id", - name: "workshop-view", - component: () => import("@/views/WorkshopView.vue"), + name: "event-view", + component: () => import("@/views/EventView.vue"), }, ], }, @@ -141,16 +133,16 @@ export const routes = [ children: [ { path: "", - name: "news", + name: "post-list", meta: { title: "News", }, - component: () => import("@/views/NewsList.vue"), + component: () => import("@/views/PostList.vue"), }, { path: ":slug", name: "post-view", - component: () => import("@/views/NewsView.vue"), + component: () => import("@/views/PostView.vue"), }, ], }, @@ -171,7 +163,7 @@ export const routes = [ children: [ { path: "", - name: "post-list", + name: "dashboard-post-list", meta: { title: "Posts", middleware: "authenticated", @@ -181,7 +173,7 @@ export const routes = [ }, { path: "create", - name: "post-create", + name: "dashboard-post-create", meta: { title: "Create Post", middleware: "authenticated", @@ -191,7 +183,7 @@ export const routes = [ }, { path: ":id", - name: "post-edit", + name: "dashboard-post-edit", meta: { title: "Edit Post", middleware: "authenticated", @@ -206,7 +198,7 @@ export const routes = [ children: [ { path: "", - name: "event-list", + name: "dashboard-event-list", meta: { title: "Events", middleware: "authenticated", @@ -216,7 +208,7 @@ export const routes = [ }, { path: "create", - name: "event-create", + name: "dashboard-event-create", meta: { title: "Create Event", middleware: "authenticated", @@ -226,7 +218,7 @@ export const routes = [ }, { path: ":id", - name: "event-edit", + name: "dashboard-event-edit", meta: { title: "Event Post", middleware: "authenticated", @@ -238,7 +230,7 @@ export const routes = [ }, { path: "details", - name: "account-details", + name: "dashboard-account-details", meta: { title: "Account Details", middleware: "authenticated", @@ -250,7 +242,7 @@ export const routes = [ children: [ { path: "", - name: "user-list", + name: "dashboard-user-list", meta: { title: "Users", middleware: "authenticated", @@ -260,7 +252,7 @@ export const routes = [ }, { path: ":id", - name: "user-edit", + name: "dashboard-user-edit", meta: { title: "Edit User", middleware: "authenticated", @@ -275,7 +267,7 @@ export const routes = [ children: [ { path: "", - name: "media", + name: "dashboard-media", meta: { title: "Media", middleware: "authenticated", @@ -285,7 +277,7 @@ export const routes = [ }, { path: "upload", - name: "media-upload", + name: "dashboard-media-upload", meta: { title: "Upload Media", middleware: "authenticated", @@ -295,7 +287,7 @@ export const routes = [ }, { path: "edit/:id", - name: "media-edit", + name: "dashboard-media-edit", meta: { title: "Edit Media", middleware: "authenticated", @@ -307,7 +299,7 @@ export const routes = [ }, { path: "discord-bot-logs", - name: "discord-bot-logs", + name: "dashboard-discord-bot-logs", meta: { title: "Discord Bot Logs", middleware: "authenticated", diff --git a/resources/js/views/WorkshopList.vue b/resources/js/views/EventList.vue similarity index 84% rename from resources/js/views/WorkshopList.vue rename to resources/js/views/EventList.vue index cc9f8db..404f0d6 100644 --- a/resources/js/views/WorkshopList.vue +++ b/resources/js/views/EventList.vue @@ -1,8 +1,8 @@