From a911e6ca690218d246c18762b2c3f098c25c930c Mon Sep 17 00:00:00 2001 From: Adam French Date: Mon, 13 Apr 2026 12:13:13 +0100 Subject: [PATCH] Add inline admin create forms to home page components Lazy-load create forms (Post, Activity, Favorite, Rowing) directly into their corresponding home components with an admin-only toggle button, replacing the need to navigate to the admin page. Co-Authored-By: Claude Sonnet 4.6 --- vue/src/views/admin/CreateActivity.vue | 4 ++++ vue/src/views/admin/CreateFavorite.vue | 4 ++++ vue/src/views/admin/CreatePost.vue | 5 ++++- vue/src/views/admin/CreateRowing.vue | 4 ++++ vue/src/views/home/Consumption.vue | 18 ++++++++++++++++-- vue/src/views/home/Favorites.vue | 18 ++++++++++++++++-- vue/src/views/home/Feed.vue | 16 ++++++++++++++-- vue/src/views/home/Gym2.vue | 19 ++++++++++++++++--- 8 files changed, 78 insertions(+), 10 deletions(-) diff --git a/vue/src/views/admin/CreateActivity.vue b/vue/src/views/admin/CreateActivity.vue index c370484..ac73e55 100644 --- a/vue/src/views/admin/CreateActivity.vue +++ b/vue/src/views/admin/CreateActivity.vue @@ -4,6 +4,8 @@ import Button from "@/components/input/Button.vue"; import { ref } from "vue"; import { gql } from "@/graphql"; +const emit = defineEmits(["done", "cancel"]); + const type = ref(""); const name = ref(""); const link = ref(""); @@ -18,6 +20,7 @@ async function post() { name.value = ""; link.value = ""; console.log(data.createActivity); + emit("done"); } catch (err) { console.error(err); } @@ -31,5 +34,6 @@ async function post() { + diff --git a/vue/src/views/admin/CreateFavorite.vue b/vue/src/views/admin/CreateFavorite.vue index 119df4d..6493d01 100644 --- a/vue/src/views/admin/CreateFavorite.vue +++ b/vue/src/views/admin/CreateFavorite.vue @@ -4,6 +4,8 @@ import Button from "@/components/input/Button.vue"; import { ref } from "vue"; import { gql } from "@/graphql"; +const emit = defineEmits(["done", "cancel"]); + const type = ref(""); const name = ref(""); const link = ref(""); @@ -18,6 +20,7 @@ async function post() { name.value = ""; link.value = ""; console.log(data.createFavorite); + emit("done"); } catch (err) { console.error(err); } @@ -31,5 +34,6 @@ async function post() { + diff --git a/vue/src/views/admin/CreatePost.vue b/vue/src/views/admin/CreatePost.vue index f6a94b7..5722273 100644 --- a/vue/src/views/admin/CreatePost.vue +++ b/vue/src/views/admin/CreatePost.vue @@ -3,6 +3,8 @@ import Button from "@/components/input/Button.vue"; import { ref } from "vue"; import { gql } from "@/graphql"; +const emit = defineEmits(["done", "cancel"]); + const title = ref(""); const content = ref(""); @@ -15,6 +17,7 @@ async function post() { title.value = ""; content.value = ""; console.log(data.createPost); + emit("done"); } catch (err) { console.error(err); } @@ -31,6 +34,6 @@ async function post() { placeholder="Content" > - + diff --git a/vue/src/views/admin/CreateRowing.vue b/vue/src/views/admin/CreateRowing.vue index 5a1e586..4f92b9a 100644 --- a/vue/src/views/admin/CreateRowing.vue +++ b/vue/src/views/admin/CreateRowing.vue @@ -3,6 +3,8 @@ import Button from "@/components/input/Button.vue"; import { ref } from "vue"; import axios from "axios"; +const emit = defineEmits(["done", "cancel"]); + const images = ref([]); const results = ref([]); @@ -35,6 +37,7 @@ async function submit() { ); images.value = []; + emit("done"); } @@ -43,6 +46,7 @@ async function submit() {

Create Rowing

+
{{ r.name }}: {{ r.status }} diff --git a/vue/src/views/home/Consumption.vue b/vue/src/views/home/Consumption.vue index b4b1551..25a7f7a 100644 --- a/vue/src/views/home/Consumption.vue +++ b/vue/src/views/home/Consumption.vue @@ -3,15 +3,29 @@ import AutoScroll from "@/components/util/AutoScroll.vue"; import LinkTable from "@/components/util/LinkTable.vue"; import Header from "@/components/text/Header.vue"; +import { ref, defineAsyncComponent } from "vue"; import { useActivityStore } from "@/stores/activity"; +import { useAuthStore } from "@/stores/auth"; + +const CreateActivity = defineAsyncComponent(() => import("@/views/admin/CreateActivity.vue")); const activityStore = useActivityStore(); +const authStore = useAuthStore(); +const showCreate = ref(false);