feat: copy event json

This commit is contained in:
Kieran 2023-01-21 17:00:09 +00:00
parent 0f5364a7be
commit 079b4ff9a9
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 27 additions and 3 deletions

View File

@ -141,6 +141,10 @@ export default function NoteFooter(props: NoteFooterProps) {
await navigator.clipboard.writeText(hexToBech32("note", ev.Id));
}
async function copyEvent() {
await navigator.clipboard.writeText(JSON.stringify(ev.Original, undefined, ' '));
}
function menuItems() {
return (
<>
@ -160,7 +164,12 @@ export default function NoteFooter(props: NoteFooterProps) {
<FontAwesomeIcon icon={faCopy} />
Copy ID
</MenuItem>
{prefs.showDebugMenus && (
<MenuItem onClick={() => copyEvent()}>
<FontAwesomeIcon icon={faCopy} />
Copy Event JSON
</MenuItem>
)}
{isMine && (
<MenuItem onClick={() => deleteEvent()}>
<FontAwesomeIcon icon={faTrash} className="red" />

View File

@ -50,6 +50,15 @@ const PreferencesPage = () => {
<input type="checkbox" checked={perf.confirmReposts} onChange={e => dispatch(setPreferences({ ...perf, confirmReposts: e.target.checked }))} />
</div>
</div>
<div className="card flex">
<div className="flex f-col f-grow">
<div>Debug Menus</div>
<small>Shows extra options to help with debugging data</small>
</div>
<div>
<input type="checkbox" checked={perf.showDebugMenus} onChange={e => dispatch(setPreferences({ ...perf, showDebugMenus: e.target.checked }))} />
</div>
</div>
</div>
)
}

View File

@ -29,7 +29,12 @@ export interface UserPreferences {
/**
* Ask for confirmation when reposting notes
*/
confirmReposts: boolean
confirmReposts: boolean,
/**
* Show debugging menus to help diagnose issues
*/
showDebugMenus: boolean
}
export interface LoginStore {
@ -104,7 +109,8 @@ const InitState = {
enableReactions: true,
autoLoadMedia: true,
theme: "system",
confirmReposts: false
confirmReposts: false,
showDebugMenus: false
}
} as LoginStore;