Event kurzbeschreibung für Listenansicht hinzugefügt
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
import { Bot, Calendar, FileText, UserIcon } from "lucide-react";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useRef, useState } from "react";
|
||||
import { useRef } from "react";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { PaginatedTable, PaginatedTableRef } from "../../../../_components/PaginatedTable";
|
||||
@@ -24,6 +24,7 @@ import { deleteEvent, upsertEvent } from "../action";
|
||||
import { AppointmentModal } from "./AppointmentModal";
|
||||
import { ParticipantModal } from "./ParticipantModal";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export const Form = ({ event }: { event?: Event }) => {
|
||||
const { data: session } = useSession();
|
||||
@@ -66,6 +67,7 @@ export const Form = ({ event }: { event?: Event }) => {
|
||||
<form
|
||||
onSubmit={form.handleSubmit(async (values) => {
|
||||
await upsertEvent(values, event?.id);
|
||||
toast.success("Event erfolgreich gespeichert");
|
||||
if (!event) redirect(`/admin/event`);
|
||||
})}
|
||||
className="grid grid-cols-6 gap-3"
|
||||
@@ -75,17 +77,6 @@ export const Form = ({ event }: { event?: Event }) => {
|
||||
<h2 className="card-title">
|
||||
<FileText className="w-5 h-5" /> Allgemeines
|
||||
</h2>
|
||||
<Input form={form} label="Name" name="name" className="input-sm" />
|
||||
<MarkdownEditor form={form} name="description" />
|
||||
<Input
|
||||
form={form}
|
||||
label="Maximale Teilnehmer (Nur für live Events)"
|
||||
className="input-sm"
|
||||
{...form.register("maxParticipants", {
|
||||
valueAsNumber: true,
|
||||
})}
|
||||
/>
|
||||
<Switch form={form} name="hidden" label="Versteckt" />
|
||||
<Select
|
||||
form={form}
|
||||
name="type"
|
||||
@@ -95,6 +86,9 @@ export const Form = ({ event }: { event?: Event }) => {
|
||||
value: value,
|
||||
}))}
|
||||
/>
|
||||
<Input form={form} label="Name" name="name" className="input-sm" />
|
||||
<MarkdownEditor form={form} name="description" />
|
||||
<MarkdownEditor form={form} name="descriptionShort" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="card bg-base-200 shadow-xl col-span-3 max-xl:col-span-6">
|
||||
@@ -144,7 +138,18 @@ export const Form = ({ event }: { event?: Event }) => {
|
||||
label="Discord Rolle für eingeschriebene Teilnehmer"
|
||||
className="input-sm"
|
||||
/>
|
||||
<Input
|
||||
form={form}
|
||||
label="Maximale Teilnehmer (Nur für live Events)"
|
||||
className="input-sm"
|
||||
{...form.register("maxParticipants", {
|
||||
valueAsNumber: true,
|
||||
})}
|
||||
/>
|
||||
<Switch form={form} name="hasPresenceEvents" label="Hat Live Event" />
|
||||
<div className="divider w-full" />
|
||||
|
||||
<Switch form={form} name="hidden" label="Event verstecken" />
|
||||
</div>
|
||||
</div>
|
||||
{form.watch("hasPresenceEvents") ? (
|
||||
|
||||
@@ -38,8 +38,7 @@ export const EventCard = ({
|
||||
<div className="col-span-4">
|
||||
<div className="text-left text-balance">
|
||||
<MDEditor.Markdown
|
||||
source={event.description}
|
||||
className="whitespace-pre-wrap"
|
||||
source={event.descriptionShort}
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
|
||||
@@ -157,7 +157,6 @@ const ModalBtn = ({
|
||||
<div className="text-left text-balance">
|
||||
<MDEditor.Markdown
|
||||
source={event.description}
|
||||
className="whitespace-pre-wrap"
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
|
||||
@@ -37,6 +37,7 @@ model Participant {
|
||||
model Event {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
descriptionShort String @default("")
|
||||
description String
|
||||
type EVENT_TYPE @default(EVENT)
|
||||
discordRoleId String? @default("")
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Event" ADD COLUMN "descriptionShort" TEXT NOT NULL DEFAULT '';
|
||||
Reference in New Issue
Block a user