mirror of
https://github.com/balzack/databag.git
synced 2025-05-05 07:55:15 +00:00
rendering channel item
This commit is contained in:
parent
6365145df7
commit
eeceb9a46f
@ -13,14 +13,22 @@ console.log(item.contacts);
|
|||||||
<div class="logo">
|
<div class="logo">
|
||||||
<SolutionOutlined />
|
<SolutionOutlined />
|
||||||
</div>
|
</div>
|
||||||
<div class="subject">{ item.subject }</div>
|
<div class="details">
|
||||||
|
<div class="subject">{ item.subject }</div>
|
||||||
|
<div class="message">{ item.message }</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ item.contacts.length === 1 && (
|
{ item.contacts.length === 1 && (
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<Logo url={item.logo} width={32} height={32} radius={8} />
|
<Logo url={item.logo} width={32} height={32} radius={8} />
|
||||||
<div class="subject">{ item.subject }</div>
|
<div class="details">
|
||||||
<div class="markup"></div>
|
<div class="subject">{ item.subject }</div>
|
||||||
|
<div class="message">{ item.message }</div>
|
||||||
|
</div>
|
||||||
|
{ item.updated && (
|
||||||
|
<div class="markup"></div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ item.contacts.length > 1 && (
|
{ item.contacts.length > 1 && (
|
||||||
@ -28,8 +36,13 @@ console.log(item.contacts);
|
|||||||
<div class="logo">
|
<div class="logo">
|
||||||
<AppstoreFilled />
|
<AppstoreFilled />
|
||||||
</div>
|
</div>
|
||||||
<div class="subject">{ item.subject }</div>
|
<div class="details">
|
||||||
<div class="markup"></div>
|
<div class="subject">{ item.subject }</div>
|
||||||
|
<div class="message">{ item.message }</div>
|
||||||
|
</div>
|
||||||
|
{ item.updated && (
|
||||||
|
<div class="markup"></div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</ChannelItemWrapper>
|
</ChannelItemWrapper>
|
||||||
|
@ -19,6 +19,7 @@ export const ChannelItemWrapper = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -29,14 +30,39 @@ export const ChannelItemWrapper = styled.div`
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subject {
|
.details {
|
||||||
padding-left: 16px;
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 16px;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
.subject {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: ${Colors.disabled};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.markup {
|
.markup {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: ${Colors.background};
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -86,6 +86,20 @@ export function useChannels() {
|
|||||||
chan.subject = subject;
|
chan.subject = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setMessage = (chan) => {
|
||||||
|
let message = "";
|
||||||
|
if (chan.data.channelSummary?.lastTopic?.dataType === 'superbasictopic') {
|
||||||
|
try {
|
||||||
|
message = JSON.parse(chan.data.channelSummary.lastTopic.data).text;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chan.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let merged = [];
|
let merged = [];
|
||||||
card.state.cards.forEach((value, key, map) => {
|
card.state.cards.forEach((value, key, map) => {
|
||||||
@ -104,6 +118,7 @@ export function useChannels() {
|
|||||||
setUpdated(chan);
|
setUpdated(chan);
|
||||||
setContacts(chan);
|
setContacts(chan);
|
||||||
setSubject(chan);
|
setSubject(chan);
|
||||||
|
setMessage(chan);
|
||||||
});
|
});
|
||||||
|
|
||||||
const filtered = merged.filter((chan) => {
|
const filtered = merged.filter((chan) => {
|
||||||
|
@ -9,7 +9,7 @@ export const IdentityWrapper = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
border-bottom: 1px solid ${Colors.divider};
|
border-bottom: 3px solid ${Colors.divider};
|
||||||
background-color: ${Colors.formBackground};
|
background-color: ${Colors.formBackground};
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user