From dc539a2163fe51e800699227d4ebeb8cab557d0c Mon Sep 17 00:00:00 2001 From: odzioo123 <1konrad.sadowski@gmail.com> Date: Sun, 2 Nov 2025 20:50:36 +0100 Subject: [PATCH] Now when not logged, user still can see the task, but can't do anything there unless log in. --- src/atlas_frontend/src/components/Task/index.tsx | 12 +++++++----- .../src/components/Task/tasks/GenericTask.tsx | 7 ++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/atlas_frontend/src/components/Task/index.tsx b/src/atlas_frontend/src/components/Task/index.tsx index 690b43c..b369907 100644 --- a/src/atlas_frontend/src/components/Task/index.tsx +++ b/src/atlas_frontend/src/components/Task/index.tsx @@ -157,11 +157,13 @@ const Task = () => { ? getUsersSubmissions(currentTask.tasks) : new UserSubmissions({}); - if (!user?.principal) return <>; - const isAccepted = usersSubmissions.isAccepted(user.principal.toText()); - const userAlreadyRewarded = currentTask.rewarded - .map((p) => p.toText()) - .includes(user.principal.toText()); + const userPrincipal = user?.principal?.toText() ?? null; + const isAccepted = userPrincipal + ? usersSubmissions.isAccepted(userPrincipal) + : false; + const userAlreadyRewarded = userPrincipal + ? currentTask.rewarded.map((p) => p.toText()).includes(userPrincipal) + : false; const withdraw = async () => { if (!authAtlasSpace) { diff --git a/src/atlas_frontend/src/components/Task/tasks/GenericTask.tsx b/src/atlas_frontend/src/components/Task/tasks/GenericTask.tsx index 012bb0c..bdfeb44 100644 --- a/src/atlas_frontend/src/components/Task/tasks/GenericTask.tsx +++ b/src/atlas_frontend/src/components/Task/tasks/GenericTask.tsx @@ -361,7 +361,12 @@ const listForm = useForm({ )} {!user && (
- +
)} {user && !isUserAdmin && submissionData && (