master
alex 2024-01-23 23:20:43 +01:00
parent 398efd08ce
commit 5b0dc3d0b9
7 changed files with 174 additions and 34 deletions

View File

@ -67,19 +67,19 @@
},
"sideMenu": {
"overview": "Übersicht",
"website": {
"title": "Website",
"colorPalette": "Farbpalette",
"banner": "Banner",
"socials": "Soziale Netzwerke"
},
"store": {
"titleSingular": "Geschäft",
"titlePlural": "Geschäfte",
"settings": "Einstellungen",
"employees": "Mitarbeiter",
"services": "Dienstleistungen",
"calendar": "Kalender"
"calendar": "Kalender",
"website": {
"title": "Website",
"colorPalette": "Farbpalette",
"banner": "Banner",
"socials": "Soziale Netzwerke"
}
},
"support": "Unterstützung",
"feedback": "Feedback"
@ -182,5 +182,12 @@
},
"storeSettings": {
"pageTitle": "Einstellungen"
},
"storeWebsite": {
"noWebsite": {
"title": "Sie haben noch keine Website erstellt",
"subTitle": "Jetzt loslegen und Ihre Website erstellen.",
"button": "Website erstellen"
}
}
}

View File

@ -67,19 +67,19 @@
},
"sideMenu": {
"overview": "Overview",
"website": {
"title": "Website",
"colorPalette": "Color palette",
"banner": "Banner",
"socials": "Socials"
},
"store": {
"titleSingular": "Store",
"titlePlural": "Stores",
"settings": "Settings",
"employees": "Employees",
"services": "Services",
"calendar": "Calendar"
"calendar": "Calendar",
"website": {
"title": "Website",
"colorPalette": "Color palette",
"banner": "Banner",
"socials": "Socials"
}
},
"support": "Support",
"feedback": "Feedback"
@ -185,5 +185,12 @@
},
"storeSettings": {
"pageTitle": "Settings"
},
"storeWebsite": {
"noWebsite": {
"title": "You have not yet created a website",
"subTitle": "Get started now and create your website.",
"button": "Create website"
}
}
}

View File

@ -12,6 +12,7 @@ const StoreEmployees = lazy(() => import("../../Pages/Store/Employees"));
const StoreServices = lazy(() => import("../../Pages/Store/Services"));
const StoreCalendar = lazy(() => import("../../Pages/Store/Calendar"));
const StoreCalendarAuth = lazy(() => import("../../Pages/Store/Calendar/Auth"));
const StoreWebsite = lazy(() => import("../../Pages/Store/Website"));
//const Support = lazy(() => import("../../Pages/Support"));
//const Feedback = lazy(() => import("../../Pages/Feedback"));
const UserProfile = lazy(() => import("../../Pages/UserProfile"));
@ -75,6 +76,15 @@ export default function AppRoutes({ userSession, setUserSession }) {
}
/>
<Route
path={`${Constants.ROUTE_PATHS.STORE.WEBSITE}/:storeId`}
element={
<MySupsenseFallback>
<StoreWebsite />
</MySupsenseFallback>
}
/>
<Route
path={Constants.ROUTE_PATHS.SUPPORT}
element={

View File

@ -43,6 +43,7 @@ export function SideMenuContent({
},
];
/*
// website
let websites = {
@ -79,7 +80,7 @@ export function SideMenuContent({
websites.children.push(groupWebsite);
items.push(websites);
items.push(websites); */
// stores
@ -131,6 +132,14 @@ export function SideMenuContent({
});
}
if (sideBarContext.permissions.includes("website")) {
groupStore.children.push({
label: t("sideMenu.store.website.title"),
icon: <EditOutlined />,
key: `${Constants.ROUTE_PATHS.STORE.WEBSITE}/${store.store_id}`,
});
}
stores.children.push(groupStore);
});

View File

@ -1,16 +1,13 @@
import {
Button,
Card,
Checkbox,
Col,
Form,
Popconfirm,
Result,
Row,
Space,
Spin,
Switch,
Typography,
} from "antd";
import { useTranslation } from "react-i18next";
import {
@ -19,7 +16,7 @@ import {
getUserSessionFromLocalStorage,
myFetch,
} from "../../../utils";
import { Suspense, useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer";
import {
MyCalendarMaxFutureBookingDaysFormInput,
@ -32,7 +29,6 @@ import {
} from "../../../Components/MyRequestStateItem";
import MyModal, {
MyModalCloseConfirmButtonFooter,
MyModalCloseSaveButtonFooter,
} from "../../../Components/MyModal";
import { useParams } from "react-router-dom";

View File

@ -0,0 +1,113 @@
import { useEffect, useState } from "react";
import { myFetch } from "../../../utils";
import { useParams } from "react-router-dom";
import MyCenteredContainer from "../../../Components/MyContainer";
import { Button, Card, Result, Spin, Tabs } from "antd";
import { useTranslation } from "react-i18next";
export default function Website() {
const { storeId } = useParams();
const { t } = useTranslation();
const [isRequesting, setIsRequesting] = useState(true);
const [website, setWebsite] = useState({});
useEffect(() => {
myFetch(`/website/${storeId}`, "GET")
.then((res) => {
console.log(res);
setIsRequesting(false);
})
.catch((err) => {
setIsRequesting(false);
if (err === 404) setWebsite(null);
console.log(err);
});
}, []);
if (isRequesting) {
return (
<MyCenteredContainer>
<Spin size="large" />
</MyCenteredContainer>
);
}
if (!website) {
return <NoWebsiteCreateOne setWebsite={setWebsite} />;
}
return (
<div>
<h1>Website</h1>
<Card>
<Tabs
type="card"
items={[
"Allgemein",
"Banner",
"Color Scheme",
"Zeit Adler",
"Portfolio",
"Bewertungen",
"Footer / Socials",
"Impressum",
"Data Privacy",
].map((item) => ({
label: item,
key: item,
content: <div>Test</div>,
}))}
/>
</Card>
</div>
);
}
function NoWebsiteCreateOne({ setWebsite }) {
const { t } = useTranslation();
const { storeId } = useParams();
const [isRequesting, setIsRequesting] = useState(false);
const handleCreateWebsite = () => {
setIsRequesting(true);
myFetch("/website", "POST", {
storeId,
})
.then((res) => {
console.log(res);
setWebsite({});
})
.catch((err) => {
setIsRequesting(false);
console.log(err);
});
};
return (
<MyCenteredContainer>
<Result
status="404"
title={t("storeWebsite.noWebsite.title")}
subTitle={t("storeWebsite.noWebsite.subTitle")}
extra={
<Button
type="primary"
loading={isRequesting}
onClick={handleCreateWebsite}
>
{t("storeWebsite.noWebsite.button")}
</Button>
}
/>
</MyCenteredContainer>
);
}

View File

@ -9,24 +9,24 @@ import { v4 as uuidv4 } from "uuid";
const wssProtocol = window.location.protocol === "https:" ? "wss://" : "ws://";
let apiAddress = "";
let staticContentAddress = "";
let wsAddress = "";
// let staticContentAddress = "";
// let wsAddress = "";
if (window.location.hostname === "localhost" && window.location.port === "") {
// for docker container testing on localhost
apiAddress = "http://localhost/api/v1";
staticContentAddress = "http://localhost/api/";
wsAddress = "ws://localhost/ws";
// staticContentAddress = "http://localhost/api/";
// wsAddress = "ws://localhost/ws";
} else if (window.location.hostname === "localhost") {
// programming on localhost
apiAddress = "http://localhost:50250/api/v1";
staticContentAddress = "http://localhost:50050/";
wsAddress = "ws://localhost:50050/ws";
apiAddress = "http://localhost:50128/api/v1";
// staticContentAddress = "http://localhost:50050/";
// wsAddress = "ws://localhost:50050/ws";
} else {
// production
apiAddress = `${window.location.protocol}//${window.location.hostname}/api/v1`;
staticContentAddress = `${window.location.protocol}//${window.location.hostname}/api/`;
wsAddress = `${wssProtocol}${window.location.hostname}/ws`;
//staticContentAddress = `${window.location.protocol}//${window.location.hostname}/api/`;
// wsAddress = `${wssProtocol}${window.location.hostname}/ws`;
}
export const Constants = {
@ -37,20 +37,18 @@ export const Constants = {
},
TEXT_EMPTY_PLACEHOLDER: "-/-",
API_ADDRESS: apiAddress,
STATIC_CONTENT_ADDRESS: staticContentAddress,
WS_ADDRESS: wsAddress,
//STATIC_CONTENT_ADDRESS: staticContentAddress,
// WS_ADDRESS: wsAddress,
EMBED_CALENDAR_ADDRESS: "https://calendar.ex.umbach.dev/embed/?id=",
ROUTE_PATHS: {
OVERVIEW: "/",
WEBSITE_COLOR_PALETTE: "/website/color-palette",
WEBSITE_SOCIALS: "/website/socials",
WEBSITE_BANNER: "/website/banner",
STORE: {
SETTINGS: "/store/settings",
EMPLOYEES: "/store/employees",
SERVICES: "/store/services",
CALENDAR: "/store/calendar",
CALENDAR_AUTH: "/store/calendar/auth",
WEBSITE: "/store/website",
},
FEEDBACK: "/feedback",
SUPPORT: "/support",