мобильный чат техподдержки, мелкие правки по дизайну
This commit is contained in:
parent
6efdee13ad
commit
6eebb8491f
@ -74,6 +74,7 @@ export default function MyQuizzesFull({
|
|||||||
flexWrap: "wrap",
|
flexWrap: "wrap",
|
||||||
gap: "40px",
|
gap: "40px",
|
||||||
mb: "60px",
|
mb: "60px",
|
||||||
|
width: isMobile ? "100%" : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{quizes.map((quiz) => {
|
{quizes.map((quiz) => {
|
||||||
|
@ -75,7 +75,7 @@ export default function QuizCard({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
width: "560px",
|
width: isMobile ? "100%" : "560px",
|
||||||
height: "280px",
|
height: "280px",
|
||||||
p: "20px",
|
p: "20px",
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
|
@ -34,14 +34,17 @@ import {
|
|||||||
createTicket,
|
createTicket,
|
||||||
} from "@frontend/kitui";
|
} from "@frontend/kitui";
|
||||||
import { sendTicketMessage } from "../../api/ticket";
|
import { sendTicketMessage } from "../../api/ticket";
|
||||||
|
import ArrowLeft from "@icons/questionsPage/arrowLeft";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
sx?: SxProps<Theme>;
|
sx?: SxProps<Theme>;
|
||||||
|
onclickArrow?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Chat({ sx }: Props) {
|
export default function Chat({ sx, onclickArrow }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down(800));
|
||||||
const [messageField, setMessageField] = useState<string>("");
|
const [messageField, setMessageField] = useState<string>("");
|
||||||
const sessionData = useUnauthTicketStore((state) => state.sessionData);
|
const sessionData = useUnauthTicketStore((state) => state.sessionData);
|
||||||
const messages = useUnauthTicketStore((state) => state.messages);
|
const messages = useUnauthTicketStore((state) => state.messages);
|
||||||
@ -195,7 +198,7 @@ export default function Chat({ sx }: Props) {
|
|||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
height: "clamp(250px, calc(100vh - 90px), 600px)",
|
height: isMobile ? "100%" : "clamp(250px, calc(100vh - 90px), 600px)",
|
||||||
backgroundColor: "#944FEE",
|
backgroundColor: "#944FEE",
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
...sx,
|
...sx,
|
||||||
@ -204,6 +207,7 @@ export default function Chat({ sx }: Props) {
|
|||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
gap: "9px",
|
gap: "9px",
|
||||||
pl: "22px",
|
pl: "22px",
|
||||||
pt: "12px",
|
pt: "12px",
|
||||||
@ -211,6 +215,11 @@ export default function Chat({ sx }: Props) {
|
|||||||
filter: "drop-shadow(0px 3px 12px rgba(37, 39, 52, 0.3))",
|
filter: "drop-shadow(0px 3px 12px rgba(37, 39, 52, 0.3))",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{isMobile && (
|
||||||
|
<IconButton onClick={onclickArrow}>
|
||||||
|
<ArrowLeft color="white" />
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
<UserCircleIcon />
|
<UserCircleIcon />
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
import { Box, Fab, useTheme, useMediaQuery } from "@mui/material";
|
import {
|
||||||
import { useState } from "react";
|
Box,
|
||||||
|
Fab,
|
||||||
|
useTheme,
|
||||||
|
useMediaQuery,
|
||||||
|
Slide,
|
||||||
|
Dialog,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { ReactNode, useState } from "react";
|
||||||
import CircleDoubleDown from "./QuestionIcon";
|
import CircleDoubleDown from "./QuestionIcon";
|
||||||
|
import * as React from "react";
|
||||||
import Chat from "./Chat";
|
import Chat from "./Chat";
|
||||||
|
import { TransitionProps } from "@mui/material/transitions";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
const animation = {
|
const animation = {
|
||||||
"@keyframes runningStripe": {
|
"@keyframes runningStripe": {
|
||||||
@ -14,27 +23,54 @@ const animation = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Transition = React.forwardRef(function Transition(
|
||||||
|
props: TransitionProps & {
|
||||||
|
children: ReactNode;
|
||||||
|
},
|
||||||
|
ref: React.Ref<unknown>,
|
||||||
|
) {
|
||||||
|
return <Slide direction="up" ref={ref} {...props} />;
|
||||||
|
});
|
||||||
|
|
||||||
export default function FloatingSupportChat() {
|
export default function FloatingSupportChat() {
|
||||||
const [isChatOpened, setIsChatOpened] = useState<boolean>(false);
|
const [isChatOpened, setIsChatOpened] = useState<boolean>(false);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(800));
|
const isMobile = useMediaQuery(theme.breakpoints.down(800));
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const location = useLocation();
|
||||||
|
const locationChat = location.pathname;
|
||||||
|
|
||||||
|
const handleClickOpen = () => {
|
||||||
|
setOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setOpen(false);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
right: "20px",
|
right: "20px",
|
||||||
bottom: "100px",
|
bottom: locationChat !== "/edit" ? "10px" : "100px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
gap: "8px",
|
gap: "8px",
|
||||||
width: "clamp(200px, 100% - 40px, 454px)",
|
width: isChatOpened ? "clamp(200px, 100% - 40px, 454px)" : "64px",
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isChatOpened && (
|
{isChatOpened && (
|
||||||
<Chat sx={{ alignSelf: "start", width: "clamp(200px, 100%, 400px)" }} />
|
<Chat sx={{ alignSelf: "start", width: "clamp(200px, 100%, 400px)" }} />
|
||||||
)}
|
)}
|
||||||
|
<Dialog
|
||||||
|
fullScreen
|
||||||
|
open={open}
|
||||||
|
onClose={handleClose}
|
||||||
|
TransitionComponent={Transition}
|
||||||
|
>
|
||||||
|
<Chat onclickArrow={handleClose} />
|
||||||
|
</Dialog>
|
||||||
<Fab
|
<Fab
|
||||||
disableRipple
|
disableRipple
|
||||||
sx={{
|
sx={{
|
||||||
@ -52,7 +88,13 @@ export default function FloatingSupportChat() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
variant={"extended"}
|
variant={"extended"}
|
||||||
onClick={() => setIsChatOpened((prev) => !prev)}
|
onClick={() => {
|
||||||
|
if (isMobile) {
|
||||||
|
setOpen(true);
|
||||||
|
} else {
|
||||||
|
setIsChatOpened((prev) => !prev);
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{!isChatOpened && (
|
{!isChatOpened && (
|
||||||
<Box
|
<Box
|
||||||
|
Loading…
Reference in New Issue
Block a user