fixing layout issues

This commit is contained in:
Roland Osborne 2022-08-17 13:05:01 -07:00
parent 0b7be9bf0c
commit 4ea23d0353
12 changed files with 272 additions and 132 deletions

View File

@ -54,8 +54,6 @@ export function Session() {
actions.closeAccount(); actions.closeAccount();
} }
console.log(state);
return ( return (
<SessionWrapper> <SessionWrapper>
{ (state.display === 'xlarge') && ( { (state.display === 'xlarge') && (

View File

@ -16,6 +16,7 @@ export function BottomNav({ state, actions }) {
const setChannels = () => { const setChannels = () => {
actions.closeDetails(); actions.closeDetails();
actions.closeCards(); actions.closeCards();
actions.closeListing();
actions.closeContact(); actions.closeContact();
actions.closeProfile(); actions.closeProfile();
actions.closeAccount(); actions.closeAccount();
@ -25,6 +26,7 @@ export function BottomNav({ state, actions }) {
const setProfile = () => { const setProfile = () => {
actions.closeDetails(); actions.closeDetails();
actions.closeCards(); actions.closeCards();
actions.closeListing();
actions.closeContact(); actions.closeContact();
actions.openProfile(); actions.openProfile();
actions.closeConversation(); actions.closeConversation();

View File

@ -59,6 +59,26 @@ export const CardsWrapper = styled.div`
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: 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 { .dismiss {
@ -81,23 +101,24 @@ export const CardsWrapper = styled.div`
padding-bottom: 12px; padding-bottom: 12px;
padding-top: 12px; padding-top: 12px;
position: relative; position: relative;
}
.add { .add {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
color: ${Colors.primary}; color: ${Colors.primary};
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
border-radius: 4px; border-radius: 4px;
font-size: 14px; font-size: 14px;
cursor: pointer; cursor: pointer;
height: 100%; height: 100%;
flex-shrink: 0;
.label { .label {
padding-left: 8px; padding-left: 8px;
}
} }
} }
`; `;

View File

@ -20,6 +20,11 @@ export function CardItem({ item, open }) {
return profile?.handle; return profile?.handle;
} }
const resync = (e) => {
e.stopPropagation();
actions.resync();
};
return ( return (
<CardItemWrapper onClick={() => open(profile.guid)}> <CardItemWrapper onClick={() => open(profile.guid)}>
<Logo url={state.logo} width={32} height={32} radius={8} /> <Logo url={state.logo} width={32} height={32} radius={8} />
@ -30,7 +35,7 @@ export function CardItem({ item, open }) {
<div class="markup"> <div class="markup">
{ !state.resync && item.error && ( { !state.resync && item.error && (
<Tooltip placement="left" title="sync error"> <Tooltip placement="left" title="sync error">
<StatusError onClick={actions.resync}> <StatusError onClick={resync}>
<ExclamationCircleOutlined /> <ExclamationCircleOutlined />
</StatusError> </StatusError>
</Tooltip> </Tooltip>

View File

@ -44,7 +44,12 @@ export function useCards() {
if (state.sorted) { if (state.sorted) {
filtered.sort((a, b) => { 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;
} }
return 1; return 1;
@ -54,8 +59,10 @@ export function useCards() {
filtered.sort((a, b) => { filtered.sort((a, b) => {
const aUpdated = a?.data?.cardDetail?.statusUpdated; const aUpdated = a?.data?.cardDetail?.statusUpdated;
const bUpdated = b?.data?.cardDetail?.statusUpdated; const bUpdated = b?.data?.cardDetail?.statusUpdated;
if (aUpdated == bUpdated) {
if ((aUpdated && !bUpdated) || (aUpdated && bUpdated && aUpdated > bUpdated)) { return 0;
}
if (!aUpdated || (aUpdated < bUpdated)) {
return -1; return -1;
} }
return 1; return 1;

View File

@ -15,10 +15,14 @@ export const ChannelsWrapper = styled.div`
} }
.search { .search {
padding: 8px; padding-top: 8px;
padding-bottom: 8px;
padding-left: 16px;
padding-right: 16px;
border-bottom: 1px solid ${Colors.divider}; border-bottom: 1px solid ${Colors.divider};
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 48px;
.filter { .filter {
border: 1px solid ${Colors.divider}; border: 1px solid ${Colors.divider};

View File

@ -1,7 +1,7 @@
import { ContactWrapper } from './Contact.styled'; import { ContactWrapper } from './Contact.styled';
import { useContact } from './useContact.hook'; import { useContact } from './useContact.hook';
import { Logo } from 'logo/Logo'; 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 }) { export function Contact({ close, guid, listing }) {
@ -18,6 +18,12 @@ export function Contact({ close, guid, listing }) {
<div class="name"> <div class="name">
<div class="data">{ state.name }</div> <div class="data">{ state.name }</div>
</div> </div>
{ state.node && (
<div class="location">
<DatabaseOutlined />
<div class="data">{ state.node }</div>
</div>
)}
<div class="location"> <div class="location">
<EnvironmentOutlined /> <EnvironmentOutlined />
<div class="data">{ state.location }</div> <div class="data">{ state.location }</div>
@ -49,12 +55,19 @@ export function Contact({ close, guid, listing }) {
)} )}
{ state.init && state.display !== 'xlarge' && ( { state.init && state.display !== 'xlarge' && (
<div class="view"> <div class="view">
<div class="title">{ state.handle }</div> <div class="title">
<div class="section">Contact Profile</div> { state.display === 'small' && (
<div class="controls"> <div class="close"></div>
{ Image } )}
{ Details } <div class="handle">{ state.handle }</div>
{ state.display === 'small' && (
<div class="close" onClick={close}>
<CloseOutlined />
</div>
)}
</div> </div>
{ Image }
{ Details }
</div> </div>
)} )}
</ContactWrapper> </ContactWrapper>

View File

@ -27,7 +27,7 @@ export const ContactWrapper = styled.div`
} }
.close { .close {
font-size: 16px; font-size: 18px;
color: ${Colors.primary}; color: ${Colors.primary};
cursor: pointer; cursor: pointer;
padding-right: 16px; padding-right: 16px;
@ -48,6 +48,45 @@ export const ContactWrapper = styled.div`
width: 20vw; width: 20vw;
margin-right: 32px; 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 { .view {
@ -59,63 +98,75 @@ export const ContactWrapper = styled.div`
align-items: center; align-items: center;
.title { .title {
display: flex;
width: 100%;
flex-direction: row;
font-size: 18px; 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 { .logo {
position: relative; position: relative;
width: 80%; width: 50%;
margin-bottom: 16px; margin-bottom: 16px;
} }
.section { .details {
width: 100%;
color: ${Colors.grey};
padding-top: 16px;
font-size: 12px;
display: flex; display: flex;
justify-content: center; flex-direction: column;
}
}
.details {
display: flex;
flex-direction: column;
.name {
display: flex;
flex-direction: row;
align-items: center; align-items: center;
.data { .name {
padding-right: 8px; display: flex;
font-size: 24px; flex-direction: row;
font-weight: bold; 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;
}
}
} }
` `

View File

@ -12,6 +12,7 @@ export function useContact(guid, listing) {
location: null, location: null,
description: null, description: null,
handle: null, handle: null,
node: null,
removed: false, removed: false,
init: false, init: false,
}); });
@ -25,28 +26,20 @@ export function useContact(guid, listing) {
} }
useEffect(() => { useEffect(() => {
let logo, name, location, description, handle; let logo, name, location, description, handle, node;
let contact = card.actions.getCardByGuid(guid); let contact = card.actions.getCardByGuid(guid);
if (contact) { if (contact) {
let cardProfile = contact?.data?.cardProfile; let cardProfile = contact?.data?.cardProfile;
if (cardProfile.node != profile.state.profile.node) { handle = cardProfile.handle;
handle = cardProfile.handle + '@' + cardProfile.node; node = cardProfile.node;
}
else {
handle = cardProfile.handle;
}
logo = card.actions.getImageUrl(contact.id); logo = card.actions.getImageUrl(contact.id);
name = cardProfile.name; name = cardProfile.name;
location = cardProfile.location; location = cardProfile.location;
description = cardProfile.description; description = cardProfile.description;
} }
else if (listing) { else if (listing) {
if (listing.node != profile.state.profile.node) { handle = listing.handle;
handle = listing.handle + '@' + listing.node; node = listing.node;
}
else {
handle = listing.handle;
}
logo = listing.imageSet ? getListingImageUrl(listing.node, listing.guid) : null; logo = listing.imageSet ? getListingImageUrl(listing.node, listing.guid) : null;
name = listing.name; name = listing.name;
location = listing.location; location = listing.location;
@ -55,7 +48,7 @@ export function useContact(guid, listing) {
else { else {
updateState({ removed: true }); updateState({ removed: true });
} }
updateState({ init: true, logo, name, location, description, handle }); updateState({ init: true, logo, name, location, description, handle, node });
}, [card, guid, listing]); }, [card, guid, listing]);
useEffect(() => { useEffect(() => {

View File

@ -2,7 +2,7 @@ import { Checkbox } from 'antd';
import { ProfileWrapper } from './Profile.styled'; import { ProfileWrapper } from './Profile.styled';
import { useProfile } from './useProfile.hook'; import { useProfile } from './useProfile.hook';
import { Logo } from 'logo/Logo'; 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 }) { export function Profile({ closeProfile }) {
@ -23,6 +23,12 @@ export function Profile({ closeProfile }) {
<div class="data">{ state.name }</div> <div class="data">{ state.name }</div>
<EditOutlined /> <EditOutlined />
</div> </div>
{ state.node && (
<div class="location">
<DatabaseOutlined />
<div class="data">{ state.node }</div>
</div>
)}
<div class="location"> <div class="location">
<EnvironmentOutlined /> <EnvironmentOutlined />
<div class="data">{ state.location }</div> <div class="data">{ state.location }</div>

View File

@ -62,6 +62,45 @@ export const ProfileWrapper = styled.div`
cursor: pointer; 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 { .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 { .section {
width: 100%; width: 100%;
color: ${Colors.grey}; color: ${Colors.grey};
padding-top: 16px; padding-top: 32px;
font-size: 12px; font-size: 12px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -112,7 +191,7 @@ export const ProfileWrapper = styled.div`
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid ${Colors.divider}; border-top: 1px solid ${Colors.divider};
border-radius: 4px; border-radius: 4px;
padding: 8px; padding: 8px;
width: 75%; 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;
}
}
}
` `

View File

@ -19,9 +19,9 @@ export function useProfile() {
useEffect(() => { useEffect(() => {
if (profile.state.init) { 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(); 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]); }, [profile]);