fl more info

This commit is contained in:
Nastya 2024-04-13 02:42:30 +03:00
parent cf169c0d58
commit 541dc1610e
2 changed files with 37 additions and 15 deletions

@ -30,6 +30,8 @@ export type GetPromocodeListBody = {
export type Promocode = CreatePromocodeBody & { export type Promocode = CreatePromocodeBody & {
id: string; id: string;
dueTo: number;
activationLimit: number;
outdated: boolean; outdated: boolean;
offLimit: boolean; offLimit: boolean;
delete: boolean; delete: boolean;

@ -53,8 +53,7 @@ const COLUMNS: GridColDef<Row, string>[] = [
<IconButton <IconButton
onClick={() => onClick={() =>
navigator.clipboard.writeText( navigator.clipboard.writeText(
`https://${isTest ? "s" : ""}hub.pena.digital/?fl=${ `https://${isTest ? "s" : ""}hub.pena.digital/?fl=${params.row.link
params.row.link
}` }`
) )
} }
@ -108,10 +107,11 @@ export const StatisticsModal = ({
const { privileges } = usePrivilegeStore(); const { privileges } = usePrivilegeStore();
const currentPrivilegeId = promocodes.find((promocode) => promocode.id === id) const currentPrivilegeId = promocodes.find((promocode) => promocode.id === id)
?.bonus.privilege.privilegeID; ?.bonus.privilege.privilegeID;
const privilegeName = const privilege =
privileges.find((item) => item.privilegeId === currentPrivilegeId)?.name ?? privileges.find((item) => item.privilegeId === currentPrivilegeId);
"Нет привилегии"; const promocode =
promocodes.find((item) => item.id === id);
console.log(promocode)
const createFastlink = async () => { const createFastlink = async () => {
await createFastLink(id); await createFastLink(id);
@ -298,15 +298,35 @@ export const StatisticsModal = ({
rowsPerPageOptions={[10, 25, 50, 100]} rowsPerPageOptions={[10, 25, 50, 100]}
autoHeight autoHeight
/> />
<Typography {
sx={{ privilege === undefined ?
margin: "10px 0 0",
textAlign: "center", <Typography
color: theme.palette.secondary.main, sx={{
}} margin: "10px 0 0",
> textAlign: "center",
{privilegeName} color: theme.palette.secondary.main,
</Typography> }}
>
Нет привилегии
</Typography>
:
<Box
sx={{
color: "#e6e8ec",
display: "flex",
flexDirection: "column",
margin: "20px 0",
}}
>
<Typography>название привилегии: {privilege.name}</Typography>
<Typography>{promocode?.activationCount} активаций из {promocode?.activationLimit}</Typography>
<Typography>приветствие: "{promocode?.greetings}"</Typography>
{promocode?.bonus?.discount?.factor !== undefined && <Typography>скидка: {100 - (promocode?.bonus?.discount?.factor * 100)}%</Typography>}
{<Typography>количество привилегии: {promocode?.bonus?.privilege?.amount}</Typography>}
{promocode?.dueTo !== undefined && promocode.dueTo > 0 && <Typography>действует до: {new Date(promocode.dueTo).toLocaleString()}</Typography>}
</Box>
}
</Box> </Box>
</Modal> </Modal>
); );