Skip to content

Commit b147545

Browse files
9larsonscmraible
andauthored
Updated new Post Analytics to be the default for posts/analytics route (#24479)
ref https://linear.app/ghost/issue/PROD-2326/ - removed Ember analytics by removing posts.analytics route - updated Ember references to posts.analytics and pointed to posts.posts-x (this prevents Ember crashes) - updated Admin router to use posts.posts-x for /posts/analytics/ (removed beta/) - updated Posts and Stats apps to remove /beta/ This set of changes is moving the new posts app to be the default for Post Analytics. This was previously at the /posts/analytics/beta/:id path, and is now at /posts/analytics/:id, replacing the Ember view with the new React app. The /debug and /mentions paths are still available and will load their respective Ember views, so it's not as seamless as it once was, though we intend to move more and more into the posts app. --------- Co-authored-by: Chris Raible <[email protected]>
1 parent c93794b commit b147545

File tree

26 files changed

+51
-51
lines changed

26 files changed

+51
-51
lines changed

apps/posts/src/routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const routes: RouteObject[] = [
2323
{
2424

2525
// Post Analytics
26-
path: 'analytics/beta/:postId',
26+
path: 'analytics/:postId',
2727
element: (
2828
<PostAnalyticsProvider>
2929
<PostAnalytics />

apps/posts/src/views/PostAnalytics/Newsletter/Newsletter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Newsletter: React.FC<postAnalyticsProps> = () => {
8383
useEffect(() => {
8484
// Redirect to overview if the post wasn't sent as a newsletter
8585
if (!isPostLoading && !showNewsletterSection) {
86-
navigate(`/analytics/beta/${postId}`);
86+
navigate(`/analytics/${postId}`);
8787
}
8888
}, [navigate, postId, isPostLoading, showNewsletterSection]);
8989

apps/posts/src/views/PostAnalytics/Overview/Overview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const Overview: React.FC = () => {
125125
// Redirect to Growth tab if this is a published-only post with web analytics disabled
126126
useEffect(() => {
127127
if (!isPostLoading && post && isPublishedOnly(post as Post) && !appSettings?.analytics.webAnalytics) {
128-
navigate(`/analytics/beta/${postId}/growth`);
128+
navigate(`/analytics/${postId}/growth`);
129129
}
130130
}, [isPostLoading, post, appSettings?.analytics.webAnalytics, navigate, postId]);
131131

@@ -167,7 +167,7 @@ const Overview: React.FC = () => {
167167
</CardTitle>
168168
</CardHeader>
169169
<Button className='absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100' size='sm' variant='outline' onClick={() => {
170-
navigate(`/analytics/beta/${postId}/growth`);
170+
navigate(`/analytics/${postId}/growth`);
171171
}}>View more</Button>
172172
</div>
173173
<CardContent className='flex flex-col gap-8 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0'>

apps/posts/src/views/PostAnalytics/Overview/components/NewsletterOverview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const NewsletterOverview: React.FC<NewsletterOverviewProps> = ({post, isNewslett
7272
</CardTitle>
7373
</CardHeader>
7474
<Button className='absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100' size='sm' variant='outline' onClick={() => {
75-
navigate(`/analytics/beta/${postId}/newsletter`);
75+
navigate(`/analytics/${postId}/newsletter`);
7676
}}>View more</Button>
7777
</div>
7878
{isNewsletterStatsLoading ?
@@ -172,7 +172,7 @@ const NewsletterOverview: React.FC<NewsletterOverviewProps> = ({post, isNewslett
172172
</div>
173173
</div>
174174
{/* <Button variant='outline' onClick={() => {
175-
navigate(`/analytics/beta/${postId}/newsletter`);
175+
navigate(`/analytics/${postId}/newsletter`);
176176
}}>
177177
View all
178178
<LucideIcon.ArrowRight />

apps/posts/src/views/PostAnalytics/Overview/components/WebOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const WebOverview: React.FC<WebOverviewProps> = ({chartData, range, isLoading, v
4141
</CardTitle>
4242
</CardHeader>
4343
<Button className='absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100' size='sm' variant='outline' onClick={() => {
44-
navigate(`/analytics/beta/${postId}/web`);
44+
navigate(`/analytics/${postId}/web`);
4545
}}>View more</Button>
4646
</div>
4747
<CardContent>

apps/posts/src/views/PostAnalytics/Web/Web.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Web: React.FC<postAnalyticsProps> = () => {
3434
// Redirect to Overview if this is an email-only post
3535
useEffect(() => {
3636
if (!isPostLoading && post?.email_only) {
37-
navigate(`/analytics/beta/${postId}`);
37+
navigate(`/analytics/${postId}`);
3838
}
3939
}, [isPostLoading, post?.email_only, navigate, postId]);
4040

apps/posts/src/views/PostAnalytics/components/PostAnalyticsHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,28 +200,28 @@ const PostAnalyticsHeader:React.FC<PostAnalyticsHeaderProps> = ({
200200
<PageMenu className='min-h-[34px]' defaultValue={currentTab} responsive>
201201
{availableTabs.includes('Overview') && (
202202
<PageMenuItem value="Overview" onClick={() => {
203-
navigate(`/analytics/beta/${postId}`);
203+
navigate(`/analytics/${postId}`);
204204
}}>
205205
Overview
206206
</PageMenuItem>
207207
)}
208208
{availableTabs.includes('Web') && (
209209
<PageMenuItem value="Web" onClick={() => {
210-
navigate(`/analytics/beta/${postId}/web`);
210+
navigate(`/analytics/${postId}/web`);
211211
}}>
212212
Web traffic
213213
</PageMenuItem>
214214
)}
215215
{availableTabs.includes('Newsletter') && (
216216
<PageMenuItem value="Newsletter" onClick={() => {
217-
navigate(`/analytics/beta/${postId}/newsletter`);
217+
navigate(`/analytics/${postId}/newsletter`);
218218
}}>
219219
Newsletter
220220
</PageMenuItem>
221221
)}
222222
{availableTabs.includes('Growth') && (
223223
<PageMenuItem value="Growth" onClick={() => {
224-
navigate(`/analytics/beta/${postId}/growth`);
224+
navigate(`/analytics/${postId}/growth`);
225225
}}>
226226
Growth
227227
</PageMenuItem>

apps/posts/src/views/PostAnalytics/components/Sidebar.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@ const Sidebar:React.FC = () => {
1919
return (
2020
<div className='grow py-8 pr-0'>
2121
<RightSidebarMenu>
22-
<RightSidebarMenuLink active={location.pathname === `/analytics/beta/${postId}`} onClick={() => {
23-
navigate(`/analytics/beta/${postId}`);
22+
<RightSidebarMenuLink active={location.pathname === `/analytics/${postId}`} onClick={() => {
23+
navigate(`/analytics/${postId}`);
2424
}}>
2525
<LucideIcon.LayoutTemplate size={16} strokeWidth={1.25} />
2626
Overview
2727
</RightSidebarMenuLink>
2828
{!post?.email_only && (
29-
<RightSidebarMenuLink active={location.pathname === `/analytics/beta/${postId}/web`} onClick={() => {
30-
navigate(`/analytics/beta/${postId}/web`);
29+
<RightSidebarMenuLink active={location.pathname === `/analytics/${postId}/web`} onClick={() => {
30+
navigate(`/analytics/${postId}/web`);
3131
}}>
3232
<LucideIcon.MousePointer size={16} strokeWidth={1.25} />
3333
Web
3434
</RightSidebarMenuLink>
3535
)}
3636

3737
{hasBeenEmailed && (
38-
<RightSidebarMenuLink active={location.pathname === `/analytics/beta/${postId}/newsletter`} onClick={() => {
39-
navigate(`/analytics/beta/${postId}/newsletter`);
38+
<RightSidebarMenuLink active={location.pathname === `/analytics/${postId}/newsletter`} onClick={() => {
39+
navigate(`/analytics/${postId}/newsletter`);
4040
}}>
4141
<LucideIcon.Mail size={16} strokeWidth={1.25} />
4242
Newsletter
4343
</RightSidebarMenuLink>
4444
)}
4545

46-
<RightSidebarMenuLink active={location.pathname === `/analytics/beta/${postId}/growth`} onClick={() => {
47-
navigate(`/analytics/beta/${postId}/growth`);
46+
<RightSidebarMenuLink active={location.pathname === `/analytics/${postId}/growth`} onClick={() => {
47+
navigate(`/analytics/${postId}/growth`);
4848
}}>
4949
<LucideIcon.Sprout size={16} strokeWidth={1.25} />
5050
Growth

apps/stats/src/utils/url-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function getClickHandler(
100100
return () => {
101101
// For posts with analytics, go to analytics page
102102
if (postId && attributionUrl && attributionType === 'post') {
103-
navigate(`/posts/analytics/beta/${postId}`, {crossApp: true});
103+
navigate(`/posts/analytics/${postId}`, {crossApp: true});
104104
return;
105105
}
106106

apps/stats/src/views/Stats/Newsletters/Newsletters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const NewsletterTableRows: React.FC<{
7373
<div className='group/link inline-flex items-center gap-2'>
7474
{post.post_id ?
7575
<Button className='h-auto whitespace-normal p-0 text-left hover:!underline' title="View post analytics" variant='link' onClick={() => {
76-
navigate(`/posts/analytics/beta/${post.post_id}/`, {crossApp: true});
76+
navigate(`/posts/analytics/${post.post_id}/`, {crossApp: true});
7777
}}>
7878
{post.post_title}
7979
</Button>

0 commit comments

Comments
 (0)