account demo
parent
5b0f168eee
commit
a819ab52bb
|
@ -21,6 +21,7 @@
|
||||||
"minutes": "Minuten",
|
"minutes": "Minuten",
|
||||||
"minute": "Minute",
|
"minute": "Minute",
|
||||||
"days": "Tage",
|
"days": "Tage",
|
||||||
|
"day": "Tag",
|
||||||
"separator": "und"
|
"separator": "und"
|
||||||
},
|
},
|
||||||
"failed": "Fehlgeschlagen",
|
"failed": "Fehlgeschlagen",
|
||||||
|
@ -117,7 +118,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support": "Unterstützung",
|
"support": "Unterstützung",
|
||||||
"feedback": "Feedback"
|
"feedback": "Feedback",
|
||||||
|
"accountPlan": {
|
||||||
|
"infoDaysLeft": "{{daysLeft}} {{dayUnit}} verbleibend",
|
||||||
|
"buttonExtend": "Plan verlängern",
|
||||||
|
"buttonManage": "Plan verwalten"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"employees": {
|
"employees": {
|
||||||
"pageTitle": "Mitarbeiter",
|
"pageTitle": "Mitarbeiter",
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"minutes": "minutes",
|
"minutes": "minutes",
|
||||||
"minute": "minute",
|
"minute": "minute",
|
||||||
"days": "Days",
|
"days": "Days",
|
||||||
|
"day": "Day",
|
||||||
"separator": "and"
|
"separator": "and"
|
||||||
},
|
},
|
||||||
"failed": "Failed",
|
"failed": "Failed",
|
||||||
|
@ -117,7 +118,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support": "Support",
|
"support": "Support",
|
||||||
"feedback": "Feedback"
|
"feedback": "Feedback",
|
||||||
|
"accountPlan": {
|
||||||
|
"infoDaysLeft": "{{daysLeft}} {{dayUnit}} left",
|
||||||
|
"buttonExtend": "Extend plan",
|
||||||
|
"buttonManage": "Manage plan"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"employees": {
|
"employees": {
|
||||||
"pageTitle": "Employees",
|
"pageTitle": "Employees",
|
||||||
|
|
|
@ -120,6 +120,10 @@ export default function App() {
|
||||||
options={{
|
options={{
|
||||||
username: appUserData.user.username,
|
username: appUserData.user.username,
|
||||||
permissions: appUserData.permissions,
|
permissions: appUserData.permissions,
|
||||||
|
accountPlanExpiry:
|
||||||
|
appUserData.user.account_plan_expiry === null
|
||||||
|
? undefined
|
||||||
|
: appUserData.user.account_plan_expiry,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UserProfileProvider>
|
<UserProfileProvider>
|
||||||
|
|
|
@ -105,15 +105,6 @@ export function AppRoutes({ setUserSession }) {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
|
||||||
path={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/:storeId/${Constants.ROUTE_PATHS.STORE.WEBSITE}`}
|
|
||||||
element={
|
|
||||||
<MySupsenseFallback>
|
|
||||||
<StoreWebsite />
|
|
||||||
</MySupsenseFallback>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{isDevelopmentEnv() && (
|
{isDevelopmentEnv() && (
|
||||||
<>
|
<>
|
||||||
<Route
|
<Route
|
||||||
|
@ -156,3 +147,14 @@ export function AppRoutes({ setUserSession }) {
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
<Route
|
||||||
|
path={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/:storeId/${Constants.ROUTE_PATHS.STORE.WEBSITE}`}
|
||||||
|
element={
|
||||||
|
<MySupsenseFallback>
|
||||||
|
<StoreWebsite />
|
||||||
|
</MySupsenseFallback>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
CalendarOutlined,
|
CalendarOutlined,
|
||||||
EditOutlined,
|
|
||||||
MessageOutlined,
|
MessageOutlined,
|
||||||
QuestionCircleOutlined,
|
QuestionCircleOutlined,
|
||||||
ScissorOutlined,
|
ScissorOutlined,
|
||||||
|
@ -10,7 +9,7 @@ import {
|
||||||
TeamOutlined,
|
TeamOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Divider, Menu } from "antd";
|
import { Button, Card, Divider, Flex, Menu, Typography } from "antd";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
import { BreakpointLgWidth, Constants, isDevelopmentEnv } from "../../utils";
|
import { BreakpointLgWidth, Constants, isDevelopmentEnv } from "../../utils";
|
||||||
|
@ -92,7 +91,7 @@ export function SideMenuContent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
/*if (
|
||||||
isDevelopmentEnv() &&
|
isDevelopmentEnv() &&
|
||||||
sideBarContext.permissions.includes("website")
|
sideBarContext.permissions.includes("website")
|
||||||
) {
|
) {
|
||||||
|
@ -101,7 +100,7 @@ export function SideMenuContent({
|
||||||
icon: <EditOutlined />,
|
icon: <EditOutlined />,
|
||||||
key: `${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${store.store_id}/${Constants.ROUTE_PATHS.STORE.WEBSITE}`,
|
key: `${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${store.store_id}/${Constants.ROUTE_PATHS.STORE.WEBSITE}`,
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
stores.children.push(groupStore);
|
stores.children.push(groupStore);
|
||||||
});
|
});
|
||||||
|
@ -165,6 +164,17 @@ export function SideMenuContent({
|
||||||
}
|
}
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
|
const calculateExpiry = () => {
|
||||||
|
const currentDate = new Date();
|
||||||
|
const expiryDate = new Date(sideBarContext.accountPlanExpiry);
|
||||||
|
const diffTime = Math.abs(expiryDate - currentDate);
|
||||||
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
|
return diffDays;
|
||||||
|
};
|
||||||
|
|
||||||
|
const accountPlanExpiry = calculateExpiry();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -219,6 +229,33 @@ export function SideMenuContent({
|
||||||
<div>
|
<div>
|
||||||
<Divider style={{ margin: 0 }} />
|
<Divider style={{ margin: 0 }} />
|
||||||
|
|
||||||
|
{sideBarContext.accountPlanExpiry !== undefined &&
|
||||||
|
accountPlanExpiry > 0 && (
|
||||||
|
<Card
|
||||||
|
style={{ backgroundColor: "#6878d6", margin: 8 }}
|
||||||
|
bodyStyle={{ padding: 10 }}
|
||||||
|
>
|
||||||
|
<Flex justify="center" align="center">
|
||||||
|
<Typography.Title
|
||||||
|
level={5}
|
||||||
|
style={{ color: "#fff", textAlign: "center" }}
|
||||||
|
>
|
||||||
|
{t("sideMenu.accountPlan.infoDaysLeft", {
|
||||||
|
daysLeft: accountPlanExpiry,
|
||||||
|
dayUnit:
|
||||||
|
accountPlanExpiry > 1
|
||||||
|
? t("common.unit.days")
|
||||||
|
: t("common.unit.day"),
|
||||||
|
})}
|
||||||
|
</Typography.Title>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Button block style={{ fontWeight: "bold", fontSize: 13 }}>
|
||||||
|
{t("sideMenu.accountPlan.buttonExtend")}
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
selectable={true}
|
selectable={true}
|
||||||
selectedKeys={[selectedKeys]}
|
selectedKeys={[selectedKeys]}
|
||||||
|
|
|
@ -5,6 +5,8 @@ const preview = {
|
||||||
setUsername: () => {},
|
setUsername: () => {},
|
||||||
permissions: [],
|
permissions: [],
|
||||||
setPermissions: () => {},
|
setPermissions: () => {},
|
||||||
|
accountPlanExpiry: "",
|
||||||
|
setAccountPlanExpiry: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SideBarContext = createContext(preview);
|
const SideBarContext = createContext(preview);
|
||||||
|
@ -14,6 +16,9 @@ export const useSideBarContext = () => useContext(SideBarContext);
|
||||||
export default function SideBarProvider({ children, options }) {
|
export default function SideBarProvider({ children, options }) {
|
||||||
const [username, setUsername] = useState(options.username);
|
const [username, setUsername] = useState(options.username);
|
||||||
const [permissions, setPermissions] = useState(options.permissions);
|
const [permissions, setPermissions] = useState(options.permissions);
|
||||||
|
const [accountPlanExpiry, setAccountPlanExpiry] = useState(
|
||||||
|
options.accountPlanExpiry
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SideBarContext.Provider
|
<SideBarContext.Provider
|
||||||
|
@ -22,6 +27,8 @@ export default function SideBarProvider({ children, options }) {
|
||||||
setUsername,
|
setUsername,
|
||||||
permissions,
|
permissions,
|
||||||
setPermissions,
|
setPermissions,
|
||||||
|
accountPlanExpiry,
|
||||||
|
setAccountPlanExpiry,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
import { Card, Col, Row, Statistic } from "antd";
|
import PageInDevelopment from "../PageInDevelopment";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
return (
|
return <PageInDevelopment showBackButton={false} />;
|
||||||
<Row gutter={[16, 16]}>
|
|
||||||
<Col>
|
|
||||||
<Card>
|
|
||||||
<Statistic title="Aktueller Plan" value="Free" />
|
|
||||||
</Card>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Constants } from "../../utils";
|
import { Constants } from "../../utils";
|
||||||
|
|
||||||
export default function PageInDevelopment() {
|
export default function PageInDevelopment({ showBackButton = true }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -12,9 +12,11 @@ export default function PageInDevelopment() {
|
||||||
title={t("pageInDevelopment.title")}
|
title={t("pageInDevelopment.title")}
|
||||||
subTitle={t("pageInDevelopment.subTitle")}
|
subTitle={t("pageInDevelopment.subTitle")}
|
||||||
extra={
|
extra={
|
||||||
<Link to={Constants.ROUTE_PATHS.OVERVIEW}>
|
showBackButton && (
|
||||||
<Button type="primary">{t("pageNotFound.buttonBackHome")}</Button>
|
<Link to={Constants.ROUTE_PATHS.OVERVIEW}>
|
||||||
</Link>
|
<Button type="primary">{t("pageNotFound.buttonBackHome")}</Button>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue