mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 09:50:19 +00:00
Fix activity is new (#2923)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
650e65a7f9
commit
556cfb31d0
plugins
activity-resources/src/components
contact-resources/src/components/activity
@ -88,7 +88,7 @@
|
||||
if (lastView === undefined || lastView === -1) return -1
|
||||
for (let index = 0; index < txes.length; index++) {
|
||||
const tx = txes[index]
|
||||
if (tx.tx.modifiedOn <= lastView) return index - 1
|
||||
if (tx.tx.modifiedOn > lastView) return index - 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
@ -109,7 +109,7 @@
|
||||
{#if filtered}
|
||||
<Grid column={1} rowGap={0.75}>
|
||||
{#each filtered as tx, i}
|
||||
<TxView {tx} {viewlets} isNew={newTxPos >= i && newTxPos !== -1} isNextNew={newTxPos > i && newTxPos !== -1} />
|
||||
<TxView {tx} {viewlets} isNew={newTxPos < i && newTxPos !== -1} isNextNew={newTxPos <= i && newTxPos !== -1} />
|
||||
{/each}
|
||||
</Grid>
|
||||
{/if}
|
||||
|
@ -83,9 +83,7 @@
|
||||
): Promise<void> {
|
||||
if (selected === 'All') {
|
||||
filtered = txes
|
||||
if (extraComponent === undefined) {
|
||||
dispatch('update', filtered)
|
||||
}
|
||||
dispatch('update', filtered)
|
||||
} else {
|
||||
const selectedFilters = filters.filter((filter) => selected.includes(filter._id))
|
||||
const filterActions: ((tx: DisplayTx, _class?: Ref<Doc>) => boolean)[] = []
|
||||
@ -96,9 +94,7 @@
|
||||
filterActions.push(fltr)
|
||||
}
|
||||
filtered = txes.filter((it) => filterActions.some((f) => f(it, object._class)))
|
||||
if (extraComponent === undefined) {
|
||||
dispatch('update', filtered)
|
||||
}
|
||||
dispatch('update', filtered)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,10 +419,10 @@
|
||||
.icon {
|
||||
border: 1px solid var(--highlight-red);
|
||||
}
|
||||
&.isNextNew {
|
||||
&:after {
|
||||
background-color: var(--highlight-red);
|
||||
}
|
||||
}
|
||||
&.isNextNew {
|
||||
&::after {
|
||||
background-color: var(--highlight-red);
|
||||
}
|
||||
}
|
||||
&::before {
|
||||
|
@ -43,6 +43,8 @@
|
||||
}
|
||||
)
|
||||
|
||||
let newTxes: DisplayTx[] = []
|
||||
|
||||
const txQuery = createQuery()
|
||||
$: txQuery.query(
|
||||
core.class.TxCollectionCUD,
|
||||
@ -52,12 +54,17 @@
|
||||
'tx.attributes.incoming': false
|
||||
},
|
||||
(res) => {
|
||||
const newTxes = createDisplayTxes(res)
|
||||
const result = filtered.concat(newTxes).sort((a, b) => a.tx.modifiedOn - b.tx.modifiedOn)
|
||||
dispatch('update', result)
|
||||
newTxes = createDisplayTxes(res)
|
||||
}
|
||||
)
|
||||
|
||||
function update (filtered: DisplayTx[], newTxes: DisplayTx[]) {
|
||||
const result = filtered.concat(newTxes).sort((a, b) => a.tx.modifiedOn - b.tx.modifiedOn)
|
||||
dispatch('update', result)
|
||||
}
|
||||
|
||||
$: update(filtered, newTxes)
|
||||
|
||||
function createDisplayTxes (txes: TxCollectionCUD<Doc, AttachedDoc>[]): DisplayTx[] {
|
||||
return txes.map((p) => newDisplayTx(TxProcessor.extractTx(p) as TxCUD<Doc>, hierarchy))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user