{fallback}
; + } + + return ( ++ {firstSubCategory.label} +
+ ) : null} + ++ {t("plugg:page.search_title")} +
++ {result.label} +
+ {result.secondary ? ( ++ {result.secondary} +
+ ) : null} ++ {program.title} +
++ {program.description + ? truncateDescription(program.description, 130) + : t("plugg:page.program_description_fallback")} +
+ +{t("plugg:page.contact_card_text")}
++ {t("plugg:page.contact_card_note")} +
+ +{t("plugg:page.advertisement_text")}
+{fallback}
; + } + + return ( +{fallback}
; + } + + return ( +{fallback}
; + } + + return ( ++ The document will open in your browser's PDF viewer. +
+ > + ); +} diff --git a/src/components/AssociatedImageManager.tsx b/src/components/AssociatedImageManager.tsx new file mode 100644 index 00000000..3cb83178 --- /dev/null +++ b/src/components/AssociatedImageManager.tsx @@ -0,0 +1,206 @@ +"use client"; + +import type { AssociationTypeEnum } from "@/api"; +import { + deleteAssociatedImageMutation, + uploadAssociatedImageMutation, +} from "@/api/@tanstack/react-query.gen"; +import ImageDisplay from "@/components/ImageDisplay"; +import { ConfirmDeleteDialog } from "@/components/ConfirmDeleteDialog"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import getErrorMessage from "@/help_functions/getErrorMessage"; +import { useMutation } from "@tanstack/react-query"; +import { Eye, ImagePlus, Trash2, Upload } from "lucide-react"; +import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { toast } from "sonner"; + +interface AssociatedImageManagerProps { + associationType: AssociationTypeEnum; + associationId: number | null; + associatedImageId: number | null; + onImageChanged?: () => void; + addButtonText?: string; +} + +export default function AssociatedImageManager({ + associationType, + associationId, + associatedImageId, + onImageChanged, + addButtonText, +}: AssociatedImageManagerProps) { + const { t } = useTranslation(); + const [uploadDialogOpen, setUploadDialogOpen] = useState(false); + const [previewOpen, setPreviewOpen] = useState(false); + const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [fileToUpload, setFileToUpload] = useState+ {truncatedDescription} +
+ ) : ( ++ {emptyDescriptionText} +
+ )} ++ {t("plugg:navbar.specialisations")} +
++ {t("plugg:navbar.specialisations")} +
+