Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoodWhizz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avanish Singh
FoodWhizz
Commits
3ca4222a
Unverified
Commit
3ca4222a
authored
1 year ago
by
Avanish Singh
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add files via upload
parent
fc26f64f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend-react/src/components/ChatbotComponent.js
+20
-19
20 additions, 19 deletions
frontend-react/src/components/ChatbotComponent.js
with
20 additions
and
19 deletions
frontend-react/src/components/ChatbotComponent.js
+
20
−
19
View file @
3ca4222a
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
"
../styles/style.css
"
;
import
Header
from
"
./Header
"
;
import
Input
Area
from
"
./InputSection
"
;
import
Message
Area
from
"
./MessageSection
"
;
import
Input
Section
from
"
./InputSection
"
;
import
Message
Section
from
"
./MessageSection
"
;
import
Sidebar
from
"
./Sidebar
"
;
import
io
from
'
socket.io-client
'
;
import
RightMessage
from
"
./RightMessage
"
;
import
LeftMessage
from
"
./LeftMessage
"
;
import
TextMessage
from
"
./TextMessage
"
;
const
socket
=
io
();
const
ChatbotComponent
=
()
=>
{
...
...
@@ -16,27 +15,29 @@ const ChatbotComponent = () => {
])
const
[
theme
,
setTheme
]
=
useState
(
'
light
'
);
const
[
area
,
setArea
]
=
useState
(
'
msg_
area
'
);
const
[
area
,
setArea
]
=
useState
(
'
msg_
section
'
);
const
[
update
,
setUpdate
]
=
useState
(
"
reload.png
"
);
const
greetingMessage
=
{
info
:
"
Hey, Welcome to FoodWhizz,
w
hat would you like to have today? Say Hey to start...
"
,
info
:
"
Hey, Welcome to FoodWhizz,
W
hat would you like to have today? Say Hey to start...
"
,
date
:
getCurrentTime
(),
type
:
"
left
"
,
name
:
"
FoodWhizz
"
};
useEffect
(()
=>
{
// eslint-disable-next-line react-hooks/exhaustive-deps
setMessages
([
greetingMessage
]);
},
[]);
},
[]);
// Function to handle theme button click
function
handleThemeButtonClick
(){
const
head
=
document
.
getElementById
(
"
head
"
);
const
input
=
document
.
getElementById
(
"
input
"
);
const
input_
area
=
document
.
getElementById
(
"
input_
area
"
);
const
input_
section
=
document
.
getElementById
(
"
input_
section
"
);
const
container
=
document
.
getElementById
(
"
container
"
);
const
body
=
document
.
getElementsByTagName
(
"
body
"
)[
0
];
const
bar
=
document
.
getElementById
(
"
sidebar
"
);
...
...
@@ -44,15 +45,15 @@ const ChatbotComponent = () => {
if
(
theme
===
'
light
'
){
setTheme
(
'
dark
'
);
setUpdate
(
"
https://upload.wikimedia.org/wikipedia/commons/3/38/Solid_white_bordered.png
"
);
setArea
(
'
msg_
area
black
'
);
setArea
(
'
msg_
section
black
'
);
head
.
style
.
background
=
'
#010507
'
;
head
.
style
.
color
=
'
#fd8d00
'
;
head
.
style
.
borderBottom
=
'
3px solid black
'
;
input
.
style
.
background
=
'
#010507
'
;
input
.
style
.
borderTop
=
'
3px solid black
'
;
input_
area
.
style
.
background
=
'
black
'
;
input_
area
.
style
.
color
=
'
white
'
;
input_
area
.
classList
.
toggle
(
"
placeholder-white
"
);
input_
section
.
style
.
background
=
'
black
'
;
input_
section
.
style
.
color
=
'
white
'
;
input_
section
.
classList
.
toggle
(
"
placeholder-white
"
);
body
.
style
.
background
=
(
"
recipe1.jpeg
"
);
container
.
style
.
border
=
'
3px solid black
'
;
container
.
style
.
backgroundColor
=
'
#010507
'
;
...
...
@@ -62,15 +63,15 @@ const ChatbotComponent = () => {
else
{
setTheme
(
'
light
'
);
setUpdate
(
"
reload.png
"
);
setArea
(
'
msg_
area
'
);
setArea
(
'
msg_
section
'
);
head
.
style
.
background
=
'
#d0d0d0
'
;
head
.
style
.
color
=
'
#5b5b5b
'
;
head
.
style
.
borderBottom
=
'
3px solid white
'
;
input
.
style
.
background
=
'
#d0d0d0
'
;
input
.
style
.
borderTop
=
'
3px solid white
'
;
input_
area
.
style
.
background
=
'
white
'
;
input_
area
.
style
.
color
=
'
#5b5b5b
'
;
input_
area
.
classList
.
remove
(
"
placeholder-white
"
);
input_
section
.
style
.
background
=
'
white
'
;
input_
section
.
style
.
color
=
'
#5b5b5b
'
;
input_
section
.
classList
.
remove
(
"
placeholder-white
"
);
body
.
style
.
background
=
(
"
recipe.jpeg
"
);
container
.
style
.
border
=
'
3px solid white
'
;
container
.
style
.
backgroundColor
=
'
#d0d0d0
'
;
...
...
@@ -129,8 +130,8 @@ const ChatbotComponent = () => {
<
Sidebar
themeButtonClick
=
{
handleThemeButtonClick
}
/
>
<
div
className
=
"
main
"
id
=
"
container
"
>
<
Header
update
=
{
Update
}
button
=
{
update
}
/
>
<
Message
Area
messages
=
{
messages
}
area
=
{
area
}
/
>
<
Input
Area
send_button
=
{
addMessage
}
/
>
<
Message
Section
messages
=
{
messages
}
area
=
{
area
}
/
>
<
Input
Section
send_button
=
{
addMessage
}
/
>
<
/div
>
<
footer
>&
copy
;
Copyright
2024
<
/footer
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment