Motivation
In response to this question in the Community yesterday, here’s a quick guide to adding an Admin section to your quiz apps. The two main requirements were:
- The Admin screen should be PIN protected.
- The Admin screen should allow you to add extra questions to the quiz.
Demo
Take a look at the working example here (the PIN is “42”)
Component Tree
This app has 4 screens to display each of the different user interfaces.
It also uses the LocalDB to store the questions and answers.
Quiz Screen
The quiz screen has a section in the middle of the page to ask and answer the questions. At the very top of the screen there’s a row containing the AdminButton
. Clicking on this button will take the user to the PinScreen, so only an Admin (or someone who knows the PIN) will be able to access the admin area of the app.
PIN Screen
At it’s simplest, the pin screen just needs a text input and a button. The following blocks are used to check if the users pin matches our pre-defined pin:
Admin Screen
The quiz screen contains two text inputs and two buttons. The text inputs are for entering the new question and answer. The two buttons are to update the localDB with the new question, and to navigate back to the Quiz Screen
The block are very simple, the text from the two text inputs is used as the question value and the answer value and stored in the LocalDB as a new row.
Clicking on the back button brings the Admin back to the QuizScreen
to try out the new questions.
Remix
If you want to remix this app, just copy the project into your own Thunkable account by clicking on the link below:
https://x.thunkable.com/copy/aa94cc47fc75a75e1ed3e61c75150cb9
(The link will expire in August 2020, so let me know if you need access in the future)
Thanks!
Hope you liked it. Leave a if you found it useful!