Improved promotion page readability on mobile
This commit is contained in:
@@ -129,11 +129,7 @@ function setAllToday() {
|
|||||||
<div class="w-xl">
|
<div class="w-xl">
|
||||||
<form v-if="!formSubmitted" id="trainingForm" @submit.prevent="submitForm"
|
<form v-if="!formSubmitted" id="trainingForm" @submit.prevent="submitForm"
|
||||||
class="w-full min-w-0 flex flex-col gap-4">
|
class="w-full min-w-0 flex flex-col gap-4">
|
||||||
<div>
|
|
||||||
<FieldLegend class="scroll-m-20 text-2xl font-semibold tracking-tight">
|
|
||||||
Promotion Form
|
|
||||||
</FieldLegend>
|
|
||||||
</div>
|
|
||||||
<VeeFieldArray name="promotions" v-slot="{ fields, push, remove }">
|
<VeeFieldArray name="promotions" v-slot="{ fields, push, remove }">
|
||||||
<FieldSet class="w-full min-w-0">
|
<FieldSet class="w-full min-w-0">
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
|
|||||||
@@ -1,29 +1,48 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { Plus, PlusIcon, X } from 'lucide-vue-next'
|
||||||
|
import PromotionForm from '@/components/promotions/promotionForm.vue'
|
||||||
|
import PromotionList from '@/components/promotions/promotionList.vue'
|
||||||
|
import DialogContent from '@/components/ui/dialog/DialogContent.vue'
|
||||||
|
import Dialog from '@/components/ui/dialog/Dialog.vue'
|
||||||
|
import DialogTrigger from '@/components/ui/dialog/DialogTrigger.vue'
|
||||||
|
import DialogHeader from '@/components/ui/dialog/DialogHeader.vue'
|
||||||
|
import DialogTitle from '@/components/ui/dialog/DialogTitle.vue'
|
||||||
|
import Button from '@/components/ui/button/Button.vue'
|
||||||
|
|
||||||
|
const isFormOpen = ref(false)
|
||||||
|
const listRef = ref(null)
|
||||||
|
|
||||||
|
const isMobileFormOpen = ref(false);
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mx-auto mt-6 lg:mt-10 px-4 lg:px-8">
|
<div class="mx-auto mt-6 lg:mt-10 px-4 lg:px-8">
|
||||||
|
|
||||||
<div class="flex items-center justify-between mb-6 lg:hidden">
|
<div class="flex flex-col items-center justify-between mb-6 lg:hidden">
|
||||||
<h1 class="text-2xl font-semibold tracking-tight">Promotion History</h1>
|
<div v-if="isMobileFormOpen">
|
||||||
|
<div class="mb-4 flex justify-between items-center">
|
||||||
<Dialog v-model:open="isFormOpen">
|
<p class="scroll-m-20 text-2xl font-semibold tracking-tight">
|
||||||
<DialogTrigger as-child>
|
Promotion Form
|
||||||
<Button size="sm" class="gap-2">
|
</p>
|
||||||
<Plus class="size-4" />
|
<Button variant="ghost" size="icon" @click="isMobileFormOpen = false">
|
||||||
Promote
|
<X v-if="isMobileFormOpen" class="size-6"></X>
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
|
||||||
<DialogContent class="w-full h-full max-w-none m-0 rounded-none flex flex-col">
|
|
||||||
<DialogHeader class="flex-row items-center justify-between border-b pb-4">
|
|
||||||
<DialogTitle>New Promotion</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div class="flex-1 overflow-y-auto pt-6">
|
|
||||||
<PromotionForm @submitted="handleMobileSubmit" />
|
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
<PromotionForm @submitted="listRef?.refresh" />
|
||||||
</Dialog>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div class="flex justify-between w-full">
|
||||||
|
<h1 class="text-2xl font-semibold tracking-tight">Promotion History</h1>
|
||||||
|
<Button @click="isMobileFormOpen = true">
|
||||||
|
<PlusIcon />Submit
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<PromotionList></PromotionList>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col lg:flex-row lg:max-h-[70vh] gap-8">
|
<div class="hidden lg:flex flex-row lg:max-h-[70vh] gap-8">
|
||||||
<div class="flex-1 lg:border-r lg:pr-8 w-full lg:min-w-2xl">
|
<div class="flex-1 lg:border-r lg:pr-8 w-full lg:min-w-2xl">
|
||||||
<p class="hidden lg:block scroll-m-20 text-2xl font-semibold tracking-tight mb-3">
|
<p class="hidden lg:block scroll-m-20 text-2xl font-semibold tracking-tight mb-3">
|
||||||
Promotion History
|
Promotion History
|
||||||
@@ -42,24 +61,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { Plus } from 'lucide-vue-next'
|
|
||||||
import PromotionForm from '@/components/promotions/promotionForm.vue'
|
|
||||||
import PromotionList from '@/components/promotions/promotionList.vue'
|
|
||||||
import DialogContent from '@/components/ui/dialog/DialogContent.vue'
|
|
||||||
import Dialog from '@/components/ui/dialog/Dialog.vue'
|
|
||||||
import DialogTrigger from '@/components/ui/dialog/DialogTrigger.vue'
|
|
||||||
import DialogHeader from '@/components/ui/dialog/DialogHeader.vue'
|
|
||||||
import DialogTitle from '@/components/ui/dialog/DialogTitle.vue'
|
|
||||||
import Button from '@/components/ui/button/Button.vue'
|
|
||||||
|
|
||||||
const isFormOpen = ref(false)
|
|
||||||
const listRef = ref(null)
|
|
||||||
|
|
||||||
const handleMobileSubmit = () => {
|
|
||||||
isFormOpen.value = false // Close the "Whole page" modal
|
|
||||||
listRef.value?.refresh() // Refresh the list behind it
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
Reference in New Issue
Block a user