Repository navigation
feat(traffic): add 7 / 30 / 90-day time-range picker - #481
Merged
Merged
Conversation
gkhngyk
approved these changes
Jul 19, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Verified against main: all three actions already take days, the delta scales with the window, and page reset / brand reset behave correctly. Thanks for wiring this up cleanly!
This was referenced Nov 16, 2026
gkhngyk
pushed a commit
that referenced
this pull request
Nov 16, 2026
…closest" ones
Chat could not answer "what is AC-481?" when AC-481 was on screen: it had no
way to read an action by its code, only a page of the list ranked by priority
(list_action_center_tasks) or one action by its id (get_action). AC-481 was
past the first page of 50, so Chat said it didn't exist and listed others.
- list_action_center_tasks takes `codes`: every code of a message in one read
("AC-481", "AC 481", "ac481", "#481", "481", "AC-07"). It matches as the
Actions list's search and the actions/code route do (matchesActionCode):
the brand's number or the old global number. Each row says whether the code
is its code or its previous code; a code that names two actions returns
both; codes no action has come back in not_found. Every status, never a
deleted action, this brand of the caller's organization only (brandAllowed
and an inner join on brands.organization_id).
- A limit sent with codes no longer cuts the rows (scope.ts NAMED_ROWS).
- The tool descriptions and ACTION_NAME_RULES: read the code first; a code not
found is "not found in this brand, codes are per brand", never "the
closest"; never "doesn't exist" because a page didn't show it.
- Help: "Ask about your actions" says you can ask by code.
- Eval: "AC 481 ve AC-63 nedir" on a brand with 55 open actions, AC-481 past
the first page; it must read both by code, name both by title and code, and
name no other action in their place.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
pushed a commit
that referenced
this pull request
Nov 16, 2026
…losest" ones An MCP client asked "what is AC-481?" could only page list_actions by priority (50 rows by default, 200 at most), so an action past the page looked missing and the client could answer with other actions instead. Chat got the same lookup in #2445; MCP now reads codes the same way. - list_actions takes `codes` (up to 10: "AC-481", "AC 481", "ac481", "#481", "481", "AC-07"). With codes it answers from Chat's read (listActionsByCodeFor): the same query, rows and note, no second query. It matches the brand's number or the old global number, says per row whether that is its code or its previous code (previous_ref), returns both actions for a code that names two, reads every status but never a deleted action, and lists codes the brand doesn't have in not_found with "codes are per brand". status, category, sort and limit don't apply beside codes. - Scope as before: brandAllowed (organization and brand access), the brand_id filter and an inner join on the brand's organization. A code of another brand or workspace is not found; only parsed numbers reach the filter. - The list_actions description: read the code first; a code not found means this brand has no action with it; never offer the closest actions; never say an action doesn't exist because a page didn't show it. get_action's action_id says where a code's id comes from. - The REST mirror (/api/mcp/actions) is unchanged. - Docs: the MCP guide's list_actions row. Help: one example line in the MCP article's "What you can ask". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #451
What
Adds a segmented 7d / 30d / 90d time-range control to the AI Traffic page header. The backend actions already accepted a
daysparameter — this PR wires up the missing UI so users can finally look at a month or a quarter of traffic.Changes
web/src/app/[locale]/(dashboard)/dashboard/traffic/page.tsx— single file changed.TIME_RANGE_OPTIONSconstant andTimeRangeDaystype (7 | 30 | 90).daysstate, defaulting to7.useEffectonbrand?.idnow also resetsdaysto7so switching brands keeps working as before.loadSummarypassesdaysto bothgetTrafficSummary(brandId, days)andgetTrafficTrend(brandId, days);daysadded to theuseCallbackdep array so it reloads on change.loadLogspassesdaysinsideopts;daysadded to its dep array.handleDaysChangecallback — setsdaysand resetspageto0.justify-betweenflex row; picker sits right-aligned using the sameflex rounded-md border p-0.5pattern as_fanout-tab.tsx.AI Referral Trend — Last {days} Days.`last ${days} days`instead of the hardcoded"last 7 days".Acceptance criteria
Checks