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": { "sideMenu": {
"overview": "Übersicht", "overview": "Übersicht",
"website": {
"title": "Website",
"colorPalette": "Farbpalette",
"banner": "Banner",
"socials": "Soziale Netzwerke"
},
"store": { "store": {
"titleSingular": "Geschäft", "titleSingular": "Geschäft",
"titlePlural": "Geschäfte", "titlePlural": "Geschäfte",
"settings": "Einstellungen", "settings": "Einstellungen",
"employees": "Mitarbeiter", "employees": "Mitarbeiter",
"services": "Dienstleistungen", "services": "Dienstleistungen",
"calendar": "Kalender" "calendar": "Kalender",
"website": {
"title": "Website",
"colorPalette": "Farbpalette",
"banner": "Banner",
"socials": "Soziale Netzwerke"
}
}, },
"support": "Unterstützung", "support": "Unterstützung",
"feedback": "Feedback" "feedback": "Feedback"
@ -182,5 +182,12 @@
}, },
"storeSettings": { "storeSettings": {
"pageTitle": "Einstellungen" "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": { "sideMenu": {
"overview": "Overview", "overview": "Overview",
"website": {
"title": "Website",
"colorPalette": "Color palette",
"banner": "Banner",
"socials": "Socials"
},
"store": { "store": {
"titleSingular": "Store", "titleSingular": "Store",
"titlePlural": "Stores", "titlePlural": "Stores",
"settings": "Settings", "settings": "Settings",
"employees": "Employees", "employees": "Employees",
"services": "Services", "services": "Services",
"calendar": "Calendar" "calendar": "Calendar",
"website": {
"title": "Website",
"colorPalette": "Color palette",
"banner": "Banner",
"socials": "Socials"
}
}, },
"support": "Support", "support": "Support",
"feedback": "Feedback" "feedback": "Feedback"
@ -185,5 +185,12 @@
}, },
"storeSettings": { "storeSettings": {
"pageTitle": "Settings" "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 StoreServices = lazy(() => import("../../Pages/Store/Services"));
const StoreCalendar = lazy(() => import("../../Pages/Store/Calendar")); const StoreCalendar = lazy(() => import("../../Pages/Store/Calendar"));
const StoreCalendarAuth = lazy(() => import("../../Pages/Store/Calendar/Auth")); const StoreCalendarAuth = lazy(() => import("../../Pages/Store/Calendar/Auth"));
const StoreWebsite = lazy(() => import("../../Pages/Store/Website"));
//const Support = lazy(() => import("../../Pages/Support")); //const Support = lazy(() => import("../../Pages/Support"));
//const Feedback = lazy(() => import("../../Pages/Feedback")); //const Feedback = lazy(() => import("../../Pages/Feedback"));
const UserProfile = lazy(() => import("../../Pages/UserProfile")); 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 <Route
path={Constants.ROUTE_PATHS.SUPPORT} path={Constants.ROUTE_PATHS.SUPPORT}
element={ element={

View File

@ -43,6 +43,7 @@ export function SideMenuContent({
}, },
]; ];
/*
// website // website
let websites = { let websites = {
@ -79,7 +80,7 @@ export function SideMenuContent({
websites.children.push(groupWebsite); websites.children.push(groupWebsite);
items.push(websites); items.push(websites); */
// stores // 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); stores.children.push(groupStore);
}); });

View File

@ -1,16 +1,13 @@
import { import {
Button, Button,
Card, Card,
Checkbox,
Col, Col,
Form, Form,
Popconfirm,
Result, Result,
Row, Row,
Space, Space,
Spin, Spin,
Switch, Switch,
Typography,
} from "antd"; } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
@ -19,7 +16,7 @@ import {
getUserSessionFromLocalStorage, getUserSessionFromLocalStorage,
myFetch, myFetch,
} from "../../../utils"; } from "../../../utils";
import { Suspense, useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer"; import MyCenteredContainer from "../../../Components/MyContainer";
import { import {
MyCalendarMaxFutureBookingDaysFormInput, MyCalendarMaxFutureBookingDaysFormInput,
@ -32,7 +29,6 @@ import {
} from "../../../Components/MyRequestStateItem"; } from "../../../Components/MyRequestStateItem";
import MyModal, { import MyModal, {
MyModalCloseConfirmButtonFooter, MyModalCloseConfirmButtonFooter,
MyModalCloseSaveButtonFooter,
} from "../../../Components/MyModal"; } from "../../../Components/MyModal";
import { useParams } from "react-router-dom"; 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://"; const wssProtocol = window.location.protocol === "https:" ? "wss://" : "ws://";
let apiAddress = ""; let apiAddress = "";
let staticContentAddress = ""; // let staticContentAddress = "";
let wsAddress = ""; // let wsAddress = "";
if (window.location.hostname === "localhost" && window.location.port === "") { if (window.location.hostname === "localhost" && window.location.port === "") {
// for docker container testing on localhost // for docker container testing on localhost
apiAddress = "http://localhost/api/v1"; apiAddress = "http://localhost/api/v1";
staticContentAddress = "http://localhost/api/"; // staticContentAddress = "http://localhost/api/";
wsAddress = "ws://localhost/ws"; // wsAddress = "ws://localhost/ws";
} else if (window.location.hostname === "localhost") { } else if (window.location.hostname === "localhost") {
// programming on localhost // programming on localhost
apiAddress = "http://localhost:50250/api/v1"; apiAddress = "http://localhost:50128/api/v1";
staticContentAddress = "http://localhost:50050/"; // staticContentAddress = "http://localhost:50050/";
wsAddress = "ws://localhost:50050/ws"; // wsAddress = "ws://localhost:50050/ws";
} else { } else {
// production // production
apiAddress = `${window.location.protocol}//${window.location.hostname}/api/v1`; apiAddress = `${window.location.protocol}//${window.location.hostname}/api/v1`;
staticContentAddress = `${window.location.protocol}//${window.location.hostname}/api/`; //staticContentAddress = `${window.location.protocol}//${window.location.hostname}/api/`;
wsAddress = `${wssProtocol}${window.location.hostname}/ws`; // wsAddress = `${wssProtocol}${window.location.hostname}/ws`;
} }
export const Constants = { export const Constants = {
@ -37,20 +37,18 @@ export const Constants = {
}, },
TEXT_EMPTY_PLACEHOLDER: "-/-", TEXT_EMPTY_PLACEHOLDER: "-/-",
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=", EMBED_CALENDAR_ADDRESS: "https://calendar.ex.umbach.dev/embed/?id=",
ROUTE_PATHS: { ROUTE_PATHS: {
OVERVIEW: "/", OVERVIEW: "/",
WEBSITE_COLOR_PALETTE: "/website/color-palette",
WEBSITE_SOCIALS: "/website/socials",
WEBSITE_BANNER: "/website/banner",
STORE: { STORE: {
SETTINGS: "/store/settings", SETTINGS: "/store/settings",
EMPLOYEES: "/store/employees", EMPLOYEES: "/store/employees",
SERVICES: "/store/services", SERVICES: "/store/services",
CALENDAR: "/store/calendar", CALENDAR: "/store/calendar",
CALENDAR_AUTH: "/store/calendar/auth", CALENDAR_AUTH: "/store/calendar/auth",
WEBSITE: "/store/website",
}, },
FEEDBACK: "/feedback", FEEDBACK: "/feedback",
SUPPORT: "/support", SUPPORT: "/support",