mirror of
https://github.com/jambonz/chrome-extension-dialer.git
synced 2026-10-04 02:04:28 +00:00
fix
This commit is contained in:
@@ -18,6 +18,7 @@ type IconButtonMenuProbs = {
|
|||||||
onOpen: () => Promise<IconButtonMenuItems[]>;
|
onOpen: () => Promise<IconButtonMenuItems[]>;
|
||||||
onClick: (name: string, value: string) => void;
|
onClick: (name: string, value: string) => void;
|
||||||
tooltip: string;
|
tooltip: string;
|
||||||
|
noResultLabel: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IconButtonMenu = ({
|
export const IconButtonMenu = ({
|
||||||
@@ -25,6 +26,7 @@ export const IconButtonMenu = ({
|
|||||||
onOpen,
|
onOpen,
|
||||||
onClick,
|
onClick,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
noResultLabel,
|
||||||
}: IconButtonMenuProbs) => {
|
}: IconButtonMenuProbs) => {
|
||||||
const [items, setItems] = useState<IconButtonMenuItems[]>([]);
|
const [items, setItems] = useState<IconButtonMenuItems[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -51,12 +53,14 @@ export const IconButtonMenu = ({
|
|||||||
<MenuItem>
|
<MenuItem>
|
||||||
<Spinner color="jambonz.500" size="xs" />
|
<Spinner color="jambonz.500" size="xs" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
) : (
|
) : items.length > 0 ? (
|
||||||
items.map((i, idx) => (
|
items.map((i, idx) => (
|
||||||
<MenuItem key={idx} onClick={() => onClick(i.name, i.value)}>
|
<MenuItem key={idx} onClick={() => onClick(i.name, i.value)}>
|
||||||
{i.name}
|
{i.name}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))
|
))
|
||||||
|
) : (
|
||||||
|
<MenuItem>{noResultLabel}</MenuItem>
|
||||||
)}
|
)}
|
||||||
</MenuList>
|
</MenuList>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const Recents = ({
|
|||||||
</UnorderedList>
|
</UnorderedList>
|
||||||
) : (
|
) : (
|
||||||
<Text fontSize="24px" fontWeight="bold">
|
<Text fontSize="24px" fontWeight="bold">
|
||||||
No Call History
|
{isSaved ? "No saved calls" : "No Call History"}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ export const Phone = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (sipDomain && sipUsername && sipPassword && sipServerAddress) {
|
if (sipDomain && sipUsername && sipPassword && sipServerAddress) {
|
||||||
createSipClient();
|
if (sipUA.current) {
|
||||||
|
clientGoOffline();
|
||||||
|
} else {
|
||||||
|
createSipClient();
|
||||||
|
}
|
||||||
setIsConfigured(true);
|
setIsConfigured(true);
|
||||||
} else {
|
} else {
|
||||||
setIsConfigured(false);
|
setIsConfigured(false);
|
||||||
@@ -181,8 +185,6 @@ export const Phone = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createSipClient = () => {
|
const createSipClient = () => {
|
||||||
clientGoOffline();
|
|
||||||
|
|
||||||
const client = {
|
const client = {
|
||||||
username: `${sipUsername}@${sipDomain}`,
|
username: `${sipUsername}@${sipDomain}`,
|
||||||
password: sipPassword,
|
password: sipPassword,
|
||||||
@@ -205,7 +207,11 @@ export const Phone = ({
|
|||||||
});
|
});
|
||||||
sipClient.on(SipConstants.UA_UNREGISTERED, (args) => {
|
sipClient.on(SipConstants.UA_UNREGISTERED, (args) => {
|
||||||
setStatus("offline");
|
setStatus("offline");
|
||||||
clientGoOffline();
|
if (sipDomain && sipUsername && sipPassword && sipServerAddress) {
|
||||||
|
createSipClient();
|
||||||
|
} else {
|
||||||
|
clientGoOffline();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// Call Status
|
// Call Status
|
||||||
sipClient.on(SipConstants.SESSION_RINGING, (args) => {
|
sipClient.on(SipConstants.SESSION_RINGING, (args) => {
|
||||||
@@ -383,7 +389,7 @@ export const Phone = ({
|
|||||||
<VStack spacing={2} alignItems="start" w="full">
|
<VStack spacing={2} alignItems="start" w="full">
|
||||||
<HStack spacing={2} w="full">
|
<HStack spacing={2} w="full">
|
||||||
<Text fontWeight="bold" fontSize="13px">
|
<Text fontWeight="bold" fontSize="13px">
|
||||||
{sipDisplayName ?? sipUsername}
|
{sipDisplayName || sipUsername}
|
||||||
</Text>
|
</Text>
|
||||||
<Circle size="8px" bg={isOnline() ? "green.500" : "gray.500"} />
|
<Circle size="8px" bg={isOnline() ? "green.500" : "gray.500"} />
|
||||||
<Select
|
<Select
|
||||||
@@ -437,7 +443,8 @@ export const Phone = ({
|
|||||||
<HStack spacing={2} align="start" w="full">
|
<HStack spacing={2} align="start" w="full">
|
||||||
<IconButtonMenu
|
<IconButtonMenu
|
||||||
icon={<Users />}
|
icon={<Users />}
|
||||||
tooltip="Call to user"
|
tooltip="Call a user"
|
||||||
|
noResultLabel="No registered users"
|
||||||
onClick={(_, value) => {
|
onClick={(_, value) => {
|
||||||
setInputNumber(value);
|
setInputNumber(value);
|
||||||
makeOutboundCall(value);
|
makeOutboundCall(value);
|
||||||
@@ -466,7 +473,8 @@ export const Phone = ({
|
|||||||
/>
|
/>
|
||||||
<IconButtonMenu
|
<IconButtonMenu
|
||||||
icon={<List />}
|
icon={<List />}
|
||||||
tooltip="Call to a queue"
|
tooltip="Take a call from queue"
|
||||||
|
noResultLabel="No calls in queue"
|
||||||
onClick={(name, value) => {
|
onClick={(name, value) => {
|
||||||
setAppName(`Queue ${name}`);
|
setAppName(`Queue ${name}`);
|
||||||
const calledQueue = `queue-${value}`;
|
const calledQueue = `queue-${value}`;
|
||||||
@@ -493,7 +501,8 @@ export const Phone = ({
|
|||||||
|
|
||||||
<IconButtonMenu
|
<IconButtonMenu
|
||||||
icon={<GitMerge />}
|
icon={<GitMerge />}
|
||||||
tooltip="Call to an application"
|
tooltip="Call an application"
|
||||||
|
noResultLabel="No applications"
|
||||||
onClick={(name, value) => {
|
onClick={(name, value) => {
|
||||||
setAppName(`App ${name}`);
|
setAppName(`App ${name}`);
|
||||||
const calledAppId = `app-${value}`;
|
const calledAppId = `app-${value}`;
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ export const AdvancedSettings = () => {
|
|||||||
<FormLabel>Jambonz Account Sid</FormLabel>
|
<FormLabel>Jambonz Account Sid</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Account Sid"
|
|
||||||
isRequired
|
isRequired
|
||||||
value={accountSid}
|
value={accountSid}
|
||||||
onChange={(e) => setAccountSid(e.target.value)}
|
onChange={(e) => setAccountSid(e.target.value)}
|
||||||
|
|||||||
@@ -128,11 +128,10 @@ export const BasicSettings = () => {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormControl id="sip_display_name">
|
<FormControl id="sip_display_name">
|
||||||
<FormLabel>SIP Display Name</FormLabel>
|
<FormLabel>SIP Display Name (Optional)</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Display name"
|
placeholder="Display name"
|
||||||
isRequired
|
|
||||||
value={sipDisplayName}
|
value={sipDisplayName}
|
||||||
onChange={(e) => setSipDisplayName(e.target.value)}
|
onChange={(e) => setSipDisplayName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user