Disable tips after 10 runs (#17101)

This commit is contained in:
Adib234
2026-01-22 15:46:18 -05:00
committed by GitHub
parent 5d68d8cda5
commit 016a94ffaf
11 changed files with 327 additions and 91 deletions

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { useEffect, useState } from 'react';
import { persistentState } from '../../utils/persistentState.js';
interface UseTipsResult {
showTips: boolean;
}
export function useTips(): UseTipsResult {
const [tipsCount] = useState(() => persistentState.get('tipsShown') ?? 0);
const showTips = tipsCount < 10;
useEffect(() => {
if (showTips) {
persistentState.set('tipsShown', tipsCount + 1);
}
}, [tipsCount, showTips]);
return { showTips };
}