Skip to content

Commit

Permalink
Show meta answer(s) to puzzle author. #442
Browse files Browse the repository at this point in the history
  • Loading branch information
mdirolf committed Sep 20, 2023
1 parent 18be627 commit 02dc784
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/components/MetaSubmission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const MetaSubmission = (props: {
hasPrize: boolean;
dispatch: Dispatch<ContestSubmitAction | ContestRevealAction>;
solutions: Array<string>;
isAuthor: boolean;
}) => {
const authContext = useContext(AuthContext);
if (!authContext.user || authContext.user.isAnonymous) {
Expand All @@ -171,7 +172,8 @@ export const MetaSubmission = (props: {

const isComplete =
props.contestRevealed ||
isMetaSolution(props.contestSubmission, props.solutions);
isMetaSolution(props.contestSubmission, props.solutions) ||
props.isAuthor;

return (
<div css={{ marginTop: '1em' }}>
Expand All @@ -193,7 +195,7 @@ export const MetaSubmission = (props: {
''
)}

{props.contestRevealed ? (
{props.contestRevealed || props.isAuthor ? (
props.solutions.length === 1 ? (
<p>
The solution is: <strong>{props.solutions[0]}</strong>
Expand Down
4 changes: 2 additions & 2 deletions app/components/PuzzleOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ export const PuzzleOverlay = (props: SuccessOverlayProps | BeginPauseProps) => {
</div>
{props.overlayType === OverlayType.Success &&
isContest &&
props.puzzle.contestAnswers &&
props.user?.uid !== props.puzzle.authorId ? (
props.puzzle.contestAnswers ? (
<MetaSubmission
hasPrize={!!props.contestHasPrize}
contestSubmission={props.contestSubmission}
Expand All @@ -311,6 +310,7 @@ export const PuzzleOverlay = (props: SuccessOverlayProps | BeginPauseProps) => {
}
dispatch={props.dispatch}
solutions={props.puzzle.contestAnswers}
isAuthor={props.user?.uid === props.puzzle.authorId}
/>
) : (
''
Expand Down

0 comments on commit 02dc784

Please sign in to comment.