From 4ea23d0353b19c55a4cc47f47c25f333243f9f05 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Wed, 17 Aug 2022 13:05:01 -0700 Subject: [PATCH] fixing layout issues --- net/web/src/session/Session.jsx | 2 - net/web/src/session/bottomNav/BottomNav.jsx | 2 + net/web/src/session/cards/Cards.styled.js | 51 +++++-- .../src/session/cards/cardItem/CardItem.jsx | 7 +- net/web/src/session/cards/useCards.hook.js | 13 +- .../src/session/channels/Channels.styled.js | 6 +- net/web/src/session/contact/Contact.jsx | 25 ++- net/web/src/session/contact/Contact.styled.js | 143 ++++++++++++------ .../src/session/contact/useContact.hook.js | 21 +-- net/web/src/session/profile/Profile.jsx | 8 +- net/web/src/session/profile/Profile.styled.js | 122 ++++++++++----- .../src/session/profile/useProfile.hook.js | 4 +- 12 files changed, 272 insertions(+), 132 deletions(-) diff --git a/net/web/src/session/Session.jsx b/net/web/src/session/Session.jsx index 59e5f964..4e245035 100644 --- a/net/web/src/session/Session.jsx +++ b/net/web/src/session/Session.jsx @@ -54,8 +54,6 @@ export function Session() { actions.closeAccount(); } -console.log(state); - return ( { (state.display === 'xlarge') && ( diff --git a/net/web/src/session/bottomNav/BottomNav.jsx b/net/web/src/session/bottomNav/BottomNav.jsx index 1af70f98..daafef0b 100644 --- a/net/web/src/session/bottomNav/BottomNav.jsx +++ b/net/web/src/session/bottomNav/BottomNav.jsx @@ -16,6 +16,7 @@ export function BottomNav({ state, actions }) { const setChannels = () => { actions.closeDetails(); actions.closeCards(); + actions.closeListing(); actions.closeContact(); actions.closeProfile(); actions.closeAccount(); @@ -25,6 +26,7 @@ export function BottomNav({ state, actions }) { const setProfile = () => { actions.closeDetails(); actions.closeCards(); + actions.closeListing(); actions.closeContact(); actions.openProfile(); actions.closeConversation(); diff --git a/net/web/src/session/cards/Cards.styled.js b/net/web/src/session/cards/Cards.styled.js index 6c5b97a1..08b8f60a 100644 --- a/net/web/src/session/cards/Cards.styled.js +++ b/net/web/src/session/cards/Cards.styled.js @@ -59,6 +59,26 @@ export const CardsWrapper = styled.div` flex-direction: row; align-items: center; justify-content: center; + + .add { + display: flex; + flex-direction: row; + color: ${Colors.white}; + background-color: ${Colors.primary}; + align-items: center; + justify-content: center; + padding-left: 16px; + padding-right: 16px; + border-radius: 4px; + font-size: 14px; + cursor: pointer; + height: 100%; + flex-shrink: 0; + + .label { + padding-left: 8px; + } + } } .dismiss { @@ -81,23 +101,24 @@ export const CardsWrapper = styled.div` padding-bottom: 12px; padding-top: 12px; position: relative; - } - .add { - display: flex; - flex-direction: row; - color: ${Colors.primary}; - align-items: center; - justify-content: center; - padding-left: 16px; - padding-right: 16px; - border-radius: 4px; - font-size: 14px; - cursor: pointer; - height: 100%; + .add { + display: flex; + flex-direction: row; + color: ${Colors.primary}; + align-items: center; + justify-content: center; + padding-left: 16px; + padding-right: 16px; + border-radius: 4px; + font-size: 14px; + cursor: pointer; + height: 100%; + flex-shrink: 0; - .label { - padding-left: 8px; + .label { + padding-left: 8px; + } } } `; diff --git a/net/web/src/session/cards/cardItem/CardItem.jsx b/net/web/src/session/cards/cardItem/CardItem.jsx index 2dc6ed3a..07656f8f 100644 --- a/net/web/src/session/cards/cardItem/CardItem.jsx +++ b/net/web/src/session/cards/cardItem/CardItem.jsx @@ -20,6 +20,11 @@ export function CardItem({ item, open }) { return profile?.handle; } + const resync = (e) => { + e.stopPropagation(); + actions.resync(); + }; + return ( open(profile.guid)}> @@ -30,7 +35,7 @@ export function CardItem({ item, open }) {
{ !state.resync && item.error && ( - + diff --git a/net/web/src/session/cards/useCards.hook.js b/net/web/src/session/cards/useCards.hook.js index 5671f7b2..1fc1ba43 100644 --- a/net/web/src/session/cards/useCards.hook.js +++ b/net/web/src/session/cards/useCards.hook.js @@ -44,7 +44,12 @@ export function useCards() { if (state.sorted) { filtered.sort((a, b) => { - if (a?.data?.cardProfile?.name < b?.data?.cardProfile?.name) { + let aName = a?.data?.cardProfile?.name; + let bName = b?.data?.cardProfile?.name; + if (aName == bName) { + return 0; + } + if (!aName || (aName < bName)) { return -1; } return 1; @@ -54,8 +59,10 @@ export function useCards() { filtered.sort((a, b) => { const aUpdated = a?.data?.cardDetail?.statusUpdated; const bUpdated = b?.data?.cardDetail?.statusUpdated; - - if ((aUpdated && !bUpdated) || (aUpdated && bUpdated && aUpdated > bUpdated)) { + if (aUpdated == bUpdated) { + return 0; + } + if (!aUpdated || (aUpdated < bUpdated)) { return -1; } return 1; diff --git a/net/web/src/session/channels/Channels.styled.js b/net/web/src/session/channels/Channels.styled.js index 40c15ac1..fbd8e3a6 100644 --- a/net/web/src/session/channels/Channels.styled.js +++ b/net/web/src/session/channels/Channels.styled.js @@ -15,10 +15,14 @@ export const ChannelsWrapper = styled.div` } .search { - padding: 8px; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 16px; + padding-right: 16px; border-bottom: 1px solid ${Colors.divider}; display: flex; flex-direction: row; + height: 48px; .filter { border: 1px solid ${Colors.divider}; diff --git a/net/web/src/session/contact/Contact.jsx b/net/web/src/session/contact/Contact.jsx index c50bbecc..1add3714 100644 --- a/net/web/src/session/contact/Contact.jsx +++ b/net/web/src/session/contact/Contact.jsx @@ -1,7 +1,7 @@ import { ContactWrapper } from './Contact.styled'; import { useContact } from './useContact.hook'; import { Logo } from 'logo/Logo'; -import { RightOutlined, BookOutlined, EnvironmentOutlined } from '@ant-design/icons'; +import { DatabaseOutlined, CloseOutlined, RightOutlined, BookOutlined, EnvironmentOutlined } from '@ant-design/icons'; export function Contact({ close, guid, listing }) { @@ -18,6 +18,12 @@ export function Contact({ close, guid, listing }) {
{ state.name }
+ { state.node && ( +
+ +
{ state.node }
+
+ )}
{ state.location }
@@ -49,12 +55,19 @@ export function Contact({ close, guid, listing }) { )} { state.init && state.display !== 'xlarge' && (
-
{ state.handle }
-
Contact Profile
-
- { Image } - { Details } +
+ { state.display === 'small' && ( +
+ )} +
{ state.handle }
+ { state.display === 'small' && ( +
+ +
+ )}
+ { Image } + { Details }
)} diff --git a/net/web/src/session/contact/Contact.styled.js b/net/web/src/session/contact/Contact.styled.js index 782ed0ed..4f9d0597 100644 --- a/net/web/src/session/contact/Contact.styled.js +++ b/net/web/src/session/contact/Contact.styled.js @@ -27,7 +27,7 @@ export const ContactWrapper = styled.div` } .close { - font-size: 16px; + font-size: 18px; color: ${Colors.primary}; cursor: pointer; padding-right: 16px; @@ -48,6 +48,45 @@ export const ContactWrapper = styled.div` width: 20vw; margin-right: 32px; } + + .details { + display: flex; + flex-direction: column; + + .name { + display: flex; + flex-direction: row; + align-items: center; + + .data { + padding-right: 8px; + font-size: 24px; + font-weight: bold; + } + } + + .location { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + + .description { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + } } .view { @@ -59,63 +98,75 @@ export const ContactWrapper = styled.div` align-items: center; .title { + display: flex; + width: 100%; + flex-direction: row; font-size: 18px; - font-weight: bold; + padding-top: 8px; + padding-bottom: 32px; + + .handle { + flex-grow: 1; + font-weight: bold; + display: flex; + justify-content: center; + } + + .close { + color: ${Colors.primary}; + cursor: pointer; + width: 64px; + display: flex; + justify-content: center; + align-items: center; + } } .logo { position: relative; - width: 80%; + width: 50%; margin-bottom: 16px; } - .section { - width: 100%; - color: ${Colors.grey}; - padding-top: 16px; - font-size: 12px; + .details { display: flex; - justify-content: center; - } - } - - .details { - display: flex; - flex-direction: column; - - .name { - display: flex; - flex-direction: row; + flex-direction: column; align-items: center; - - .data { - padding-right: 8px; - font-size: 24px; - font-weight: bold; + + .name { + display: flex; + flex-direction: row; + align-items: center; + + .data { + padding-right: 8px; + font-size: 24px; + font-weight: bold; + } } + + .location { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + + .description { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } } - - .location { - display: flex; - flex-direction: row; - align-items: center; - padding-bottom: 8px; - - .data { - padding-left: 8px; - } - } - - .description { - display: flex; - flex-direction: row; - align-items: center; - padding-bottom: 8px; - - .data { - padding-left: 8px; - } - } } ` diff --git a/net/web/src/session/contact/useContact.hook.js b/net/web/src/session/contact/useContact.hook.js index 706848dd..8ea118ef 100644 --- a/net/web/src/session/contact/useContact.hook.js +++ b/net/web/src/session/contact/useContact.hook.js @@ -12,6 +12,7 @@ export function useContact(guid, listing) { location: null, description: null, handle: null, + node: null, removed: false, init: false, }); @@ -25,28 +26,20 @@ export function useContact(guid, listing) { } useEffect(() => { - let logo, name, location, description, handle; + let logo, name, location, description, handle, node; let contact = card.actions.getCardByGuid(guid); if (contact) { let cardProfile = contact?.data?.cardProfile; - if (cardProfile.node != profile.state.profile.node) { - handle = cardProfile.handle + '@' + cardProfile.node; - } - else { - handle = cardProfile.handle; - } + handle = cardProfile.handle; + node = cardProfile.node; logo = card.actions.getImageUrl(contact.id); name = cardProfile.name; location = cardProfile.location; description = cardProfile.description; } else if (listing) { - if (listing.node != profile.state.profile.node) { - handle = listing.handle + '@' + listing.node; - } - else { - handle = listing.handle; - } + handle = listing.handle; + node = listing.node; logo = listing.imageSet ? getListingImageUrl(listing.node, listing.guid) : null; name = listing.name; location = listing.location; @@ -55,7 +48,7 @@ export function useContact(guid, listing) { else { updateState({ removed: true }); } - updateState({ init: true, logo, name, location, description, handle }); + updateState({ init: true, logo, name, location, description, handle, node }); }, [card, guid, listing]); useEffect(() => { diff --git a/net/web/src/session/profile/Profile.jsx b/net/web/src/session/profile/Profile.jsx index 7b02e56a..e64fbc02 100644 --- a/net/web/src/session/profile/Profile.jsx +++ b/net/web/src/session/profile/Profile.jsx @@ -2,7 +2,7 @@ import { Checkbox } from 'antd'; import { ProfileWrapper } from './Profile.styled'; import { useProfile } from './useProfile.hook'; import { Logo } from 'logo/Logo'; -import { LockOutlined, RightOutlined, EditOutlined, BookOutlined, EnvironmentOutlined } from '@ant-design/icons'; +import { DatabaseOutlined, LockOutlined, RightOutlined, EditOutlined, BookOutlined, EnvironmentOutlined } from '@ant-design/icons'; export function Profile({ closeProfile }) { @@ -23,6 +23,12 @@ export function Profile({ closeProfile }) {
{ state.name }
+ { state.node && ( +
+ +
{ state.node }
+
+ )}
{ state.location }
diff --git a/net/web/src/session/profile/Profile.styled.js b/net/web/src/session/profile/Profile.styled.js index d1907651..99af33e2 100644 --- a/net/web/src/session/profile/Profile.styled.js +++ b/net/web/src/session/profile/Profile.styled.js @@ -62,6 +62,45 @@ export const ProfileWrapper = styled.div` cursor: pointer; } } + + .details { + display: flex; + flex-direction: column; + + .name { + display: flex; + flex-direction: row; + align-items: center; + + .data { + padding-right: 8px; + font-size: 24px; + font-weight: bold; + } + } + + .location { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + + .description { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + } } .view { @@ -98,10 +137,50 @@ export const ProfileWrapper = styled.div` } } + .details { + display: flex; + flex-direction: column; + align-items: center; + + .name { + display: flex; + flex-direction: row; + align-items: center; + + .data { + padding-right: 8px; + font-size: 24px; + font-weight: bold; + } + } + + .location { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + + .description { + display: flex; + flex-direction: row; + align-items: center; + padding-bottom: 8px; + + .data { + padding-left: 8px; + } + } + } + .section { width: 100%; color: ${Colors.grey}; - padding-top: 16px; + padding-top: 32px; font-size: 12px; display: flex; justify-content: center; @@ -112,7 +191,7 @@ export const ProfileWrapper = styled.div` flex-direction: column; align-items: center; justify-content: center; - border: 1px solid ${Colors.divider}; + border-top: 1px solid ${Colors.divider}; border-radius: 4px; padding: 8px; width: 75%; @@ -131,43 +210,4 @@ export const ProfileWrapper = styled.div` } } } - - .details { - display: flex; - flex-direction: column; - - .name { - display: flex; - flex-direction: row; - align-items: center; - - .data { - padding-right: 8px; - font-size: 24px; - font-weight: bold; - } - } - - .location { - display: flex; - flex-direction: row; - align-items: center; - padding-bottom: 8px; - - .data { - padding-left: 8px; - } - } - - .description { - display: flex; - flex-direction: row; - align-items: center; - padding-bottom: 8px; - - .data { - padding-left: 8px; - } - } - } ` diff --git a/net/web/src/session/profile/useProfile.hook.js b/net/web/src/session/profile/useProfile.hook.js index 5911be2c..5979a719 100644 --- a/net/web/src/session/profile/useProfile.hook.js +++ b/net/web/src/session/profile/useProfile.hook.js @@ -19,9 +19,9 @@ export function useProfile() { useEffect(() => { if (profile.state.init) { - const { name, handle, location, description, image } = profile.state.profile; + const { node, name, handle, location, description, image } = profile.state.profile; let url = !image ? null : profile.actions.profileImageUrl(); - updateState({ init: true, name, handle, url, location, description }); + updateState({ init: true, name, node, handle, url, location, description }); } }, [profile]);