Configure browsing session pacing and size
This commit is contained in:
1 parent
1fd154e1eb
commit
e890f74478
14 files changed
+201
-56
No files matched your search
@@ -178,6 +178,11 @@ function BrowsingSimulationSection({ account }: { account: GrowthAccountDetail }
|
||||
const runNow = useRunBrowsingSimulationMutation(account.accountId);
|
||||
const { settings, stats, todayTarget, recentDecisions } = account.browsing;
|
||||
const selected = recentDecisions.filter((decision) => decision.decision === 'simulated-upvote');
|
||||
const [gapMinutes, setGapMinutes] = useState(String(settings.minimumGapMs / 60_000));
|
||||
const [selectionsPerSession, setSelectionsPerSession] = useState(String(settings.selectionsPerSession));
|
||||
|
||||
useEffect(() => setGapMinutes(String(settings.minimumGapMs / 60_000)), [settings.minimumGapMs]);
|
||||
useEffect(() => setSelectionsPerSession(String(settings.selectionsPerSession)), [settings.selectionsPerSession]);
|
||||
|
||||
return (
|
||||
<section aria-labelledby="browsing-simulation-heading" className="panel settings-card">
|
||||
@@ -207,6 +212,56 @@ function BrowsingSimulationSection({ account }: { account: GrowthAccountDetail }
|
||||
label="Submit selected upvotes"
|
||||
onChange={(autoVoteEnabled) => update.mutate({ autoVoteEnabled })}
|
||||
/>
|
||||
<div className="growth-pacing">
|
||||
<NumberField
|
||||
hint={`Shortest gap between sessions. The system adds a random 0–${minutes(settings.jitterMs)} on top.`}
|
||||
label="Minimum session gap"
|
||||
min={45}
|
||||
max={1_440}
|
||||
name="browsing-minimum-gap"
|
||||
onChange={setGapMinutes}
|
||||
suffix="min"
|
||||
value={gapMinutes}
|
||||
/>
|
||||
<button
|
||||
className="button secondary"
|
||||
disabled={update.isPending}
|
||||
onClick={() => {
|
||||
const parsed = Number.parseInt(gapMinutes, 10);
|
||||
if (Number.isInteger(parsed) && parsed >= 45 && parsed <= 1_440) {
|
||||
update.mutate({ minimumGapMs: parsed * 60_000 });
|
||||
}
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
Save session gap
|
||||
</button>
|
||||
</div>
|
||||
<div className="growth-pacing">
|
||||
<NumberField
|
||||
hint="Maximum eligible posts or comments selected by each scheduled or manual session."
|
||||
label="Selections per session"
|
||||
min={1}
|
||||
max={12}
|
||||
name="browsing-selections-per-session"
|
||||
onChange={setSelectionsPerSession}
|
||||
suffix="/session"
|
||||
value={selectionsPerSession}
|
||||
/>
|
||||
<button
|
||||
className="button secondary"
|
||||
disabled={update.isPending}
|
||||
onClick={() => {
|
||||
const parsed = Number.parseInt(selectionsPerSession, 10);
|
||||
if (Number.isInteger(parsed) && parsed >= 1 && parsed <= 12) {
|
||||
update.mutate({ selectionsPerSession: parsed });
|
||||
}
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
Save session size
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
className="button secondary"
|
||||
disabled={!settings.enabled || runNow.isPending}
|
||||
|
||||
Reference in new issue
Block a user