Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
ca8f7144
Commit
ca8f7144
authored
Feb 13, 2026
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the chatbot
parent
bb332c15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
230 additions
and
9 deletions
+230
-9
layout.tsx
src/app/(dashboard)/(user)/(outsideAuth)/layout.tsx
+2
-0
ChatbotIcon.tsx
src/components/atom/ChatbotIcon.tsx
+55
-0
InputFile.tsx
src/components/atom/InputFile.tsx
+0
-0
Chatbot.tsx
...nents/pages/dashboard/adminDashboard/settings/Chatbot.tsx
+130
-0
index.tsx
...ponents/pages/dashboard/adminDashboard/settings/index.tsx
+6
-4
settingApi.ts
src/services/settingApi.ts
+28
-5
setting.ts
src/types/setting.ts
+9
-0
No files found.
src/app/(dashboard)/(user)/(outsideAuth)/layout.tsx
View file @
ca8f7144
"use client"
;
import
Chatbot
from
'@/components/atom/ChatbotIcon'
;
import
DashboardLayout
from
'@/components/layouts/DashboardLayout'
;
import
AgeVerificationModal
from
'@/components/organism/dialog'
;
import
{
useSearchParams
}
from
'next/navigation'
;
...
...
@@ -20,6 +21,7 @@ function LayoutContent({ children }: { children: React.ReactNode }) {
<
DashboardLayout
>
{
children
}
<
AgeVerificationModal
/>
<
Chatbot
/>
</
DashboardLayout
>
)
}
...
...
src/components/atom/ChatbotIcon.tsx
0 → 100644
View file @
ca8f7144
import
{
useGetChatbotSettingQuery
}
from
'@/services/settingApi'
;
import
{
Button
,
Typography
}
from
'@mui/material'
;
import
Image
from
'next/image'
;
export
default
function
Chatbot
()
{
const
{
data
}
=
useGetChatbotSettingQuery
();
const
fileUrl
=
data
?.
data
?.
chatbot_image_url
;
const
label
=
data
?.
data
?.
chatbot_label
;
const
isVideo
=
fileUrl
?.
toLowerCase
().
endsWith
(
".mp4"
);
return
(
<
Button
className=
"fixed! bottom-2 right-2 lg:bottom-4 lg:right-4 max-w-fit px-8!"
variant=
"contained"
color=
"primary"
fullWidth
LinkComponent=
{
"a"
}
href=
{
data
?.
data
?.
chatbot_link
||
""
}
target=
'_black'
sx=
{
{
justifyContent
:
"start"
}
}
>
<
div
className=
" w-full flex! justify-start! items-center! gap-4"
>
{
fileUrl
&&
(
isVideo
?
(
<
video
autoPlay
loop
muted
playsInline
className=
"w-11 h-11 rounded-full object-cover"
>
<
source
src=
{
fileUrl
}
type=
"video/mp4"
/>
</
video
>
)
:
(
<
Image
src=
{
fileUrl
}
alt=
"chatbot"
width=
{
44
}
height=
{
44
}
className=
"rounded-full object-cover"
/>
)
)
}
<
Typography
variant=
"subtitle2"
>
{
label
}
</
Typography
>
</
div
>
</
Button
>
);
}
src/components/atom/InputFile.tsx
View file @
ca8f7144
This diff is collapsed.
Click to expand it.
src/components/pages/dashboard/adminDashboard/settings/Chatbot.tsx
0 → 100644
View file @
ca8f7144
import
InputFile
from
'@/components/atom/InputFile'
;
import
{
useAppDispatch
}
from
'@/hooks/hook'
;
import
{
useGetChatbotSettingQuery
,
useUpdateChatbotMutation
}
from
'@/services/settingApi'
;
import
{
showToast
,
ToastVariant
}
from
'@/slice/toastSlice'
;
import
{
Button
,
InputLabel
,
OutlinedInput
}
from
'@mui/material'
;
import
{
useFormik
}
from
'formik'
;
import
*
as
Yup
from
"yup"
;
const
validationSchema
=
Yup
.
object
({
chatbot_label
:
Yup
.
string
().
required
(
"Label is required"
),
chatbot_link
:
Yup
.
string
().
required
(
"Link is required"
),
});
export
default
function
Chatbot
()
{
const
dispatch
=
useAppDispatch
();
const
{
data
}
=
useGetChatbotSettingQuery
();
const
[
updateChatbotSetting
,
{
isLoading
}]
=
useUpdateChatbotMutation
();
const
formik
=
useFormik
({
enableReinitialize
:
true
,
initialValues
:
{
chatbot_label
:
data
?.
data
?.
chatbot_label
||
""
,
chatbot_link
:
data
?.
data
?.
chatbot_link
||
""
,
chatbot_image
:
null
as
File
|
null
,
chatbot_image_url
:
data
?.
data
?.
chatbot_image_url
||
""
,
},
validationSchema
,
onSubmit
:
async
(
values
)
=>
{
try
{
const
formData
=
new
FormData
();
formData
.
append
(
"chatbot_label"
,
values
.
chatbot_label
);
formData
.
append
(
"chatbot_link"
,
values
.
chatbot_link
);
if
(
values
.
chatbot_image
)
{
formData
.
append
(
"chatbot_image"
,
values
.
chatbot_image
);
}
const
response
=
await
updateChatbotSetting
(
formData
).
unwrap
();
dispatch
(
showToast
({
variant
:
ToastVariant
.
SUCCESS
,
message
:
response
?.
message
||
"Chatbot settings updated successfully"
,
})
);
}
catch
(
e
:
any
)
{
dispatch
(
showToast
({
variant
:
ToastVariant
.
ERROR
,
message
:
e
?.
data
?.
message
||
"Something went wrong"
,
})
);
}
},
});
return
(
<
form
onSubmit=
{
formik
.
handleSubmit
}
className=
"border border-gray rounded-[16px] mb-6"
>
<
div
className=
"py-6 px-10 border-b border-gray"
>
<
h2
className=
"text-[20px] font-bold"
>
Chatbot Settings
</
h2
>
</
div
>
<
div
className=
"p-6 lg:p-10 space-y-6"
>
{
/* Label */
}
<
div
>
<
InputLabel
>
Label
<
span
className=
"text-red-500"
>
*
</
span
>
</
InputLabel
>
<
OutlinedInput
fullWidth
name=
"chatbot_label"
placeholder=
"Enter Label"
value=
{
formik
.
values
.
chatbot_label
}
onChange=
{
formik
.
handleChange
}
onBlur=
{
formik
.
handleBlur
}
/>
<
span
className=
"text-red-500 text-sm"
>
{
formik
.
touched
.
chatbot_label
&&
formik
.
errors
.
chatbot_label
}
</
span
>
</
div
>
{
/* Link */
}
<
div
>
<
InputLabel
>
Link
<
span
className=
"text-red-500"
>
*
</
span
>
</
InputLabel
>
<
OutlinedInput
fullWidth
name=
"chatbot_link"
placeholder=
"Enter Link"
value=
{
formik
.
values
.
chatbot_link
}
onChange=
{
formik
.
handleChange
}
onBlur=
{
formik
.
handleBlur
}
/>
<
span
className=
"text-red-500 text-sm"
>
{
formik
.
touched
.
chatbot_link
&&
formik
.
errors
.
chatbot_link
}
</
span
>
</
div
>
{
/* Single Image Upload */
}
<
div
>
<
InputFile
name=
"chatbot_image"
label=
"Chatbot Icon"
value=
{
formik
.
values
.
chatbot_image
}
onChange=
{
(
file
:
File
|
File
[]
|
null
)
=>
formik
.
setFieldValue
(
"chatbot_image"
,
file
)
}
serverFile=
{
formik
.
values
.
chatbot_image_url
}
onRemoveServerFile=
{
()
=>
formik
.
setFieldValue
(
"chatbot_image_url"
,
""
)
}
/>
</
div
>
<
Button
type=
"submit"
variant=
"contained"
disabled=
{
isLoading
}
>
{
isLoading
?
"Updating..."
:
"Update"
}
</
Button
>
</
div
>
</
form
>
);
}
src/components/pages/dashboard/adminDashboard/settings/index.tsx
View file @
ca8f7144
"use client"
;
import
PageHeader
from
'@/components/molecules/PageHeader'
import
React
,
{
useState
}
from
'react'
import
SiteSetting
from
'./SiteSetting'
import
AdminProfile
from
'./AdminProfile'
import
PageHeader
from
'@/components/molecules/PageHeader'
;
import
{
useState
}
from
'react'
;
import
AdminProfile
from
'./AdminProfile'
;
import
BannerSlider
from
'./BannerSlider'
;
import
Chatbot
from
'./Chatbot'
;
import
SiteSetting
from
'./SiteSetting'
;
export
default
function
SettingPage
()
{
// Track the active tab index
...
...
@@ -14,6 +15,7 @@ export default function SettingPage() {
{
title
:
"Site Settings"
,
content
:
<
SiteSetting
/>
},
{
title
:
"My Profile"
,
content
:
<
AdminProfile
/>
},
{
title
:
"Banner Slider"
,
content
:
<
BannerSlider
/>
},
{
title
:
"Chatbot"
,
content
:
<
Chatbot
/>
},
];
return
(
...
...
src/services/settingApi.ts
View file @
ca8f7144
import
{
GlobalResponse
}
from
"@/types/config"
;
import
{
BannerResponseProps
,
ChatbotProps
,
SiteSettingResponseProps
}
from
"@/types/setting"
;
import
{
createApi
}
from
"@reduxjs/toolkit/query/react"
;
import
{
baseQuery
}
from
"./baseQuery"
;
import
{
GlobalResponse
}
from
"@/types/config"
;
import
{
BannerResponseProps
,
SiteSettingResponseProps
}
from
"@/types/setting"
;
export
const
settingApi
=
createApi
({
reducerPath
:
"settingApi"
,
baseQuery
:
baseQuery
,
tagTypes
:
[
'settings'
,
'banners'
],
tagTypes
:
[
'settings'
,
'banners'
,
"Chatbot"
],
endpoints
:
(
builder
)
=>
({
updateSetting
:
builder
.
mutation
<
GlobalResponse
,
FormData
>
({
query
:
(
body
)
=>
({
...
...
@@ -39,7 +39,30 @@ export const settingApi = createApi({
providesTags
:
[
'banners'
]
}),
updateChatbot
:
builder
.
mutation
<
GlobalResponse
,
FormData
>
({
query
:
(
body
)
=>
({
url
:
"/api/admin/setting/chatbot"
,
method
:
"POST"
,
body
:
body
,
}),
invalidatesTags
:
[
'Chatbot'
]
}),
getChatbotSetting
:
builder
.
query
<
{
data
:
ChatbotProps
},
void
>
({
query
:
()
=>
({
url
:
"/api/setting/chatbot"
,
method
:
"GET"
,
}),
providesTags
:
[
'Chatbot'
]
}),
})
})
export
const
{
useUpdateSettingMutation
,
useGetSettingsQuery
,
useUpdateBannerMutation
,
useGetAllBannerQuery
}
=
settingApi
;
\ No newline at end of file
export
const
{
useUpdateSettingMutation
,
useGetSettingsQuery
,
useUpdateBannerMutation
,
useGetAllBannerQuery
,
useUpdateChatbotMutation
,
useGetChatbotSettingQuery
}
=
settingApi
;
\ No newline at end of file
src/types/setting.ts
View file @
ca8f7144
...
...
@@ -66,3 +66,11 @@ export interface BannerResponseProps {
success
:
boolean
;
data
:
BannerProps
[];
}
export
interface
ChatbotProps
{
chatbot_link
:
string
;
chatbot_image
:
File
|
null
;
chatbot_image_url
?:
string
;
chatbot_label
:
string
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment