calendar frame

master
alex 2024-01-21 20:33:21 +01:00
parent d6fede364e
commit 55528a29ac
2 changed files with 29 additions and 1 deletions

View File

@ -19,7 +19,7 @@ import {
getUserSessionFromLocalStorage, getUserSessionFromLocalStorage,
myFetch, myFetch,
} from "../../../utils"; } from "../../../utils";
import { useEffect, useRef, useState } from "react"; import { Suspense, useEffect, useRef, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer"; import MyCenteredContainer from "../../../Components/MyContainer";
import { import {
MyCalendarMaxFutureBookingDaysFormInput, MyCalendarMaxFutureBookingDaysFormInput,
@ -34,9 +34,11 @@ import MyModal, {
MyModalCloseConfirmButtonFooter, MyModalCloseConfirmButtonFooter,
MyModalCloseSaveButtonFooter, MyModalCloseSaveButtonFooter,
} from "../../../Components/MyModal"; } from "../../../Components/MyModal";
import { useParams } from "react-router-dom";
export default function StoreCalendar() { export default function StoreCalendar() {
const { t } = useTranslation(); const { t } = useTranslation();
const { storeId } = useParams();
const [calendarSettings, setCalendarSettings] = useState({}); const [calendarSettings, setCalendarSettings] = useState({});
const [isRequesting, setIsRequesting] = useState(true); const [isRequesting, setIsRequesting] = useState(true);
@ -102,6 +104,10 @@ export default function StoreCalendar() {
/> />
)} )}
</Col> </Col>
<Col xs={24}>
<CalendarFrame storeId={storeId} />
</Col>
</Row> </Row>
</> </>
)} )}
@ -109,6 +115,27 @@ export default function StoreCalendar() {
); );
} }
function CalendarFrame({ storeId }) {
const [isLoading, setIsLoading] = useState(true);
return (
<>
{isLoading && (
<MyCenteredContainer>
<Spin size="large" />
</MyCenteredContainer>
)}
<iframe
onLoad={() => setIsLoading(false)}
style={{ border: 0, borderRadius: 10 }}
width="100%"
height={600}
src={`${Constants.EMBED_CALENDAR_ADDRESS}${storeId}`}
/>
</>
);
}
function CardPersonalCalendarSettings({ settings }) { function CardPersonalCalendarSettings({ settings }) {
const { t } = useTranslation(); const { t } = useTranslation();
const [form] = Form.useForm(); const [form] = Form.useForm();

View File

@ -39,6 +39,7 @@ export const Constants = {
API_ADDRESS: apiAddress, API_ADDRESS: apiAddress,
STATIC_CONTENT_ADDRESS: staticContentAddress, STATIC_CONTENT_ADDRESS: staticContentAddress,
WS_ADDRESS: wsAddress, WS_ADDRESS: wsAddress,
EMBED_CALENDAR_ADDRESS: "https://calendar.ex.umbach.dev/embed/?id=",
ROUTE_PATHS: { ROUTE_PATHS: {
OVERVIEW: "/", OVERVIEW: "/",
WEBSITE_COLOR_PALETTE: "/website/color-palette", WEBSITE_COLOR_PALETTE: "/website/color-palette",