feat(dashboard): close legacy parity gaps
This commit is contained in:
1 parent
92287c0a9a
commit
4b3f00729f
21 files changed
+397
-28
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { useState } from 'react';
|
||||
import { useProcessedPostsQuery } from './conversation-queries.js';
|
||||
|
||||
export function ProcessedUserLookup() {
|
||||
const [input, setInput] = useState('');
|
||||
const [username, setUsername] = useState('');
|
||||
const postsQuery = useProcessedPostsQuery(username);
|
||||
|
||||
return (
|
||||
<section aria-labelledby="processed-user-heading" className="new-conversation-panel">
|
||||
<h2 id="processed-user-heading">Processed user lookup</h2>
|
||||
<form onSubmit={(event) => { event.preventDefault(); setUsername(input.trim().replace(/^u\//i, '')); }}>
|
||||
<label htmlFor="processed-user">Lookup Reddit username</label>
|
||||
<input id="processed-user" onChange={(event) => setInput(event.target.value)} value={input} />
|
||||
<button disabled={input.trim().length === 0} type="submit">Look up user</button>
|
||||
</form>
|
||||
{postsQuery.isPending && username ? <p role="status">Looking up processed posts…</p> : null}
|
||||
{postsQuery.isError ? <p role="alert">{postsQuery.error.message}</p> : null}
|
||||
{postsQuery.data ? (
|
||||
postsQuery.data.length === 0 ? <p>No processed posts found for u/{username}.</p> : (
|
||||
<ol aria-label={`Processed posts for u/${username}`}>
|
||||
{postsQuery.data.map((post) => <li key={post.id}><strong>{post.title}</strong><span>r/{post.subreddit} · {post.messageSent ? 'Message sent' : post.error ?? 'Processed'}</span></li>)}
|
||||
</ol>
|
||||
)
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user