diff --git a/net/web/src/context/useViewportContext.hook.js b/net/web/src/context/useViewportContext.hook.js
index 2cfdf9c2..0d931ebe 100644
--- a/net/web/src/context/useViewportContext.hook.js
+++ b/net/web/src/context/useViewportContext.hook.js
@@ -10,7 +10,7 @@ export function useViewportContext() {
const SMALL_MEDIUM = 650;
const MEDIUM_LARGE = 1000;
- const LARGE_XLARGE = 1400;
+ const LARGE_XLARGE = 1600;
const updateState = (value) => {
setState((s) => ({ ...s, ...value }));
diff --git a/net/web/src/session/Session.jsx b/net/web/src/session/Session.jsx
index bfc31de9..c77f2aed 100644
--- a/net/web/src/session/Session.jsx
+++ b/net/web/src/session/Session.jsx
@@ -197,7 +197,7 @@ console.log(" SET REMOTE STREAM");
)}
{ state.cards && (
-
+
@@ -249,7 +249,7 @@ console.log(" SET REMOTE STREAM");
{ state.cards && (
-
+
)}
-
+
)}
{ state.listing && (
diff --git a/net/web/src/session/cards/Cards.jsx b/net/web/src/session/cards/Cards.jsx
index 58662dab..9a39d5c2 100644
--- a/net/web/src/session/cards/Cards.jsx
+++ b/net/web/src/session/cards/Cards.jsx
@@ -1,12 +1,42 @@
-import { Input, List, Button } from 'antd';
+import { Input, Modal, List, Button } from 'antd';
import { CardsWrapper } from './Cards.styled';
import { SortAscendingOutlined, UpOutlined, DoubleRightOutlined, UserOutlined, SearchOutlined } from '@ant-design/icons';
import { useCards } from './useCards.hook';
import { CardItem } from './cardItem/CardItem';
-export function Cards({ closeCards, openContact, openListing }) {
+export function Cards({ closeCards, openContact, openChannel, openListing }) {
- const { state, actions } = useCards();
+ const [ modal, modalContext ] = Modal.useModal();
+ const { state, actions } = useCards(openChannel);
+
+ const message = async (cardId) => {
+ try {
+ const id = await actions.message(cardId);
+ openChannel(id);
+ }
+ catch (err) {
+ console.log(err);
+ modal.error({
+ title: 'Failed to Create Topic',
+ content: 'Please try again.',
+ bodyStyle: { padding: 16 },
+ });
+ };
+ };
+
+ const call = async (contact) => {
+ try {
+ const id = await actions.call(contact);
+ }
+ catch (err) {
+ console.log(err);
+ modal.error({
+ title: 'Failed to Start Call',
+ content: 'Please try again.',
+ bodyStyle: { padding: 16 },
+ });
+ };
+ };
return (
@@ -43,7 +73,8 @@ export function Cards({ closeCards, openContact, openListing }) {
(
actions.resync(item.cardId)}
- open={() => openContact(item.guid)} />
+ open={() => openContact(item.guid)} message={() => message(item.cardId)}
+ call={() => call(item)} />
)} />
)}
{ state.cards.length === 0 && (
diff --git a/net/web/src/session/cards/cardItem/CardItem.jsx b/net/web/src/session/cards/cardItem/CardItem.jsx
index c07b4847..702cae48 100644
--- a/net/web/src/session/cards/cardItem/CardItem.jsx
+++ b/net/web/src/session/cards/cardItem/CardItem.jsx
@@ -1,18 +1,28 @@
import { CardItemWrapper, StatusError,
StatusConnected, StatusConnecting,
StatusRequested, StatusPending,
- StatusConfirmed} from './CardItem.styled';
+ StatusConfirmed, ComOptions } from './CardItem.styled';
import { Logo } from 'logo/Logo';
import { Tooltip } from 'antd';
-import { ExclamationCircleOutlined } from '@ant-design/icons';
+import { MessageOutlined, PhoneOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
-export function CardItem({ item, tooltip, resync, open }) {
+export function CardItem({ item, tooltip, resync, open, call, message }) {
const onResync = (e) => {
e.stopPropagation();
resync();
};
+ const onMessage = (e) => {
+ e.stopPropagation();
+ message();
+ }
+
+ const onCall = (e) => {
+ e.stopPropagation();
+ call();
+ }
+
return (
@@ -33,6 +43,16 @@ export function CardItem({ item, tooltip, resync, open }) {
)}
+ { item.status === 'connected' && (
+
+
+
+
+
+
+
+
+ )}
{ item.status === 'connected' && (
diff --git a/net/web/src/session/cards/cardItem/CardItem.styled.js b/net/web/src/session/cards/cardItem/CardItem.styled.js
index 8551fae9..cd924a9e 100644
--- a/net/web/src/session/cards/cardItem/CardItem.styled.js
+++ b/net/web/src/session/cards/cardItem/CardItem.styled.js
@@ -52,7 +52,19 @@ export const CardItemWrapper = styled.div`
export const StatusError = styled.div`
color: ${Colors.error};
font-size: 14px;
- padding-right: 8px;
+ padding-right: 12px;
+`
+
+export const ComOptions = styled.div`
+ color: ${Colors.primary};
+ font-size: 16px;
+ display: flex;
+ flex-direction: row;
+
+ .option {
+ padding-right: 12px;
+ cursor: pointer;
+ }
`
export const StatusConnected = styled.div`
diff --git a/net/web/src/session/cards/useCards.hook.js b/net/web/src/session/cards/useCards.hook.js
index 02ef1fe5..fc554d65 100644
--- a/net/web/src/session/cards/useCards.hook.js
+++ b/net/web/src/session/cards/useCards.hook.js
@@ -2,6 +2,8 @@ import { useContext, useState, useEffect } from 'react';
import { CardContext } from 'context/CardContext';
import { ViewportContext } from 'context/ViewportContext';
import { StoreContext } from 'context/StoreContext';
+import { ChannelContext } from 'context/ChannelContext';
+import { RingContext } from 'context/RingContext';
export function useCards() {
@@ -14,7 +16,9 @@ export function useCards() {
cards: [],
});
+ const ring = useContext(RingContext);
const card = useContext(CardContext);
+ const channel = useContext(ChannelContext);
const store = useContext(StoreContext);
const viewport = useContext(ViewportContext);
@@ -38,9 +42,11 @@ export function useCards() {
const offsync = item.offsync;
const guid = profile?.guid;
const name = profile?.name;
+ const node = profile?.node;
+ const token = detail?.token;
const handle = profile?.node ? `${profile.handle}@${profile.node}` : profile.handle;
const logo = profile?.imageSet ? card.actions.getCardImageUrl(item.id) : null;
- return { cardId, guid, updated, offsync, status, name, handle, logo };
+ return { cardId, guid, updated, offsync, status, name, node, token, handle, logo };
});
let latest = 0;
@@ -112,6 +118,14 @@ export function useCards() {
resync: async (cardId) => {
await card.actions.resyncCard(cardId);
},
+ message: async (cardId) => {
+ const conversation = await channel.actions.addChannel('superbasic', { subject: null }, [ cardId ]);
+ return conversation.id;
+ },
+ call: async (contact) => {
+ const { cardId, node, guid, token } = contact;
+ await ring.actions.call(contact.cardId, node, `${guid}.${token}`);
+ },
};
return { state, actions };
diff --git a/net/web/src/session/contact/Contact.jsx b/net/web/src/session/contact/Contact.jsx
index 52cd4109..843f9f0d 100644
--- a/net/web/src/session/contact/Contact.jsx
+++ b/net/web/src/session/contact/Contact.jsx
@@ -94,7 +94,6 @@ export function Contact({ close, guid, listing }) {
updateContact(actions.disconnect)}>Disconnect
updateContact(actions.disconnectRemove)}>Delete Contact
-
Call Contact
)}
diff --git a/net/web/src/session/contact/useContact.hook.js b/net/web/src/session/contact/useContact.hook.js
index 8121e666..b7b9f146 100644
--- a/net/web/src/session/contact/useContact.hook.js
+++ b/net/web/src/session/contact/useContact.hook.js
@@ -1,10 +1,8 @@
import { useContext, useState, useEffect } from 'react';
import { CardContext } from 'context/CardContext';
-import { RingContext } from 'context/RingContext';
import { ViewportContext } from 'context/ViewportContext';
import { getListingMessage } from 'api/getListingMessage';
import { getCardByGuid } from 'context/cardUtil';
-import { addContactRing } from 'api/addContactRing';
export function useContact(guid, listing, close) {
@@ -22,7 +20,6 @@ export function useContact(guid, listing, close) {
});
const card = useContext(CardContext);
- const ring = useContext(RingContext);
const viewport = useContext(ViewportContext);
const updateState = (value) => {
@@ -158,13 +155,6 @@ export function useContact(guid, listing, close) {
close();
});
},
- ring: async () => {
- console.log("calling!!");
- const contact = card.state.cards.get(state.cardId);
- const { node, guid } = contact.data.cardProfile;
- const { token } = contact.data.cardDetail;
- await ring.actions.call(state.cardId, node, `${guid}.${token}`);
- },
};
return { state, actions };