Skip to content

Commit

Permalink
Fix topZaps
Browse files Browse the repository at this point in the history
  • Loading branch information
moysa committed Sep 2, 2024
1 parent c909619 commit 5a4bd91
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/components/Note/Note.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@
display: flex;
align-items: center;
gap: 8px;
padding-left: 2px;
padding-left: 1px;
padding-right: 10px;
padding-block: 2px;
padding-block: 1px;
margin: 0;
border-radius: 12px;
background: var(--devider);
Expand Down Expand Up @@ -612,25 +612,25 @@
border-radius: 12px;
background: var(--text-primary);
width: fit-content;
min-height: 26px;
min-height: 28px;
max-width: 100%;
text-decoration: none;
border: none;
outline: none;

.zapIcon {
width: 10px;
height: 12px;
height: 14px;
background-color: var(--devider);
-webkit-mask: url(../../assets/icons/feed_zap_fill_2.svg) no-repeat 0 / 100%;
mask: url(../../assets/icons/feed_zap_fill_2.svg) no-repeat 0 / 100%;
}

.zapText {
color: var(--devider);
font-size: 12px;
font-size: 16px;
font-weight: 700;
line-height: 12px;
line-height: 18px;
}

&:hover {
Expand Down
22 changes: 11 additions & 11 deletions src/components/Note/NoteTopZaps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ const NoteTopZaps: Component<{
const topZaps = () => {
const zaps = [...(props.topZaps || [])];

let limit = 0;
let digits = 0;
let limit = 5;
// let digits = 0;

for (let i=0; i< zaps.length; i++) {
const amount = zaps[i].amount || 0;
const length = Math.log(amount) * Math.LOG10E + 1 | 0;
// for (let i=0; i< zaps.length; i++) {
// const amount = zaps[i].amount || 0;
// const length = Math.log(amount) * Math.LOG10E + 1 | 0;

digits += length;
// digits += length;

if (digits > 25 || limit > 6) break;
// if (digits > 25 || limit > 6) break;

limit++;
}
// limit++;
// }

const highlights = zaps.slice(0, limit);

setHasMoreZaps(() => highlights.length < props.zapCount - 1);
// setHasMoreZaps(() => highlights.length < props.zapCount - 1);

return highlights;
}
Expand Down Expand Up @@ -79,7 +79,7 @@ const NoteTopZaps: Component<{
onClick={() => props.action()}
style={`z-index: ${12 - index()};`}
>
<Avatar user={zapSender(zap)} size="micro" />
<Avatar user={zapSender(zap)} size="xss" />
<div class={styles.topZapIcon}></div>
<div class={styles.amount}>
{zap.amount.toLocaleString()}
Expand Down

0 comments on commit 5a4bd91

Please sign in to comment.