diff --git a/apps/exhibition-live/components/config/tableConfig.tsx b/apps/exhibition-live/components/config/tableConfig.tsx index dd51ff70..8ebdf8ea 100644 --- a/apps/exhibition-live/components/config/tableConfig.tsx +++ b/apps/exhibition-live/components/config/tableConfig.tsx @@ -22,16 +22,16 @@ const dateColDef: ( header: t(p([...path, key])), id: p([...path, key, "single"]), accessorFn: mkAccessor(`${p([...path, key, "single"])}.value`, "", (v) => - specialDate2LocalDate(v, "de"), + typeof v === "string" || (typeof v === "number" && String(v).length === 8) + ? specialDate2LocalDate(Number(v), "de") + : String(v), ), filterVariant: "date", filterFn: "betweenInclusive", sortingFn: "datetime", Cell: ({ cell }) => { - const val = cell.getValue(); - return val && typeof val.toLocaleDateString === "function" - ? val.toLocaleDateString() - : ""; + const val = cell.getValue(); + return val || ""; }, Header: ({ column }) => {column.columnDef.header}, muiFilterTextFieldProps: { diff --git a/apps/exhibition-live/components/form/lobid/LobidAllPropTable.tsx b/apps/exhibition-live/components/form/lobid/LobidAllPropTable.tsx index a3d19214..918c5baf 100644 --- a/apps/exhibition-live/components/form/lobid/LobidAllPropTable.tsx +++ b/apps/exhibition-live/components/form/lobid/LobidAllPropTable.tsx @@ -3,6 +3,7 @@ import { Accordion, AccordionDetails, AccordionSummary, + Box, Button, Checkbox, Container, @@ -35,6 +36,8 @@ import { OverflowContainer } from "../../lists"; import { specialDate2LocalDate } from "../../utils/specialDate2LocalDate"; import { useTranslation } from "next-i18next"; import isNil from "lodash/isNil"; +import { isValidUrl } from "@slub/edb-core-utils"; +import { Image } from "mui-image"; interface OwnProps { allProps?: any; @@ -80,6 +83,10 @@ const LabledLink = ({ ); }; +const isImageUrl = (url: string) => { + return url.match(/\.(jpeg|jpg|gif|png)?\?.*$/) != null; +}; + const useMenuState = () => { const [menuAnchorEl, setAnchorEl] = useState(null); const menuOpen = Boolean(menuAnchorEl); @@ -251,6 +258,20 @@ const PropertyItem = ({ ) : typeof value === "string" || typeof value === "number" ? ( property.toLowerCase().includes("date") ? ( specialDate2LocalDate(value as number, locale) + ) : isValidUrl(value as string) ? ( + isImageUrl(value as string) ? ( + + + {value + + + ) : ( + + ) ) : ( value.toLocaleString() ) diff --git a/apps/exhibition-live/components/utils/specialDate2LocalDate.ts b/apps/exhibition-live/components/utils/specialDate2LocalDate.ts index d12938c8..f22f8b15 100644 --- a/apps/exhibition-live/components/utils/specialDate2LocalDate.ts +++ b/apps/exhibition-live/components/utils/specialDate2LocalDate.ts @@ -4,7 +4,7 @@ import dayjs from "dayjs"; export const specialDate2LocalDate = (date: number, locale: string) => { const { year, month, day } = getDateParts(date); const jsdate = numeric2JSDate(date); - if (!year) { + if (!year && month && day) { return dayjs(jsdate).format("MM.DD."); } if (!day && month && year) {