Added event creation page, using the react-jsonschema-form package.
This commit is contained in:
@@ -100,6 +100,7 @@
|
|||||||
"normalize.css": "^8.0.0",
|
"normalize.css": "^8.0.0",
|
||||||
"query-string": "^6.2.0",
|
"query-string": "^6.2.0",
|
||||||
"react-helmet": "^5.2.0",
|
"react-helmet": "^5.2.0",
|
||||||
|
"react-jsonschema-form": "^1.2.0",
|
||||||
"react-router": "^4.3.1",
|
"react-router": "^4.3.1",
|
||||||
"react-router-dom": "^4.3.1"
|
"react-router-dom": "^4.3.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.event-create-page {
|
||||||
|
width: inherit;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
import Helmet from "react-helmet";
|
||||||
|
import "./EventCreatePage.scss";
|
||||||
|
import { async } from "q";
|
||||||
|
import { isAuthenticated } from "../../auth";
|
||||||
|
import Form from "react-jsonschema-form";
|
||||||
|
|
||||||
|
export interface EventCreatePageProps {}
|
||||||
|
export interface EventCreatePageState {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EventCreatePage extends React.Component<EventCreatePageProps, EventCreatePageState> {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const schema = {
|
||||||
|
title: "Uusi tapahtuma",
|
||||||
|
type: "object",
|
||||||
|
required: ["title"],
|
||||||
|
properties: {
|
||||||
|
title: {type: "string", title: "Name", default: "Name for the event"},
|
||||||
|
location: {type: "string", title: "Location", defailt: "Location for the event"},
|
||||||
|
multipleChoicesList: {
|
||||||
|
type: "array",
|
||||||
|
title: "Event type",
|
||||||
|
items: {
|
||||||
|
type: "string",
|
||||||
|
enum: [
|
||||||
|
"Virallinen",
|
||||||
|
"Fuksit",
|
||||||
|
"Opinnot",
|
||||||
|
"Urheilu"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
uniqueItems: true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div className="event-create-page">
|
||||||
|
<Helmet>
|
||||||
|
<link rel="canonical" href="https://sik.ayy.fi/admin/events/create" />
|
||||||
|
</Helmet>
|
||||||
|
Event Create Page
|
||||||
|
<Form schema={schema}
|
||||||
|
onChange={console.log("cahnged")}
|
||||||
|
onSubmit={console.log("submitted")}
|
||||||
|
onError={console.log("error")} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EventCreatePage;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
import EventCreatePage from "./EventCreatePage";
|
||||||
|
export default EventCreatePage;
|
||||||
@@ -14,6 +14,7 @@ import AdminCommonPage from "./pages/AdminCommonPage";
|
|||||||
import AdminLoginPage from "./pages/AdminLoginPage";
|
import AdminLoginPage from "./pages/AdminLoginPage";
|
||||||
import { getTokenCookie } from "./auth";
|
import { getTokenCookie } from "./auth";
|
||||||
import AdminLogoutPage from "./pages/AdminLogoutPage";
|
import AdminLogoutPage from "./pages/AdminLogoutPage";
|
||||||
|
import EventCreatePage from "./pages/EventCreatePage";
|
||||||
|
|
||||||
const renderPage = (Page) => (props): JSX.Element => {
|
const renderPage = (Page) => (props): JSX.Element => {
|
||||||
return <CommonPage page={Page} {...props} />;
|
return <CommonPage page={Page} {...props} />;
|
||||||
@@ -38,6 +39,7 @@ const adminLoginRoutes = [
|
|||||||
|
|
||||||
const adminRoutes = [
|
const adminRoutes = [
|
||||||
{ path: "/admin/events", page: AdminEventPage },
|
{ path: "/admin/events", page: AdminEventPage },
|
||||||
|
{ path: "/admin/events/create", page: EventCreatePage},
|
||||||
{ path: "/admin/logout", page: AdminLogoutPage },
|
{ path: "/admin/logout", page: AdminLogoutPage },
|
||||||
{ path: "/admin", page: AdminFrontPage },
|
{ path: "/admin", page: AdminFrontPage },
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user