diff --git a/src/app/pages/chat/chat.component.html b/src/app/pages/chat/chat.component.html index d256f00..a0aaec6 100755 --- a/src/app/pages/chat/chat.component.html +++ b/src/app/pages/chat/chat.component.html @@ -24,15 +24,18 @@

{{currentOnline}}

*ngFor="let message of messages" class="chat" > - - - - - {{message[0].author | author}}: - {{message[0].text}} + {{message[0].author | author}}: + {{message[0].text}} + + + + + + {{message[1]}} +
diff --git a/src/app/pages/chat/chat.component.ts b/src/app/pages/chat/chat.component.ts index bfb9b19..7f628e9 100755 --- a/src/app/pages/chat/chat.component.ts +++ b/src/app/pages/chat/chat.component.ts @@ -154,6 +154,7 @@ export class ChatComponent implements OnDestroy, OnInit { this.strangeIsTyping = true; this.scrollConversationToTheEnd(); } else if (event.content === 'disconnected') { + debugger; this.strangeIsTyping = false; this.whoDisconnected = MessageAuthor.STRANGE; this.currentState = ChatState.DISCONNECTED; diff --git a/src/app/shared/nostr/main.npool.ts b/src/app/shared/nostr/main.npool.ts index 3b61f48..cac03bf 100755 --- a/src/app/shared/nostr/main.npool.ts +++ b/src/app/shared/nostr/main.npool.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { NostrEvent, NostrFilter, NPool, NRelay1, NSet } from '@nostrify/nostrify'; +import { NostrEvent, NostrFilter, NPool, NRelay1 } from '@nostrify/nostrify'; import { RelayConfigService } from '@shared/relay-config/relay-config.service'; import { finalize, Observable, Subject } from 'rxjs'; @@ -27,7 +27,7 @@ export class NPoolService extends NPool { console.info(new Date().toLocaleString(),'[[subscribe filter]]', filters); const abort = new AbortController(); const subject = new Subject(); - const nset = new NSet(); + const nset = new Map(); (async () => { for await (const msg of this.req(filters, abort)) { @@ -36,10 +36,13 @@ export class NPoolService extends NPool { break; } else if (msg[0] === 'EVENT') { const nsetSize = nset.size; - nset.add(msg[2]); + nset.set(msg[2].id, msg[2]); if (nsetSize !== nset.size) { subject.next(msg[2]); + } else { + console.debug(new Date().toLocaleString(), 'event deduplicated, not emiting again: ', msg[2]); + console.debug(new Date().toLocaleString(), 'current nset from request: ', nset); } } } diff --git a/src/app/shared/omegle-service/talk-to-stranger.nostr.ts b/src/app/shared/omegle-service/talk-to-stranger.nostr.ts index 0692793..e73e239 100755 --- a/src/app/shared/omegle-service/talk-to-stranger.nostr.ts +++ b/src/app/shared/omegle-service/talk-to-stranger.nostr.ts @@ -8,7 +8,7 @@ import { finalize, Observable, Subject } from 'rxjs'; @Injectable() export class TalkToStrangerNostr { - readonly updateUserCountTimeout = 1000 * 60 * 2; + readonly updateUserCountTimeout = 1000 * 60 * 5; constructor( private nostrEventFactory: NostrEventFactory, diff --git a/src/styles.scss b/src/styles.scss index 28e1d37..18a1f0c 100755 --- a/src/styles.scss +++ b/src/styles.scss @@ -78,12 +78,55 @@ body { margin-bottom: 0.7rem; } -.messageNotSent { - color: #ff8100; - margin: -.5rem 1rem; +.errorWrap { + position: relative; + + .messageNotSent { + color: #ff8100; + margin: -.5rem 1rem; + cursor: pointer; + + &:hover ~ .errorMessage { + display: block; + } + } + + .errorMessage { + border: 1px solid; + border-radius: 5px; + padding: .5rem 1rem; + background-color: #ffdebd; + position: absolute; + display: none; + top: -.5rem; + + &:before, + &:after { + content: ""; + display: block; + border: 10px solid transparent; + width: 0px; + height: 0px; + z-index: 1; + position: absolute; + border-right-color: black; + white-space: nowrap; + left: -20px; + top: 10px; + } + + &:after { + z-index: 2; + border: 8px solid transparent; + border-right-color: #ffdebd; + left: -16px; + top: 12px; + } + } } .chat { + position: relative; margin-bottom: 0.7rem; }