-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1aea12a
commit 6f33b4f
Showing
6 changed files
with
275 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client'; | ||
|
||
import {useEffect, useState} from "react"; | ||
|
||
interface ClientOnlyProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const ClientOnly:React.FC<ClientOnlyProps> = ({ | ||
children | ||
}) => { | ||
const [hasMounted, setHasMounted] = useState(false); | ||
|
||
useEffect(() => { | ||
setHasMounted(true); | ||
}, []); | ||
|
||
if (!hasMounted) { | ||
return null; | ||
} | ||
|
||
return( | ||
<> | ||
{children} | ||
</> | ||
) | ||
} | ||
|
||
export default ClientOnly; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use client'; | ||
|
||
import React, {useState} from 'react'; | ||
import {Chip} from "@material-tailwind/react"; | ||
import {Button} from "../ui/button"; | ||
|
||
const AgentStatus:React.FC = () => { | ||
|
||
const [isAvailable, setIsAvailable] = useState(false); | ||
|
||
const toggleAvailability = async () => { | ||
const newAvailability = !isAvailable; | ||
setIsAvailable(newAvailability); | ||
} | ||
|
||
return( | ||
<div className="flex gap-2 justify-center items-center"> | ||
<Button | ||
variant="outline" | ||
onClick={toggleAvailability}> | ||
{isAvailable? 'Go Unavailable' : 'Go Available'} | ||
</Button> | ||
<div className="flex gap-2 border border-gray-300 p-2 m-4 bg-gray-100 rounded"> | ||
|
||
|
||
|
||
<div>Status</div> | ||
|
||
<div> | ||
{isAvailable? | ||
<> | ||
<Chip | ||
variant="ghost" | ||
color="green" | ||
size="sm" | ||
value="Available" | ||
icon={ | ||
<span className="mx-auto mt-1 block h-2 w-2 rounded-full bg-green-900 content-['']" /> | ||
} | ||
/></> | ||
|
||
: | ||
<> | ||
<Chip | ||
variant="ghost" | ||
color="red" | ||
size="sm" | ||
value="Unavailable" | ||
icon={ | ||
<span className="mx-auto mt-1 block h-2 w-2 rounded-full bg-red-900 content-['']" /> | ||
} | ||
/> | ||
</> } | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default AgentStatus |
Oops, something went wrong.