forked from Keelrleek/SoulStream
community: a proposal on your board arrives as a toast, carried sealed through the inbox
This commit is contained in:
1 parent
4d03cf849b
commit
fd216ecd3d
6 files changed
+241
-1
No files matched your search
@@ -235,6 +235,27 @@ export function announceUpload(username, name) {
|
||||
uploadToast.seq += 1;
|
||||
}
|
||||
|
||||
/** Someone proposed a change to a playlist of ours (ProposalToast). The board
|
||||
* is only read on open and Refresh, so an arriving proposal would otherwise
|
||||
* be silent. One inbox check can dispatch several at once, so a burst on the
|
||||
* SAME playlist counts up inside one pill the way an album grab does. */
|
||||
export const proposalToast = $state({ seq: 0, from: "", playlist: "", count: 0 });
|
||||
const PROPOSAL_TOAST_WINDOW_MS = 8000;
|
||||
let proposalToastAt = 0;
|
||||
|
||||
export function announceProposal(from, playlist) {
|
||||
const now = Date.now();
|
||||
if (proposalToast.playlist === playlist && now - proposalToastAt < PROPOSAL_TOAST_WINDOW_MS) {
|
||||
proposalToast.count += 1;
|
||||
} else {
|
||||
proposalToast.playlist = playlist;
|
||||
proposalToast.count = 1;
|
||||
}
|
||||
proposalToast.from = from;
|
||||
proposalToastAt = now;
|
||||
proposalToast.seq += 1;
|
||||
}
|
||||
|
||||
/** Background-import status, read by ImportToast. The import window keeps
|
||||
* scanning/copying after it is closed (the component stays mounted, only
|
||||
* its template goes), and closed must never mean invisible: while work
|
||||
@@ -7787,6 +7808,7 @@ if (import.meta.env.DEV) {
|
||||
autoConnect, refreshSourcePrefs, _sourceAudit, sourcePrefs,
|
||||
playlistStore, refreshPlaylists, goToView, peekNextIndices,
|
||||
slsk, search, runSearch, uploadToast, announceUpload,
|
||||
proposalToast, announceProposal,
|
||||
searchTabs, selectSearchTab, closeSearchTab, filesForGroup,
|
||||
downloads, network, sendDm, openChat,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user