-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
104 additions
and
144 deletions.
There are no files selected for viewing
This file contains 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 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 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
102 changes: 0 additions & 102 deletions
102
packages/app/src/Element/Event/Create/NoteBroadcaster.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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 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,60 @@ | ||
import AsyncButton from "@/Element/Button/AsyncButton"; | ||
import useEventPublisher from "@/Hooks/useEventPublisher"; | ||
import useLogin from "@/Hooks/useLogin"; | ||
import Icon from "@/Icons/Icon"; | ||
import { removeRelay } from "@/Login"; | ||
import { saveRelays } from "@/Pages/settings/Relays"; | ||
import { getRelayName } from "@/SnortUtils"; | ||
import { unwrap, sanitizeRelayUrl } from "@snort/shared"; | ||
import { OkResponse } from "@snort/system"; | ||
import { useState } from "react"; | ||
import { useIntl } from "react-intl"; | ||
|
||
export function OkResponseRow({ rsp }: { rsp: OkResponse }) { | ||
const [r, setResult] = useState(rsp); | ||
const { formatMessage } = useIntl(); | ||
const { publisher, system } = useEventPublisher(); | ||
const login = useLogin(); | ||
|
||
async function removeRelayFromResult(r: OkResponse) { | ||
if (publisher) { | ||
removeRelay(login, unwrap(sanitizeRelayUrl(r.relay))); | ||
await saveRelays(system, publisher, login.relays.item); | ||
} | ||
} | ||
|
||
async function retryPublish(r: OkResponse) { | ||
const rsp = await system.WriteOnceToRelay(unwrap(sanitizeRelayUrl(r.relay)), r.event); | ||
setResult(rsp); | ||
} | ||
|
||
return <div className="flex items-center g16"> | ||
<Icon name={r.ok ? "check" : "x"} className={r.ok ? "success" : "error"} size={24} /> | ||
<div className="flex flex-col grow g4"> | ||
<b>{getRelayName(r.relay)}</b> | ||
{r.message && <small>{r.message}</small>} | ||
</div> | ||
{!r.ok && ( | ||
<div className="flex g8"> | ||
<AsyncButton | ||
onClick={() => retryPublish(r)} | ||
className="p4 br-compact flex items-center secondary" | ||
title={formatMessage({ | ||
defaultMessage: "Retry publishing", | ||
id: "9kSari", | ||
})}> | ||
<Icon name="refresh-ccw-01" /> | ||
</AsyncButton> | ||
<AsyncButton | ||
onClick={() => removeRelayFromResult(r)} | ||
className="p4 br-compact flex items-center secondary" | ||
title={formatMessage({ | ||
defaultMessage: "Remove from my relays", | ||
id: "UJTWqI", | ||
})}> | ||
<Icon name="trash-01" className="trash-icon" /> | ||
</AsyncButton> | ||
</div> | ||
)} | ||
</div> | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
.toaster { | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
bottom: 2px; | ||
left: 2px; | ||
display: flex; | ||
flex-direction: column-reverse; | ||
z-index: 9999; | ||
} | ||
|
||
.toaster > .card { | ||
border: 1px solid var(--gray); | ||
} | ||
gap: 4px; | ||
} |
This file contains 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 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 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