mirror of
https://github.com/balzack/databag.git
synced 2025-05-05 07:55:15 +00:00
render message for empty list
This commit is contained in:
parent
5820ec7e2d
commit
8fe49041cf
@ -4,7 +4,7 @@ import { SelectItem } from './selectItem/SelectItem';
|
|||||||
import { useCardSelect } from './useCardSelect.hook';
|
import { useCardSelect } from './useCardSelect.hook';
|
||||||
import { Logo } from 'logo/Logo';
|
import { Logo } from 'logo/Logo';
|
||||||
|
|
||||||
export function CardSelect({ filter, unknown, select, selected, markup }) {
|
export function CardSelect({ filter, unknown, select, selected, markup, emptyMessage }) {
|
||||||
|
|
||||||
const { state } = useCardSelect(filter);
|
const { state } = useCardSelect(filter);
|
||||||
|
|
||||||
@ -17,6 +17,9 @@ export function CardSelect({ filter, unknown, select, selected, markup }) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{ !state.cards?.length && (
|
||||||
|
<div class="empty">{ emptyMessage }</div>
|
||||||
|
)}
|
||||||
{ unknown > 0 && (
|
{ unknown > 0 && (
|
||||||
<div class="unknown">
|
<div class="unknown">
|
||||||
<Logo img="avatar" width={32} height={32} radius={8} />
|
<Logo img="avatar" width={32} height={32} radius={8} />
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import Colors from 'constants/Colors';
|
||||||
|
|
||||||
export const CardSelectWrapper = styled.div`
|
export const CardSelectWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-style: italic;
|
||||||
|
color: ${Colors.grey};
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.unknown {
|
.unknown {
|
||||||
height: 48px;
|
height: 48px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -42,10 +42,15 @@ export function Cards({ closeCards, openContact, openListing }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.cards} gutter="0"
|
{ state.cards.length > 0 && (
|
||||||
renderItem={item => (
|
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.cards} gutter="0"
|
||||||
<CardItem item={item} open={openContact} />
|
renderItem={item => (
|
||||||
)} />
|
<CardItem item={item} open={openContact} />
|
||||||
|
)} />
|
||||||
|
)}
|
||||||
|
{ state.cards.length == 0 && (
|
||||||
|
<div class="empty">No Contacts</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{ state.display !== 'small' && (
|
{ state.display !== 'small' && (
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
|
@ -12,6 +12,15 @@ export const CardsWrapper = styled.div`
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-style: italic;
|
||||||
|
color: ${Colors.grey};
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
|
@ -47,11 +47,16 @@ export function Channels({ open, active }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.channels} gutter="0"
|
{ state.channels.length > 0 && (
|
||||||
renderItem={item => (
|
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.channels} gutter="0"
|
||||||
<ChannelItem item={item} openChannel={open} active={active} />
|
renderItem={item => (
|
||||||
)}
|
<ChannelItem item={item} openChannel={open} active={active} />
|
||||||
/>
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{ state.channels.length == 0 && (
|
||||||
|
<div class="empty">No Topics</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{ state.display !== 'small' && (
|
{ state.display !== 'small' && (
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
|
@ -12,6 +12,15 @@ export const ChannelsWrapper = styled.div`
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-style: italic;
|
||||||
|
color: ${Colors.grey};
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
|
@ -18,6 +18,7 @@ export function AddChannel({ state, actions }) {
|
|||||||
<CardSelect
|
<CardSelect
|
||||||
select={actions.onMember}
|
select={actions.onMember}
|
||||||
selected={state.members}
|
selected={state.members}
|
||||||
|
emptyMessage={'No Connected Contacts'}
|
||||||
filter={(card) => card?.data?.cardDetail?.status === 'connected'}
|
filter={(card) => card?.data?.cardDetail?.status === 'connected'}
|
||||||
unknown={0}
|
unknown={0}
|
||||||
/>
|
/>
|
||||||
|
@ -42,10 +42,15 @@ export function Listing({ closeListing, openContact }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.contacts} gutter="0"
|
{ state.contacts.length > 0 && (
|
||||||
renderItem={item => (
|
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.contacts} gutter="0"
|
||||||
<ListingItem item={item} node={state.node} open={openContact} />
|
renderItem={item => (
|
||||||
)} />
|
<ListingItem item={item} node={state.node} open={openContact} />
|
||||||
|
)} />
|
||||||
|
)}
|
||||||
|
{ state.contacts.length == 0 && (
|
||||||
|
<div class="empty">No Contacts</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ListingWrapper>
|
</ListingWrapper>
|
||||||
);
|
);
|
||||||
|
@ -12,6 +12,15 @@ export const ListingWrapper = styled.div`
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-style: italic;
|
||||||
|
color: ${Colors.grey};
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user