Skip to content

Commit

Permalink
fix vite build and better menu integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Tilsch committed May 30, 2024
1 parent dafa284 commit ce2e742
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ import {
} from "@mui/icons-material";
import { JSONSchema7 } from "json-schema";

import { MenuGroup } from "./types";
import { MenuGroup, MenuItem } from "./types";
import { TFunction } from "i18next";
import { Permission } from "@slub/edb-core-types";

const icons = { IconFaceId, IconPaint, IconDots };

const topLevel = ["Exhibition", "Person"];
const disabledTypes = [
"InvolvedPerson",
"InvolvedCorporation",
"ExponatsAndPersons",
"ExponatsAndCorporations",
];

const lists: (
schema: JSONSchema7,
Expand All @@ -31,17 +37,34 @@ const lists: (
url: `/list/${key}`,
typeName: key,
})),*/
children: Object.entries(
exhibitionSchema.definitions || exhibitionSchema["$defs"] || {},
)
.filter(([key]) => !topLevel.includes(key))
.map(([key, value]) => ({
id: `list_${key}`,
title: t(key),
type: "item",
typeName: key,
readOnly: !getPermission(key).edit,
})),
children: [
...topLevel.map(
(key) =>
({
id: `list_${key}`,
title: t(key),
type: "item",
typeName: key,
readOnly: !getPermission(key).edit,
}) as MenuItem,
),
...Object.entries(
exhibitionSchema.definitions || exhibitionSchema["$defs"] || {},
)
.filter(
([key]) => !topLevel.includes(key) && disabledTypes.indexOf(key) === -1,
)
.map(
([key, value]) =>
({
id: `list_${key}`,
title: t(key),
type: "item",
typeName: key,
readOnly: !getPermission(key).edit,
}) as MenuItem,
),
],
});

export default lists;
2 changes: 2 additions & 0 deletions apps/exhibition-live/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"export": "Export",
"list": "auflisten",
"List": "Liste",
"Tag": "Schlagwort",
"exhibition database": "Ausstellungsdatenbank",
"create new": "{{item}} neu anlegen",
"Exhibition": "Ausstellung",
Expand All @@ -38,6 +39,7 @@
"ExhibitionExponat": "Exponat",
"ExhibitionExponat_plural": "Exponate",
"ExhibitionSeries": "Ausstellungsreihe",
"ResourceType": "Art der Ressource",
"ExhibitionSeries_plural": "Ausstellungsreihen",
"GeographicLocation": "Geographische Position",
"GeographicLocation_plural": "Geographische Positionen",
Expand Down
2 changes: 2 additions & 0 deletions apps/exhibition-live/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"export": "export",
"list": "list",
"List": "list",
"Tag": "Tag",
"exhibition database": "Exhibition Database",
"create new": "create new {{item}}",
"Exhibition": "Exhibition",
Expand All @@ -38,6 +39,7 @@
"ExhibitionExponat": "exhibition exponat",
"ExhibitionExponat_plural": "exhibition exponats",
"ExhibitionSeries": "exhibition series",
"ResourceType": "resource type",
"ExhibitionSeries_plural": "exhibition series",
"GeographicLocation": "geographic location",
"GeographicLocation_plural": "geographic locations",
Expand Down
2 changes: 1 addition & 1 deletion apps/exhibition-live/vite/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { AdbProvider, store } from "@slub/edb-state-hooks";
import { Provider } from "react-redux";
import { envToSparqlEndpoint } from "../components/config/envToSparqlEndpoint";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import "dayjs/locale/de";
import "dayjs/locale/en";
Expand All @@ -16,6 +15,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import SemanticJsonForm from "../components/form/SemanticJsonForm";
import { exhibitionConfig } from "../components/config/exhibitionAppConfig";
import { envToSparqlEndpoint } from "@slub/edb-ui-utils";

export const queryClient = new QueryClient();

Expand Down

0 comments on commit ce2e742

Please sign in to comment.