Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c48c0ce
Keep the project and profile pages on screen after owner and admin ac…
Mistium Oct 8, 2026
355a3ca
Stop comment search retrying forever and show comment errors where th…
Mistium Oct 8, 2026
f4862db
Reload challenges when their phase changes and keep judge drafts acro…
Mistium Oct 8, 2026
2513dc1
Confirm bans and suspensions on the admin user page and keep actions …
Mistium Oct 8, 2026
144e041
Keep wallet activity while claiming and count down to the next daily …
Mistium Oct 8, 2026
b2a4a8b
Tell permission errors apart from bans and keep Rotur sessions alive …
Mistium Oct 8, 2026
0d34a5e
Show chat signing failures and retry signing after temporary errors
Mistium Oct 8, 2026
066c562
Fix the search box enterkeyhint warning and extract community strings
Mistium Oct 8, 2026
70723cf
Build translated sentences around links instead of gluing fragments t…
Mistium Oct 8, 2026
dfc4c4e
Trust the server's challenge phase, keep judges off their own entry a…
Mistium Oct 8, 2026
7f71d82
Translate admin standing and report labels and refresh the list and b…
Mistium Oct 8, 2026
8678687
Explain a hidden Rotur balance and file undated transactions under an…
Mistium Oct 8, 2026
644dacb
Show why a redirect sign-in failed and test session refresh fallbacks
Mistium Oct 8, 2026
9bf2b2e
Count comment changes outside state updaters
Mistium Oct 8, 2026
b1b27f3
Skip the expected storage error inside the sandboxed project player
Mistium Oct 8, 2026
500bd36
Extract community strings and drop the ones this pass replaced
Mistium Oct 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/community-extract.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const record = (text, source, line) => {
if (!locations[text]) locations[text] = [];
locations[text].push(`${path.relative(root, source)}:${line}`);
};
const MESSAGE_FUNCTIONS = ['communityText', 'communityRich', 'text', 't', 'formatCommunityMessage'];
const visit = directory => {
for (const entry of fs.readdirSync(directory, {withFileTypes: true})) {
const source = path.join(directory, entry.name);
Expand All @@ -28,7 +29,7 @@ const visit = directory => {
const ast = parse(fs.readFileSync(source, 'utf8'), {sourceType: 'module', plugins: ['jsx']});
traverse(ast, {
CallExpression ({node}) {
if (!['communityText', 'text', 't', 'formatCommunityMessage'].includes(node.callee.name)) return;
if (!MESSAGE_FUNCTIONS.includes(node.callee.name)) return;
const argument = node.arguments[0];
if (argument?.type === 'StringLiteral') record(argument.value, source, argument.loc.start.line);
},
Expand Down
8 changes: 7 additions & 1 deletion src/community/UserContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
login as identityLogin,
logout as identityLogout
} from '../lib/rotur/identity.js';
import {takeRedirectError} from '../lib/rotur/oauth.js';

const UserContext = createContext({user: null, login: () => {}, loginOrThrow: () => {}, logout: () => {}});

Expand Down Expand Up @@ -151,7 +152,12 @@ const UserProvider = ({children}) => {

useEffect(() => {
const unsubscribe = subscribeIdentity(handleIdentity);
identityRestore();
Promise.resolve(identityRestore())
.catch(() => null)
.then(() => {
const message = takeRedirectError();
if (message) setSignInError(signInErrorMessage({message}));
});
return unsubscribe;
}, [handleIdentity]);

Expand Down
105 changes: 51 additions & 54 deletions src/community/components/CommentThread.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ const CommentThread = ({
const [replyTo, setReplyTo] = useState(null);
const [replyText, setReplyText] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState(null);
const [errorState, setErrorState] = useState(null);
const setError = useCallback((message, target = 'general') => {
setErrorState(message ? {text: message, target} : null);
}, []);
const errorFor = target => (errorState && errorState.target === target ? errorState.text : null);
const [loadingComments, setLoadingComments] = useState(true);
const [loadFailed, setLoadFailed] = useState(false);
const [reportId, setReportId] = useState(null);
Expand All @@ -359,6 +363,7 @@ const CommentThread = ({
const [nextOffset, setNextOffset] = useState(0);
const [loadingMore, setLoadingMore] = useState(false);
const [moreFailed, setMoreFailed] = useState(false);
const failedFullLoad = useRef('');
const [allCommentsLoaded, setAllCommentsLoaded] = useState(false);
const sourceRef = useRef(source);
const viewerRef = useRef(viewerName);
Expand Down Expand Up @@ -484,36 +489,45 @@ const CommentThread = ({
load();
}, [beginExtraLoad, load]);

const latestComments = useRef(comments);
latestComments.current = comments;
const commentChanges = useRef(null);
commentChanges.current = {
created: comment => {
if (latestComments.current.some(item => item.id === comment.id)) return;
latestComments.current = addCreatedComment(latestComments.current, comment);
setComments(current => (current.some(item => item.id === comment.id) ?
current :
addCreatedComment(current, comment)));
if (!comment.parent) {
setTotalRoots(total => total + 1);
setNextOffset(offset => offset + 1);
}
if (onCountChange) onCountChange(1);
},
removed: commentId => {
const gone = item => item.id === commentId || item.parent === commentId;
const removed = latestComments.current.filter(gone);
if (!removed.length) return;
latestComments.current = latestComments.current.filter(item => !gone(item));
setComments(current => current.filter(item => !gone(item)));
if (removed.some(item => !item.parent)) {
setTotalRoots(total => Math.max(0, total - 1));
setNextOffset(offset => Math.max(0, offset - 1));
}
if (onCountChange) onCountChange(-removed.length);
}
};

useEffect(() => {
if (!source.subscribe) return;
return source.subscribe(event => {
if (event.type === 'comment_created' && event.comment) {
setComments(current => {
if (current.some(comment => comment.id === event.comment.id)) return current;
if (!event.comment.parent) {
setTotalRoots(total => total + 1);
setNextOffset(offset => offset + 1);
}
if (onCountChange) onCountChange(1);
return addCreatedComment(current, event.comment);
});
commentChanges.current.created(event.comment);
return;
}
if (event.type === 'comment_deleted' && event.commentId) {
setComments(current => {
const removed = current.filter(comment => (
comment.id === event.commentId || comment.parent === event.commentId
));
if (!removed.length) return current;
if (removed.some(comment => !comment.parent)) {
setTotalRoots(total => Math.max(0, total - 1));
setNextOffset(offset => Math.max(0, offset - 1));
}
if (onCountChange) onCountChange(-removed.length);
return current.filter(comment => (
comment.id !== event.commentId && comment.parent !== event.commentId
));
});
commentChanges.current.removed(event.commentId);
return;
}
if (event.type === 'comment_edited' && event.comment) {
Expand All @@ -531,7 +545,7 @@ const CommentThread = ({
}));
}
});
}, [source, onCountChange]);
}, [source]);

const loadMore = async () => {
if (loadingMore || nextOffset >= totalRoots) return;
Expand Down Expand Up @@ -559,6 +573,8 @@ const CommentThread = ({
useEffect(() => {
if (!projectComments || allCommentsLoaded || loadingComments || loadingMore) return;
if (!search.trim() && kindFilter === 'all') return;
const loadKey = `${search.trim()}\u0000${kindFilter}\u0000${sortOrder}`;
if (failedFullLoad.current === loadKey) return;
const actionSource = source;
const actionViewer = viewerName;
const fresh = beginExtraLoad();
Expand All @@ -578,6 +594,7 @@ const CommentThread = ({
setLoadingMore(false);
}))
.catch(fresh(() => {
failedFullLoad.current = loadKey;
setMoreFailed(true);
setLoadingMore(false);
}));
Expand Down Expand Up @@ -606,7 +623,7 @@ const CommentThread = ({
if (!text.trim()) return;
const attachedDonation = parent ? 0 : parseCommentDonation(donation);
if (attachedDonation === null) {
setError(communityText('Enter a donation between 0.01 and 100000 credits.'));
setError(communityText('Enter a donation between 0.01 and 100000 credits.'), 'root');
return;
}
const actionSource = source;
Expand All @@ -625,17 +642,7 @@ const CommentThread = ({
}) : await actionSource.add(text.trim(), parent, commentKind);
if (!parent) writeSessionDraft(`comment:${actionDraftKey}`, '');
if (sourceRef.current !== actionSource || viewerRef.current !== actionViewer) return;
if (data && data.comment) {
setComments(current => {
if (current.some(comment => comment.id === data.comment.id)) return current;
if (!data.comment.parent) {
setTotalRoots(total => total + 1);
setNextOffset(offset => offset + 1);
}
if (onCountChange) onCountChange(1);
return addCreatedComment(current, data.comment);
});
}
if (data && data.comment) commentChanges.current.created(data.comment);
if (parent) {
setReplyText('');
setReplyTo(null);
Expand All @@ -648,7 +655,7 @@ const CommentThread = ({
if (sourceRef.current === actionSource && viewerRef.current === actionViewer) {
setError(e.cancelled ?
communityText('Payment cancelled.') :
(e.message || communityText('Could not post comment.')));
(e.message || communityText('Could not post comment.')), parent || 'root');
}
} finally {
releaseAction();
Expand All @@ -666,24 +673,14 @@ const CommentThread = ({
const releaseAction = beginAction(actionSource, actionViewer, `remove:${commentId}`);
if (!releaseAction) return;
setRemovingId(commentId);
const removingComment = comments.find(comment => comment.id === commentId);
try {
await actionSource.remove(commentId);
if (sourceRef.current !== actionSource || viewerRef.current !== actionViewer) return;
setComments(current => {
const removedCount = current.filter(c => c.id === commentId || c.parent === commentId).length;
if (!removedCount) return current;
if (removingComment && !removingComment.parent) {
setTotalRoots(total => Math.max(0, total - 1));
setNextOffset(offset => Math.max(0, offset - 1));
}
if (onCountChange) onCountChange(-removedCount);
return current.filter(c => c.id !== commentId && c.parent !== commentId);
});
commentChanges.current.removed(commentId);
setDeleteId(null);
} catch (e) {
if (sourceRef.current === actionSource && viewerRef.current === actionViewer) {
setError(e.message || communityText('Could not delete comment.'));
setError(e.message || communityText('Could not delete comment.'), 'delete');
}
} finally {
releaseAction();
Expand Down Expand Up @@ -847,7 +844,7 @@ const CommentThread = ({
placeholder={communityText('Add a comment')}
ariaLabel={communityText('Add a comment')}
busy={busy}
error={replyTo === null ? error : null}
error={errorFor('root') || (replyTo === null ? errorFor('general') : null)}
kind={projectComments ? kind : null}
onKindChange={projectComments ? setKind : null}
composerAction={composerAction}
Expand Down Expand Up @@ -1019,7 +1016,7 @@ const CommentThread = ({
placeholder={communityText('Reply to {value1}', {value1: comment.author})}
ariaLabel={communityText('Write a reply')}
busy={busy}
error={error}
error={errorFor(comment.id)}
/>
) : null}
</div>
Expand Down Expand Up @@ -1069,7 +1066,7 @@ const CommentThread = ({
{communityText('No comments match those filters.')}
</EmptyState>
) : null}
{!loadingComments && !loadFailed && !comments.length ? (
{!disabled && !loadingComments && !loadFailed && !comments.length ? (
<EmptyState compact icon={MessageSquare} title={communityText('No comments yet')}>
{communityText('Be the first to leave a comment.')}
</EmptyState>
Expand All @@ -1093,7 +1090,7 @@ const CommentThread = ({
confirmLabel={communityText('Delete comment')}
busy={removingId !== null}
busyLabel={communityText('Deleting…')}
error={error}
error={errorFor('delete')}
onConfirm={() => remove(deleteComment.id)}
onCancel={() => setDeleteId(null)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/community/components/ExploreHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ExploreSearch = ({ariaLabel, onChange, onSubmit, placeholder, value}) => {
<Search size={16} aria-hidden="true" />
<input
aria-label={ariaLabel}
enterKeyHint="search"
enterkeyhint="search"
placeholder={placeholder || ariaLabel}
type="search"
value={value}
Expand Down
4 changes: 2 additions & 2 deletions src/community/components/HomeWorkspace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const selectRecentWinner = (spaces, now = Date.now()) => spaces
.sort((a, b) => Number(b.resultsPublishedAt) - Number(a.resultsPublishedAt))[0];

const ChallengeWinnerCard = ({challenge}) => {
const {text: communityText} = useCommunityText();
const {text: communityText, rich: communityRich} = useCommunityText();
const winner = challenge.winner;
const [burst, replay] = useCelebration(`challenge:${challenge._id}:${winner.id}`);
return (
Expand All @@ -242,7 +242,7 @@ const ChallengeWinnerCard = ({challenge}) => {
<div className={styles.winnerText}>
<h2><Link to={projectUrl(winner)} onClick={() => track('challenge_winner_open', {source: 'home'})}>{winner.title}</Link></h2>
<p>{communityText('Winner of {value1}', {value1: challenge.title})}</p>
<p>{communityText('by')}{' '}<UserLink username={winner.owner}>{winner.owner}</UserLink></p>
<p>{communityRich('by {user}', {user: <UserLink username={winner.owner}>{winner.owner}</UserLink>})}</p>
</div>
<div className={styles.winnerActions}>
<Button as={Link} to={projectUrl(winner)} variant="primary" onClick={() => track('challenge_winner_open', {source: 'home'})}><Play size={16} />{communityText('Play the winner')}</Button>
Expand Down
14 changes: 6 additions & 8 deletions src/community/components/MyStuffLibrary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {BookmarkMinus, Clock3, Eye, EyeOff, Library, MoreHorizontal} from 'lucide-react';
import {Link} from 'react-router-dom';
import {formatPlaytime, timeAgo} from '../format';
import {formatPlaytime, timeAgoText} from '../format';
import {projectUrl} from '../api';
import ProjectThumbnail from './ProjectThumbnail.jsx';
import Button from './ui/Button.jsx';
Expand All @@ -23,17 +23,14 @@ const playtimeLabel = project => {

const lastPlayedLabel = project => {
if (!(project.lastPlayed > 0)) return '';
const relative = timeAgo(project.lastPlayed);
return relative === 'just now' ?
formatCommunityMessage('Played just now') :
formatCommunityMessage('Last played {value1} ago', {value1: relative});
return formatCommunityMessage('Last played {value1}', {value1: timeAgoText(project.lastPlayed)});
};

const MyStuffLibrary = ({
projects, total, loading, error, moreBusy, hasMore, actionBusy, actionError,
onRetry, onLoadMore, onChangeVisibility, onRemove
}) => {
const {text: communityText} = useCommunityText();
const {text: communityText, rich: communityRich} = useCommunityText();
let body;
if (loading) {
body = <StatusMessage compact>{communityText('Loading your library…')}</StatusMessage>;
Expand All @@ -56,8 +53,9 @@ const MyStuffLibrary = ({
<span className={styles.details}>
<Link to={projectUrl(project)}><strong>{project.title}</strong></Link>
<small>
{communityText('by')}{' '}
<UserLink username={project.owner}>{project.owner}</UserLink>
{communityRich('by {user}', {
user: <UserLink username={project.owner}>{project.owner}</UserLink>
})}
</small>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/community/components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const SearchBox = ({className, containerRef, inputRef, query, onQuery, onFocus,
<>
<ProjectThumbnail project={project} className={styles.suggestionThumb} fallbackClassName={styles.suggestionThumbFallback} />
<span>{project.title}</span>
<span className={styles.suggestionMeta}>{communityText('by ')}{project.owner}</span>
<span className={styles.suggestionMeta}>{communityText('by {user}', {user: project.owner})}</span>
</>
)
}))
Expand Down
14 changes: 6 additions & 8 deletions src/community/components/PlaytimeLibrary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';
import {Clock3, Gamepad2} from 'lucide-react';
import {Link} from 'react-router-dom';
import {projectUrl} from '../api';
import {formatPlaytime, timeAgo} from '../format';
import {formatPlaytime, timeAgoText} from '../format';
import ProjectThumbnail from './ProjectThumbnail.jsx';
import Button from './ui/Button.jsx';
import EmptyState from './ui/EmptyState.jsx';
Expand All @@ -15,16 +15,13 @@ import styles from './PlaytimeLibrary.module.css';
const lastPlayed = value => {
const timestamp = Number(value);
if (!(timestamp > 0)) return '';
const relative = timeAgo(timestamp);
return relative === 'just now' ?
formatCommunityMessage('Played just now') :
formatCommunityMessage('Played {value1} ago', {value1: relative});
return formatCommunityMessage('Played {value1}', {value1: timeAgoText(timestamp)});
};

const PlaytimeLibrary = ({
projects, total, visible, self, loading, error, moreBusy, hasMore, onRetry, onLoadMore
}) => {
const {text: communityText} = useCommunityText();
const {text: communityText, rich: communityRich} = useCommunityText();
if (loading) return <StatusMessage compact>{communityText('Loading game library…')}</StatusMessage>;
if (error) {
return (
Expand Down Expand Up @@ -75,8 +72,9 @@ const PlaytimeLibrary = ({
<span className={styles.details}>
<Link to={projectUrl(project)}><strong>{project.title}</strong></Link>
<small>
{communityText('by')}{' '}
<a href={`/users/${encodeURIComponent(project.owner)}`}>{project.owner}</a>
{communityRich('by {user}', {
user: <a href={`/users/${encodeURIComponent(project.owner)}`}>{project.owner}</a>
})}
</small>
</span>
<span className={styles.playtime}>
Expand Down
Loading
Loading