-
Notifications
You must be signed in to change notification settings - Fork 84
Creation and Submission delay and status #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5110f21
add cancelable delay to reply and create note
ticruz38 77b23a4
final tweaks
ticruz38 d7a6777
remove note state from event object
ticruz38 5c92529
clearInterval on store
ticruz38 a088319
format and check
ticruz38 6f5890f
missing a status or a callback
ticruz38 2905089
missing import
ticruz38 e1020c3
use thunk for NoteCreate
ticruz38 c901f53
use thunks in replies
ticruz38 85566a5
migrate from publishes
ticruz38 e49d4cf
rebase and check
ticruz38 84d9f0d
- get rid of context in Note
ticruz38 3724ccd
bring the check back
ticruz38 33bc66f
use @welshman/app thunks store
ticruz38 aee49a3
remove callback addToContext
ticruz38 506ed2a
remove LOCAL_RELAY from statuses
ticruz38 48fca1a
sign event before sending
ticruz38 46f1796
delay configuration in seconds
ticruz38 75457ae
remove grouphints store
ticruz38 1ea380c
loading indicator until event is signed
ticruz38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<style> | ||
.loading-bar { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
height: 100%; | ||
} | ||
|
||
div.loading-bar::after { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
right: -50px; | ||
width: 50px; | ||
height: 100%; | ||
background: linear-gradient(to left, rgba(0, 0, 0, 0), var(--accent)); | ||
} | ||
|
||
.loading-bar-content > * { | ||
z-index: 1; | ||
} | ||
</style> | ||
|
||
<script lang="ts"> | ||
import {thunks, type Thunk} from "@welshman/app" | ||
import {PublishStatus} from "@welshman/net" | ||
import {LOCAL_RELAY_URL, type SignedEvent} from "@welshman/util" | ||
import {userSettings} from "src/engine" | ||
import Anchor from "src/partials/Anchor.svelte" | ||
import {timestamp1} from "src/util/misc" | ||
import {spring} from "svelte/motion" | ||
|
||
export let event: SignedEvent | ||
export let removeDraft: () => void | ||
|
||
$: thunk = $thunks[event.id] as Thunk | ||
|
||
$: status = thunk?.status | ||
$: relays = thunk?.request?.relays.filter(r => r !== LOCAL_RELAY_URL) | ||
$: statuses = Object.entries($status || {}) | ||
.filter(([k, v]) => k !== LOCAL_RELAY_URL) | ||
.map(([k, v]) => v) | ||
$: pendings = statuses.filter(s => s.status === PublishStatus.Pending).length | ||
$: failed = statuses.filter( | ||
s => s.status === PublishStatus.Failure || s.status === PublishStatus.Aborted, | ||
).length | ||
$: timeout = statuses.filter(s => s.status === PublishStatus.Timeout).length | ||
$: success = statuses.filter(s => s.status === PublishStatus.Success).length | ||
$: total = relays.length || 0 | ||
|
||
const completed = spring(0) | ||
|
||
$: { | ||
if (thunk) { | ||
$completed = ((total - pendings) / total) * 100 | ||
} | ||
} | ||
|
||
$: isPending = pendings > 0 | ||
$: isCompleted = total === success + failed + timeout | ||
</script> | ||
|
||
<div | ||
class="loading-bar-content relative flex h-6 w-full items-center justify-between overflow-hidden rounded-md pl-4 text-sm" | ||
class:border={!thunk} | ||
on:click|stopPropagation> | ||
{#if thunk && (isPending || isCompleted)} | ||
<div class="loading-bar bg-accent" style="width: {$completed}%"></div> | ||
{#if isPending} | ||
<span>Publishing...</span> | ||
<span>{total - pendings} of {total} relays</span> | ||
{:else} | ||
<span>Published to {success}/{total} ({failed} failed, {timeout} timed out)</span> | ||
<Anchor | ||
class="staatliches z-feature rounded-r-md bg-tinted-100-d px-4 py-1 uppercase text-tinted-700-d" | ||
modal | ||
href="/publishes">See details</Anchor> | ||
{/if} | ||
{:else if $userSettings.send_delay > 0} | ||
<span | ||
>Sending reply in {event.created_at + | ||
Math.ceil($userSettings.send_delay / 1000) - | ||
$timestamp1} seconds</span> | ||
|
||
<button | ||
class="ml-2 cursor-pointer rounded-md bg-neutral-100-d px-4 py-1 text-tinted-700-d" | ||
on:click={() => { | ||
removeDraft() | ||
}}>Cancel</button> | ||
{/if} | ||
</div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.