Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div
image="https://www.independent.ie/incoming/c68fb/34223465.ece/AUTOCROP/w620/Ugly1.jpg"
bot_name="Moishe"
div
bot_greeting="שלום"
bot_name="OFEK"
channel_id="02-WyJjaGFubmVscyIsNjI1NzJd"
fab_bottom="30"
fab_right="30"
height="400"
id="cocobot"
height="600"
width="300"
name="CoCoBot Example"
channel_id="01-eNpLzkjMy0vNKVa2UjYxNLAwBAAvdwTL"
bot_greeting="Hi, my name is Moishe, I'll be your host for this evening"
is_rtl="false"
is_fabless="false"
is_not_showing_last_component="false"
is_open_on_start="false"
is_flat="true"
is_window_on_left="false"
palette='{"overridePoweredBy":true, "fabBackground":"white","windowBackground":"yellow", "divider":"transparent", "headerFontColor":"blue", "headerButtonsColor":"green", "chatBackground":"lime", "userBubble":"cyan", "userBubbleFontColor":"darkred", "botBubble":"white", "botBubbleFontColor":"darkred", "footerBackground":"darkgreen", "footerFontColor":"blue", "footerButton":"pink"}'
is_open_on_start="true"
is_rtl="true"
source_language_code=""
style="position: fixed; right: 0px; bottom: 0px; z-index: 1000"
width="300"
></div>
</body>
</html>
25 changes: 19 additions & 6 deletions frontend/src/chat-window/bubbles/ChatBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ const useBubbleStyles = makeStyles((theme) => {
animation: "$open 250ms linear",
display: "flex",
paddingBottom: theme.spacing(1),
justifyContent: (p: ThemeParams) =>
`${p.isUser ? "flex-end" : "flex-start"}`,
marginRight: (p: ThemeParams) => (p.isUser ? "" : theme.spacing(5)),
marginLeft: (p: ThemeParams) => (!p.isUser ? "" : theme.spacing(5)),
justifyContent: (p: ThemeParams) => {
return p.config.is_rtl
? `${p.isUser ? "flex-start" : "flex-end"}`
: `${p.isUser ? "flex-end" : "flex-start"}`;
},
marginRight: (p: ThemeParams) =>
p.config.is_rtl
? theme.spacing(p.isUser ? 5 : 0)
: theme.spacing(p.isUser ? 0 : 5),
marginLeft: (p: ThemeParams) =>
p.config.is_rtl
? theme.spacing(p.isUser ? 0 : 5)
: theme.spacing(p.isUser ? 5 : 0),
},
bubble: {
padding: theme.spacing(1),
Expand All @@ -44,9 +53,13 @@ const useBubbleStyles = makeStyles((theme) => {
: p.config.palette?.botBubble || theme.custom.palette.a.main
}`,
transformOrigin: (p: ThemeParams) =>
`${p.isUser ? "bottom right" : "bottom left"}`,
p.config.is_rtl
? `${p.isUser ? "bottom left" : "bottom right"}`
: `${p.isUser ? "bottom right" : "bottom left"}`,
borderRadius: (p: ThemeParams) =>
`${p.isUser ? "18px 18px 0px 18px" : "18px 18px 18px 0px"}`,
p.config.is_rtl
? `${p.isUser ? "18px 18px 18px 0px" : "18px 18px 0px 18px"}`
: `${p.isUser ? "18px 18px 0px 18px" : "18px 18px 18px 0px"}`,
color: (p: ThemeParams) =>
`${
p.isUser
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/chat-window/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export const Header: React.FC<{
}> = ({ name, avatar, params, children }) => {
const classes = useStyles(params);
return (
<div className={classes.container}>
<div className={classes.infoContainer}>
<div className={classes.vCenter}>
<div className={classes.imageContainer}>
<div className={classes.container} id="header container">
<div className={classes.infoContainer} id="header info container">
<div className={classes.vCenter} id="header vCenter">
<div className={classes.imageContainer} id="header image container">
<img src={avatar} className={classes.image} />
</div>
</div>
<div className={classes.vCenter}>
<div className={classes.vCenter} id="header text container">
<Typography className={classes.text} variant="body1">
{name}
</Typography>
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ if (target) {
value = v;
} catch (e) {}
}
if (cur === "is_rtl") {
if (value === "true") {
value = true;
} else if (value === "1") {
value = true;
} else value = false;
}
acc[cur] = value;
return acc;
}, {} as { [key: string]: string | boolean | Object }) as unknown as CoCoChatWindowParams;
Expand Down