mirror of
https://github.com/jambonz/chrome-extension-dialer.git
synced 2026-01-25 02:08:05 +00:00
fix review comment
This commit is contained in:
BIN
public/icons/icon.png
Normal file
BIN
public/icons/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
public/icons/icon1024.png
Normal file
BIN
public/icons/icon1024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
public/icons/icon192.png
Normal file
BIN
public/icons/icon192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
public/icons/icon384.png
Normal file
BIN
public/icons/icon384.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
public/icons/icon512.png
Normal file
BIN
public/icons/icon512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -1,13 +1,22 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"manifest_version": 3,
|
||||
"name": "Webrtc Chrome Extension",
|
||||
"description": "Webrtc Chrome Extension",
|
||||
"name": "Jambonz Webrtc Client",
|
||||
"description": "Jambonz Webrtc Client",
|
||||
"action": {
|
||||
"default_title": "Webrtc Chrome Extension"
|
||||
"default_title": "Jambonz Webrtc Client"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "background/index.js"
|
||||
},
|
||||
"permissions": ["activeTab", "storage"]
|
||||
"permissions": ["activeTab", "storage"],
|
||||
"icons": {
|
||||
"16": "icons/icon.png",
|
||||
"48": "icons/icon.png",
|
||||
"128": "icons/icon.png",
|
||||
"192": "icons/icon192.png",
|
||||
"384": "icons/icon384.png",
|
||||
"512": "icons/icon512.png",
|
||||
"1024": "icons/icon1024.png"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
IconButton,
|
||||
Image,
|
||||
Input,
|
||||
Select,
|
||||
Spacer,
|
||||
Text,
|
||||
Tooltip,
|
||||
@@ -60,7 +61,6 @@ export const Phone = ({
|
||||
const [inputNumber, setInputNumber] = useState("");
|
||||
const inputNumberRef = useRef(inputNumber);
|
||||
const [status, setStatus] = useState<SipClientStatus>("offline");
|
||||
const [goOffline, setGoOffline] = useState(false);
|
||||
const [isConfigured, setIsConfigured] = useState(false);
|
||||
const [callStatus, setCallStatus] = useState(SipConstants.SESSION_ENDED);
|
||||
const [sessionDirection, setSessionDirection] =
|
||||
@@ -121,11 +121,7 @@ export const Phone = ({
|
||||
}
|
||||
};
|
||||
|
||||
const createSipClient = (forceOfflineMode = false) => {
|
||||
if (goOffline && !forceOfflineMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
const createSipClient = () => {
|
||||
clientGoOffline();
|
||||
|
||||
const client = {
|
||||
@@ -221,13 +217,14 @@ export const Phone = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleGoOffline = () => {
|
||||
const newVal = !goOffline;
|
||||
setGoOffline(newVal);
|
||||
if (newVal) {
|
||||
const handleGoOffline = (s: string) => {
|
||||
if (s === status) {
|
||||
return;
|
||||
}
|
||||
if (s === "offline") {
|
||||
clientGoOffline();
|
||||
} else {
|
||||
createSipClient(true);
|
||||
createSipClient();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -279,31 +276,27 @@ export const Phone = ({
|
||||
<>
|
||||
<HStack spacing={2} boxShadow="md" w="full" p={2} borderRadius={5}>
|
||||
<Image src={isOnline() ? GreenAvatar : Avatar} />
|
||||
<VStack spacing={2} alignItems="start">
|
||||
<HStack spacing={2}>
|
||||
<VStack spacing={2} alignItems="start" w="full">
|
||||
<HStack spacing={2} w="full">
|
||||
<Text fontWeight="bold" fontSize="13px">
|
||||
{sipDisplayName ?? sipUsername}
|
||||
</Text>
|
||||
<Circle size="8px" bg={isOnline() ? "green.500" : "gray.500"} />
|
||||
<Text fontSize="13px">{isOnline() ? "Online" : "Offline"}</Text>
|
||||
<Select
|
||||
borderRadius="full"
|
||||
variant="unstyled"
|
||||
w="auto"
|
||||
value={status}
|
||||
onChange={(e) => handleGoOffline(e.target.value)}
|
||||
>
|
||||
<option value="online">Online</option>
|
||||
<option value="offline">Offline</option>
|
||||
</Select>
|
||||
</HStack>
|
||||
<Text fontWeight="bold" w="full">
|
||||
{`${sipUsername}@${sipDomain}`}
|
||||
</Text>
|
||||
</VStack>
|
||||
{isSipClientIdle(callStatus) && (
|
||||
<>
|
||||
<Spacer />
|
||||
<Button
|
||||
variant={isOnline() ? "outline" : "solid"}
|
||||
borderRadius="50px 50px 50px 50px"
|
||||
colorScheme={isOnline() ? "gray" : "jambonz"}
|
||||
onClick={handleGoOffline}
|
||||
>
|
||||
{isOnline() ? "GO OFFLINE" : "GO ONLINE"}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</HStack>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -184,7 +184,7 @@ function getHtmlPlugins(chunks) {
|
||||
return chunks.map(
|
||||
(chunk) =>
|
||||
new HTMLPlugin({
|
||||
title: "Webrtc Chrome Extension",
|
||||
title: "Jambonz Webrtc Client",
|
||||
filename: `${chunk}.html`,
|
||||
chunks: [chunk],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user