diff --git a/net/web/src/constants/Colors.js b/net/web/src/constants/Colors.js
index 1ffdc343..0e62ed6c 100644
--- a/net/web/src/constants/Colors.js
+++ b/net/web/src/constants/Colors.js
@@ -12,6 +12,12 @@ const Colors = {
enabled: '#444444',
disabled: '#aaaaaa',
text: '#444444',
+
+ connected: '#44cc44',
+ connecting: '#dd88ff',
+ requested: '#4488ff',
+ pending: '#22aaaa',
+ confirmed: '#aaaaaa',
};
export default Colors;
diff --git a/net/web/src/session/cards/cardItem/CardItem.jsx b/net/web/src/session/cards/cardItem/CardItem.jsx
index c4f34e62..5318a10a 100644
--- a/net/web/src/session/cards/cardItem/CardItem.jsx
+++ b/net/web/src/session/cards/cardItem/CardItem.jsx
@@ -1,3 +1,55 @@
+import { CardItemWrapper, StatusConnected, StatusConnecting, StatusRequested, StatusPending, StatusConfirmed} from './CardItem.styled';
+import { useCardItem } from './useCardItem.hook';
+import { Logo } from 'logo/Logo';
+import { Tooltip } from 'antd';
+
export function CardItem({ item }) {
- return
{ item?.data?.cardProfile?.name }
+
+ const { state, actions } = useCardItem(item);
+ const profile = item?.data?.cardProfile;
+ const detail = item?.data?.cardDetail;
+
+ const handle = () => {
+ if (profile?.node) {
+ return profile.handle + '@' + profile.node;
+ }
+ return profile?.handle;
+ }
+
+ return (
+
+
+
+
{ profile?.name }
+
{ handle() }
+
+
+ { detail?.status === 'connected' && (
+
+
+
+ )}
+ { detail?.status === 'requested' && (
+
+
+
+ )}
+ { detail?.status === 'connecting' && (
+
+
+
+ )}
+ { detail?.status === 'pending' && (
+
+
+
+ )}
+ { detail?.status === 'confirmed' && (
+
+
+
+ )}
+
+
+ );
}
diff --git a/net/web/src/session/cards/cardItem/CardItem.styled.js b/net/web/src/session/cards/cardItem/CardItem.styled.js
new file mode 100644
index 00000000..c321b65f
--- /dev/null
+++ b/net/web/src/session/cards/cardItem/CardItem.styled.js
@@ -0,0 +1,83 @@
+import styled from 'styled-components';
+import Colors from 'constants/Colors';
+
+export const CardItemWrapper = styled.div`
+ height: 48px;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ border-bottom: 1px solid ${Colors.divider};
+ padding-left: 16px;
+ padding-right: 16px;
+
+ &:hover {
+ background-color: ${Colors.formHover};
+ cursor: pointer;
+ }
+
+ .details {
+ flex-grow: 1;
+ display: flex;
+ flex-direction: column;
+ padding-left: 16px;
+ justify-content: center;
+ min-width: 0;
+
+ .name {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 15px;
+ }
+
+ .handle {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 12px;
+ }
+ }
+
+ .markup {
+ position: absolute;
+ right: 0;
+ margin-right: 16px;
+ }
+`;
+
+export const StatusConnected = styled.div`
+ background-color: ${Colors.connected};
+ border-radius: 8px;
+ width: 8px;
+ height: 8px;
+`;
+
+export const StatusConnecting = styled.div`
+ background-color: ${Colors.connecting};
+ border-radius: 8px;
+ width: 8px;
+ height: 8px;
+`;
+
+export const StatusRequested = styled.div`
+ background-color: ${Colors.requested};
+ border-radius: 8px;
+ width: 8px;
+ height: 8px;
+`;
+
+export const StatusPending = styled.div`
+ background-color: ${Colors.pending};
+ border-radius: 8px;
+ width: 8px;
+ height: 8px;
+`;
+
+export const StatusConfirmed = styled.div`
+ background-color: ${Colors.confirmed};
+ border-radius: 8px;
+ width: 8px;
+ height: 8px;
+`;
+
+
diff --git a/net/web/src/session/cards/cardItem/useCardItem.hook.js b/net/web/src/session/cards/cardItem/useCardItem.hook.js
new file mode 100644
index 00000000..22dddc74
--- /dev/null
+++ b/net/web/src/session/cards/cardItem/useCardItem.hook.js
@@ -0,0 +1,25 @@
+import { useContext, useState, useEffect } from 'react';
+import { CardContext } from 'context/CardContext';
+
+export function useCardItem(item) {
+
+ const [state, setState] = useState({
+ logo: null,
+ });
+
+ const card = useContext(CardContext);
+
+ const updateState = (value) => {
+ setState((s) => ({ ...s, ...value }));
+ }
+
+ useEffect(() => {
+ updateState({ logo: card.actions.getImageUrl(item.id) });
+ }, [card]);
+
+ const actions = {
+ };
+
+ return { state, actions };
+}
+
diff --git a/net/web/src/session/cards/useCards.hook.js b/net/web/src/session/cards/useCards.hook.js
index 144d816d..d50ad60e 100644
--- a/net/web/src/session/cards/useCards.hook.js
+++ b/net/web/src/session/cards/useCards.hook.js
@@ -44,7 +44,7 @@ export function useCards() {
if (state.sorted) {
filtered.sort((a, b) => {
- if (a?.data?.cardProfile?.name > b?.data?.cardProfile?.name) {
+ if (a?.data?.cardProfile?.name < b?.data?.cardProfile?.name) {
return -1;
}
return 1;
@@ -52,7 +52,10 @@ export function useCards() {
}
else {
filtered.sort((a, b) => {
- if (a?.data?.cardDetails?.statusUpdated > b?.data?.cardDetails?.statusUpdated) {
+ const aUpdated = a?.data?.cardDetail?.statusUpdated;
+ const bUpdated = b?.data?.cardDetail?.statusUpdated;
+
+ if ((aUpdated && !bUpdated) || aUpdated && bUpdated && aUpdated > bUpdated) {
return -1;
}
return 1;
diff --git a/net/web/src/session/channels/useChannels.hook.js b/net/web/src/session/channels/useChannels.hook.js
index 6f40c18d..d0e7a65f 100644
--- a/net/web/src/session/channels/useChannels.hook.js
+++ b/net/web/src/session/channels/useChannels.hook.js
@@ -134,7 +134,6 @@ export function useChannels() {
}, [channel, card, store, filter]);
useEffect(() => {
-console.log(viewport.state);
updateState({ display: viewport.state.display });
}, [viewport]);