Repository navigation
Show a posting activity heatmap on Insights - #528
Open
paulocastellano wants to merge 33 commits into
Open
paulocastellano wants to merge 33 commits into
paulocastellano wants to merge 33 commits into
Conversation
added 30 commits
November 20, 2026 13:28
A GitHub-style grid of the posts that went out each day over the last 12 months, with the current and longest streak, on Workspace and Channel Insights. It shares as an image like the other Insights cards.
Toasts flashed by the server can carry a link (flash.link: label and url), shown right after the message. Adding a post to the queue, from the composer or a card, now toasts from the server with "View post", which opens the post's details in the tab its status belongs to. Flash is always shared, so it also reaches partial reloads.
- Move to top says the post went to the top; a member who needs approval is told it awaits approval, from the composer too. - BuildPostingActivity counts with CarbonPeriod and collections; ScheduleAction::addsToQueue() replaces in_array. - Front uses filled() and formatFullNumber(); the recover save passes its options through. - The activity loads in its own deferred group, so the channel metrics no longer wait for it. - The card moves to the end of both Insights pages, its numbers into the header. - Tests for a viewer ahead of UTC, the first day of the window, a Sunday-start week and the channel card refresh.
The streaks and the posts sit above the grid as headline numbers with their label, the way the Posts and Followers cards print their totals. The header keeps the title and the share button, and the flame is gone so no number stands apart.
Label over value, as the channel Metrics card draws its series, with an icon per number (flame, trophy, send) in the grid's violet where that legend draws a swatch.
Flame in orange for the current streak, crown in amber for the longest, send in the grid's violet for the posts.
Next to the logo, like Buffer's: the weeks in a row the workspace posted, counting every publication Insights reads plus what TryPost published on the networks it does not read. The popover nudges to post this week or next, names the streak's rank among every workspace (Top X%, ranked daily by analytics:rank-posting-streaks), schedules a post, and shares the streak as a post with its own image. Hidden without a streak.
A lighter blob on the left, a darker triangle on the right that reaches the flame's circle, a few confetti dots, and the node share icon.
…psed sidebar An arrow in the popover's color and border touches the badge, and the popover gets the 1px border in light mode too so both read as one shape. The badge's wrapper carries the collapsed-sidebar hiding, which the popover root could not.
The popover goes back to its standard shadow; the arrow takes the popover's fill, with the border stroke only in dark mode where the popover has one.
The arrow's sides take the 1px ring of --shadow-md (#331f0017), so the popover's edge runs up the arrow and back without a gap.
The popover opens 16px under the badge, centered on it, in the system popover style, as the reference places it.
Hovering Top X% says it is compared to other TryPost users, in all 17 locales, on one line like the reference.
The title leads with the number (104 weeks in a row) and the nudge says what happened before the action its button names, in all 17 locales.
This reverts commit 5212389.
The violet band with its blob, wedge and confetti, the number's circle and the flame's, then the streak title and the TryPost signature, on a square. The image no longer needs its own 'weeks' word.
…band art The band's violet, blob, wedge and confetti fill the whole 4:5 image; translucent tiles sit over it, three with the activity icons; the number sits in the largest tile, the unit and the line under it, then the TryPost signature.
The darker violet edge waves down the image instead of running straight, the number's tile sits closer to the unit with the side tiles following it, and the signature moves up.
…t, and cover the review's gaps
…are card's shades to the page's scale
…ry language, and cover the share and toast guards
…re guard test able to fail
This branch has not been deployed
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.
Insights now has a Posting activity card: a GitHub-style grid with one square per day over the last 12 months, colored by how many posts went out that day. Next to it are the current streak, the longest streak and the year's total. The goal is engagement: at a glance the user sees whether they're posting every day, and the streak gives them something to keep.
It shows at the end of Workspace Insights (with the channel and label filters) and of Channel Insights (with the label and post type filters). The grid always covers the last 12 months, whatever period the page is showing. That is why it sits last: it is the only card that does not follow the period picker, so it never interrupts the cards that do.
What counts
BuildPublicationAnalyticsReport::query()), so the two always agree. LinkedIn, Google Business, Telegram and Discord are excluded, as everywhere else in Insights.History goes back 365 days on connect (
BootstrapAccountAnalytics), so most channels see a full year right away. X stops at its 800 most recent posts.Changes
BuildPostingActivitycounts posts per local day withCarbonPeriodand collections, grouping in PHP so it behaves the same on PostgreSQL and MySQL, and works out both streaks. Both controllers send its result as a deferredpostingActivityprop in its own group (activity), so the channel's metric series never waits for it.PostingActivityCardputs the three numbers in the card's header, next to the title and the share button, with an InfoTip on each. On a phone they wrap under the title.PostingActivityHeatmapdraws a UnovisVisHeatmapthat stretches to the card's width. It uses one violet at four strengths, which reads the same in light and dark.PostingActivityTooltipshows the day's posts and the date.heatmapcard shape, drawn bylib/shareCard/heatmap.ts.lib/postingActivity.ts.single-line-copy.php.Verification
tests/Feature/Analytics/PostingActivityTest.phphas 11 cases: local days, the window edges, both streak rules, filters, excluded networks and the empty year. They pass on PostgreSQL and on MySQL.InsightsControllerTestandChannelInsightsPageTestcheck the deferred prop and its filters. The fulltests/Feature/Analyticsfolder passes (665).tests/Browser/PostingActivityTest.phphas 8 cases: both pages, the post type filter, the refresh after the first data arrives, opening on the latest weeks on a phone, the tooltip, and the share card with each post text. The refresh and phone-scroll tests fail when their fix is removed.InsightsShareChartTeststill passes (27). The copy guards,vue-tsc, eslint andpintall pass."View post" on the added-to-queue toast
When a post goes to the queue, the toast now says so and links to the post, like Buffer's "View post". The link opens the post's details on the publish page, in the tab that matches its status (Queue, Approvals, …).
app.posts.index?post=<id>already picked that tab and opened the dialog.flash.link(labelandurl) next to its message, andToast.vueshows the link right after the text, in a toast as wide as its content. Toasts without a link look the same as before.PostController@storeandPostScheduleControllerflash it throughRendersPublishPage::flashPostToast(). The message is a full sentence ("Your post was added to the queue."); "Move to top" says the post went to the top instead; and a post waiting for approval says "Approval requested" (RendersPublishPage::queuedMessage(), which replaces the client'srequestsApprovalflag).HandleInertiaRequestssharesflashwithInertia::always(), because "Move to top" reloads only part of the queue page. Without it, no flashed toast shows on a partial reload.posts.actions.view("View post"), which was in all locales but unused. It now has a single-line budget.Verification
PostQueueTest,PostScheduleActionTest).tests/Feature/Posts: 709 passed. All of Feature and Unit: 11632 passed./posts?post=…(ComposerQueueTest). "Move to top" shows the toast with its link, and that test fails withoutInertia::always()(PublishQueueTest).ComposerQueueTest(15),PublishQueueTest(34),PostApprovalsTest(6) andPublishCardActionsTest(7) all pass.Review pass
BuildPostingActivityuses collections andCarbonPeriodinstead ofarray_*,endandmax, andScheduleAction::addsToQueue()replacesin_array.filled()replaces!x, andformatFullNumber()replaces six hand-writtentoLocaleStringcalls.Weekly posting streak in the sidebar
A badge next to the logo, laid out like Buffer's: a flame with the number of weeks in a row the workspace posted. Clicking it opens a popover with the streak, its rank, a nudge, "Schedule post" and a share button. The badge is hidden while there is no streak.
analytics:rank-posting-streaksruns daily and works out the streak of every workspace with app access, using Monday weeks in UTC, then caches the distribution. The popover shows the smallest "Top X%" out of 1, 5, 10, 25 and 50, and nothing below that.postingStreak(ShowPostingStreak), cached for 10 minutes per user and workspace.PublishPageTest's N+1 check now flushes the cache before each count, so a warm cache never counts as one query fewer.lib/streakShareImage.ts, in the style of the Insights share cards).Verification
PostingStreakTest(feature) has 11 cases: the streak, a week without a post yet, a broken streak, LinkedIn through TryPost, a post that failed, the week start, another workspace, the ranking, and the shared prop with and without a rank. They pass on PostgreSQL and on MySQL.PostingStreakTest(browser) has 5 cases: no badge without a streak, the popover and both nudges, "Schedule post" opening the composer, and sharing opening the composer with the text and the image.