-
+
+
+
- {showNameInLcdOverlay ? (
+ {showFloatingEditableName ? (
+
+ ) : null}
+ {showReadOnlyLcdName ? (
(null);
const [isResettingQuiz, setIsResettingQuiz] = useState(false);
+ const [coinsGrantMessage, setCoinsGrantMessage] = useState(null);
+ const [isGrantingCoins, setIsGrantingCoins] = useState(false);
useEffect(() => {
setNotificationPermission(getNotificationPermissionState());
@@ -212,6 +217,28 @@ export function ProfilePreferencesForm({ email }: ProfilePreferencesFormProps) {
);
};
+ const handleGrantDemoCoins = async () => {
+ setCoinsGrantMessage(null);
+ setError(null);
+ setIsGrantingCoins(true);
+
+ try {
+ const nextBalance = await adjustCoins(DEMO_COINS_GRANT);
+ notifyHabitPetDataUpdated();
+ setCoinsGrantMessage(
+ `Added ${DEMO_COINS_GRANT} points. Your balance is now ${nextBalance}.`,
+ );
+ } catch (grantError) {
+ setError(
+ grantError instanceof Error
+ ? grantError.message
+ : "Could not add demo points.",
+ );
+ } finally {
+ setIsGrantingCoins(false);
+ }
+ };
+
const handleResetDailyQuiz = async () => {
setQuizResetMessage(null);
setError(null);
@@ -399,8 +426,22 @@ export function ProfilePreferencesForm({ email }: ProfilePreferencesFormProps) {
Reset clears today's wellness quiz entry so you can complete it
- again immediately.
+ again immediately. Demo points are for testing the shop only.
+
+ {coinsGrantMessage ? (
+ {coinsGrantMessage}
+ ) : null}