This commit is contained in:
IlyaDoronin 2024-01-16 15:28:30 +03:00
parent b3a2e3be94
commit 33e279a443
4 changed files with 60 additions and 52 deletions

@ -68,13 +68,13 @@ export default function Component() {
</Box>
<Button
component={Link}
to={"/signin"}
state={{ backgroundLocation: location }}
variant="contained"
>
Попробуйте бесплатно
</Button>
component={Link}
to={"/signin"}
state={{ backgroundLocation: location }}
variant="contained"
>
Попробуйте бесплатно
</Button>
<Box
component={"img"}

@ -1,19 +1,18 @@
import { Tab } from "@mui/material"
import { styled } from "@mui/material"
import { Tab } from "@mui/material";
import { styled } from "@mui/material";
export const CustomTab = styled(Tab)(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.primary.main,
padding: "15px",
minWidth: 0,
"&.Mui-selected": {
color: "#7e2aea",
textUnderlinePosition: "under",
textDecoration: "underline",
textUnderlineOffset: "3px",
},
"&:first-of-type": {
paddingLeft: 0,
}
}))
...theme.typography.body2,
color: theme.palette.primary.main,
padding: "15px",
minWidth: 0,
"&.Mui-selected": {
color: "#7e2aea",
textUnderlinePosition: "under",
textDecoration: "underline",
textUnderlineOffset: "3px",
},
"&:first-of-type": {
paddingLeft: 0,
},
}));

@ -1,5 +1,5 @@
import { Tabs as MuiTabs } from "@mui/material"
import { CustomTab } from "./CustomTab"
import { Tabs as MuiTabs } from "@mui/material";
import { CustomTab } from "./CustomTab";
type TabsProps = {
names: string[];
@ -8,20 +8,25 @@ type TabsProps = {
setSelectedItem: (num: "count" | "day") => void;
};
export const Tabs = ({ items, names, selectedItem, setSelectedItem }: TabsProps) => (
<MuiTabs
sx={{m:"25px"}}
TabIndicatorProps={{ sx: { display: "none" } }}
value={selectedItem}
onChange={(event, newValue: "count" | "day") => {
console.log(newValue)
setSelectedItem(newValue)
}}
variant="scrollable"
scrollButtons={false}
>
{items.map((item, index) => (
<CustomTab key={item + index} value={item} label={names[index]} />
))}
</MuiTabs>
)
export const Tabs = ({
items,
names,
selectedItem,
setSelectedItem,
}: TabsProps) => (
<MuiTabs
sx={{ m: "25px" }}
TabIndicatorProps={{ sx: { display: "none" } }}
value={selectedItem}
onChange={(event, newValue: "count" | "day") => {
console.log(newValue);
setSelectedItem(newValue);
}}
variant="scrollable"
scrollButtons={false}
>
{items.map((item, index) => (
<CustomTab key={item + index} value={item} label={names[index]} />
))}
</MuiTabs>
);

@ -67,12 +67,12 @@ function TariffPage() {
method: "GET",
url: `https://squiz.pena.digital/strator/tariff?page=${page}&limit=100`,
});
console.log(page)
console.log(page);
tariffsList.push(...tariffsResult.tariffs);
}
console.log("это то что мы отдаём перед концом",tariffsList)
console.log("это то что мы отдаём перед концом", tariffsList);
return tariffsList;
};
@ -88,7 +88,7 @@ function TariffPage() {
url: "https://squiz.pena.digital/price/discounts",
});
setUser(user);
console.log("это то что мы получили в самом конце",tariffsList)
console.log("это то что мы получили в самом конце", tariffsList);
setTariffs(tariffsList);
setDiscounts(discounts.Discounts);
let c = currencyFormatter.format(Number(user.wallet.cash) / 100);
@ -140,7 +140,7 @@ function TariffPage() {
const purchasesAmount = user?.wallet.purchasesAmount ?? 0;
const isUserNko = user?.status === "nko";
console.log(tariffs)
console.log(tariffs);
const filteredTariffs = tariffs.filter((tariff) => {
return (
tariff.privileges[0].serviceKey === "squiz" &&
@ -149,7 +149,7 @@ function TariffPage() {
tariff.privileges[0]?.type === selectedItem
);
});
console.log(filteredTariffs)
console.log(filteredTariffs);
async function handleLogoutClick() {
const [, logoutError] = await logout();
@ -209,8 +209,12 @@ function TariffPage() {
/>
</Box>
</Container>
<Tabs names={Object.values(StepperText)} items={Object.keys(StepperText)} selectedItem={selectedItem} setSelectedItem={setSelectedItem} />
<Tabs
names={Object.values(StepperText)}
items={Object.keys(StepperText)}
selectedItem={selectedItem}
setSelectedItem={setSelectedItem}
/>
<Box
sx={{