@@ -43,6 +43,7 @@ type FirestoreQuest = {
4343 /** Quest-specific settings stored in Firestore */
4444 settings : {
4545 heroCarouselOrder : number | null ;
46+ isVisible : boolean ;
4647 } ;
4748
4849 timestamps : {
@@ -66,43 +67,46 @@ export const fetchQuests = async (): Promise<Quest[]> => {
6667
6768 const snapshot = await getDocs ( q ) ;
6869
69- return snapshot . docs . map ( ( doc ) => {
70- const data = doc . data ( ) as FirestoreQuest ;
70+ return snapshot . docs
71+ . map ( ( doc ) => {
72+ const data = doc . data ( ) as FirestoreQuest ;
7173
72- // Map tasks with localized labels preserved
73- const tasks : QuestTask [ ] = data . tasks . map ( ( task ) => ( {
74- id : task . id ,
75- label : coerceLText ( task . label ) ,
76- points : task . points ,
77- actionButton : task . actionButton
78- ? {
79- label : coerceLText ( task . actionButton . label ) ,
80- url : task . actionButton . url ,
81- }
82- : undefined ,
83- } ) ) ;
74+ // Map tasks with localized labels preserved
75+ const tasks : QuestTask [ ] = data . tasks . map ( ( task ) => ( {
76+ id : task . id ,
77+ label : coerceLText ( task . label ) ,
78+ points : task . points ,
79+ actionButton : task . actionButton
80+ ? {
81+ label : coerceLText ( task . actionButton . label ) ,
82+ url : task . actionButton . url ,
83+ }
84+ : undefined ,
85+ } ) ) ;
8486
85- // Compose domain Quest
86- const quest : Quest = {
87- id : doc . id ,
88- project : {
89- name : coerceLText ( data . project . name ) ,
90- logoUrl : data . project . logoUrl ,
91- } ,
92- title : coerceLText ( data . title ) ,
93- description : coerceLText ( data . description ?? "" ) ,
94- catchphrase : coerceLText ( data . catchphrase ?? "" ) ,
95- backgroundImages : data . backgroundImages ,
96- tasks,
97- settings : {
98- heroCarouselOrder : data . settings . heroCarouselOrder ,
99- } ,
100- timestamps : {
101- createdAt : data . timestamps . createdAt . toDate ( ) ,
102- updatedAt : data . timestamps . updatedAt . toDate ( ) ,
103- } ,
104- } ;
87+ // Compose domain Quest
88+ const quest : Quest = {
89+ id : doc . id ,
90+ project : {
91+ name : coerceLText ( data . project . name ) ,
92+ logoUrl : data . project . logoUrl ,
93+ } ,
94+ title : coerceLText ( data . title ) ,
95+ description : coerceLText ( data . description ?? "" ) ,
96+ catchphrase : coerceLText ( data . catchphrase ?? "" ) ,
97+ backgroundImages : data . backgroundImages ,
98+ tasks,
99+ settings : {
100+ heroCarouselOrder : data . settings . heroCarouselOrder ,
101+ isVisible : data . settings . isVisible ,
102+ } ,
103+ timestamps : {
104+ createdAt : data . timestamps . createdAt . toDate ( ) ,
105+ updatedAt : data . timestamps . updatedAt . toDate ( ) ,
106+ } ,
107+ } ;
105108
106- return quest ;
107- } ) ;
109+ return quest ;
110+ } )
111+ . filter ( ( quest ) => quest . settings . isVisible ) ;
108112} ;
0 commit comments