Open home widget create forms in popup modals
The Places tab already popped its create form up over the page; every other /stp widget swapped its contents for the form instead, which meant losing sight of the list you were adding to and a cramped form inside a grid cell. Extract the Places modal into a shared components/util/Modal.vue (teleported backdrop, click-outside and Escape to close) and use it for the Feed, Bookmarks, Favorites, Consumption and Rowing create forms as well. Widget headers keep their normal titles now that each form carries its own heading in the modal. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KcFtkisHcKJuTZAnv3fVzA
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { computed, ref, defineAsyncComponent } from "vue";
|
||||
import LinkTable from "@/components/util/LinkTable.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||
import { useHomeDataStore } from "@/stores/homeData";
|
||||
@@ -26,16 +27,10 @@ const groupedBookmarks = computed(() => {
|
||||
<template>
|
||||
<div class="bookmarks-wrapper">
|
||||
<Header class="text-left">
|
||||
{{ showCreate ? "Create Bookmark" : "Bookmarks" }}
|
||||
Bookmarks
|
||||
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||
</Header>
|
||||
<CreateBookmark
|
||||
v-if="showCreate"
|
||||
class="flex-1 min-h-0 p-1"
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
<div v-if="!showCreate" class="bookmarks-scroll">
|
||||
<div class="bookmarks-scroll">
|
||||
<LinkTable
|
||||
v-for="group in groupedBookmarks"
|
||||
:key="group[0]"
|
||||
@@ -43,6 +38,12 @@ const groupedBookmarks = computed(() => {
|
||||
:items="group[1]"
|
||||
/>
|
||||
</div>
|
||||
<Modal v-model="showCreate">
|
||||
<CreateBookmark
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import Slideshow from "@/components/util/Slideshow.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
import PlacesTable from "./PlacesTable.vue";
|
||||
import CreatePlace from "@/views/admin/CreatePlace.vue";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
@@ -47,16 +48,9 @@ const isAdmin = computed(() => !!auth.user?.admin);
|
||||
<PlacesTable v-else />
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div v-if="showAdd" class="modal-backdrop" @click.self="showAdd = false">
|
||||
<div class="modal bdr-1">
|
||||
<CreatePlace
|
||||
@done="showAdd = false"
|
||||
@cancel="showAdd = false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<Modal v-model="showAdd">
|
||||
<CreatePlace @done="showAdd = false" @cancel="showAdd = false" />
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -114,24 +108,4 @@ const isAdmin = computed(() => !!auth.user?.admin);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-color: rgba(0, 0, 0, 0.65);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 50;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.modal {
|
||||
background-color: var(--color-surface);
|
||||
padding: 16px;
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import AutoScroll from "@/components/util/AutoScroll.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
import LinkTable from "@/components/util/LinkTable.vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||
@@ -18,21 +19,21 @@ const showCreate = ref(false);
|
||||
<template>
|
||||
<div class="flex flex-col items-center">
|
||||
<Header>
|
||||
{{ showCreate ? "Create Activity" : "Consumption" }}
|
||||
Consumption
|
||||
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||
</Header>
|
||||
<CreateActivity
|
||||
v-if="showCreate"
|
||||
class="flex-1 w-full p-1"
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
<AutoScroll v-if="!showCreate" class="flex-1 w-full">
|
||||
<AutoScroll class="flex-1 w-full">
|
||||
<LinkTable
|
||||
variant="table"
|
||||
class="w-full"
|
||||
:items="activityStore.activity"
|
||||
/>
|
||||
</AutoScroll>
|
||||
<Modal v-model="showCreate">
|
||||
<CreateActivity
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,7 @@ import Header from "@/components/text/Header.vue";
|
||||
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||
import LinkTable from "@/components/util/LinkTable.vue";
|
||||
import AutoScroll from "@/components/util/AutoScroll.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
|
||||
import { ref, defineAsyncComponent } from "vue";
|
||||
import { useFavoritesStore } from "@/stores/favorites";
|
||||
@@ -18,21 +19,21 @@ const showCreate = ref(false);
|
||||
<template>
|
||||
<div class="flex flex-col items-center">
|
||||
<Header>
|
||||
{{ showCreate ? "Create Favorite" : "favs" }}
|
||||
favs
|
||||
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||
</Header>
|
||||
<CreateFavorite
|
||||
v-if="showCreate"
|
||||
class="w-full flex-1 p-1"
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
<AutoScroll v-if="!showCreate" class="w-full flex-1">
|
||||
<AutoScroll class="w-full flex-1">
|
||||
<LinkTable
|
||||
variant="table"
|
||||
class="w-full"
|
||||
:items="favoritesStore.favorites"
|
||||
/>
|
||||
</AutoScroll>
|
||||
<Modal v-model="showCreate">
|
||||
<CreateFavorite
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import Markdown from "@/components/util/Markdown.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||
|
||||
@@ -46,17 +47,10 @@ function deletePost() {
|
||||
<template>
|
||||
<div class="flex flex-col flex-1 min-h-0">
|
||||
<Header>
|
||||
{{ showCreate ? "Create Post" : post.title }}
|
||||
{{ post.title }}
|
||||
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||
</Header>
|
||||
<CreatePost
|
||||
v-if="showCreate"
|
||||
class="flex-1 min-h-0 p-1"
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
<div
|
||||
v-if="!showCreate"
|
||||
class="flex flex-col flex-1 min-h-0 p-1 overflow-auto text-left items-start justify-start"
|
||||
>
|
||||
<small>Created at: {{ new Date(post.createdAt).toLocaleString() }}</small>
|
||||
@@ -74,6 +68,9 @@ function deletePost() {
|
||||
>Delete</Button
|
||||
>
|
||||
</div>
|
||||
<Modal v-model="showCreate" max-width="560px">
|
||||
<CreatePost @done="showCreate = false" @cancel="showCreate = false" />
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, defineAsyncComponent } from "vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import Modal from "@/components/util/Modal.vue";
|
||||
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||
import { useHomeDataStore } from "@/stores/homeData";
|
||||
import { storeToRefs } from "pinia";
|
||||
@@ -116,17 +117,14 @@ function formatValue(key, val) {
|
||||
<template>
|
||||
<div class="flex flex-col h-full overflow-hidden">
|
||||
<Header>
|
||||
{{ showCreate ? "Upload Rowing" : "Rowing" }}
|
||||
Rowing
|
||||
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||
</Header>
|
||||
|
||||
<CreateRowing
|
||||
v-if="showCreate"
|
||||
class="flex-1 p-1"
|
||||
@done="showCreate = false"
|
||||
@cancel="showCreate = false"
|
||||
/>
|
||||
<div v-else-if="loading" class="flex-1 flex items-center justify-center">
|
||||
<Modal v-model="showCreate">
|
||||
<CreateRowing @done="showCreate = false" @cancel="showCreate = false" />
|
||||
</Modal>
|
||||
<div v-if="loading" class="flex-1 flex items-center justify-center">
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
<div v-else-if="error" class="flex-1 flex items-center justify-center">
|
||||
|
||||
Reference in New Issue
Block a user