Skip to content

Commit 2bb67e2

Browse files
authored
Merge branch 'main' into main
2 parents aca56ff + 9911635 commit 2bb67e2

File tree

12 files changed

+207
-35
lines changed

12 files changed

+207
-35
lines changed

app/components/Doc.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Markdown } from '~/components/Markdown'
88
import { Toc } from './Toc'
99
import { twMerge } from 'tailwind-merge'
1010
import { TocMobile } from './TocMobile'
11+
import { GadLeader } from './GoogleScripts'
1112

1213
type DocProps = {
1314
title: string
@@ -105,6 +106,7 @@ export function Doc({
105106
isTocVisible && '!pr-0'
106107
)}
107108
>
109+
<GadLeader />
108110
{title ? <DocTitle>{title}</DocTitle> : null}
109111
<div className="h-4" />
110112
<div className="h-px bg-gray-500 opacity-20" />

app/components/DocContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function DocContainer({
99
<div
1010
{...props}
1111
className={twMerge(
12-
'w-full max-w-full p-2 md:p-6 lg:p-8',
12+
'w-full max-w-full p-2 md:p-4 2xl:p-8',
1313
props.className
1414
)}
1515
>

app/components/DocsLayout.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ import { ClientOnlySearchButton } from './ClientOnlySearchButton'
3030
import { twMerge } from 'tailwind-merge'
3131
import { partners } from '~/utils/partners'
3232
import { useThemeStore } from './ThemeToggle'
33+
import {
34+
GadFooter,
35+
GadLeftRailSquare,
36+
GadRightRailSquare,
37+
} from './GoogleScripts'
38+
import { DocContainer } from './DocContainer'
3339

3440
// Let's use zustand to wrap the local storage logic. This way
3541
// we'll get subscriptions for free and we can use it in other
@@ -539,6 +545,9 @@ export function DocsLayout({
539545
<div className="flex-1 flex flex-col gap-4 px-4 whitespace-nowrap overflow-y-auto text-base pb-8">
540546
{menuItems}
541547
</div>
548+
<div className="mt-auto overflow-hidden h-0">
549+
<GadLeftRailSquare />
550+
</div>
542551
</div>
543552
)
544553

@@ -574,6 +583,9 @@ export function DocsLayout({
574583
>
575584
{children}
576585
</div>
586+
<div className="mb-8 !py-0 mx-auto">
587+
<GadFooter />
588+
</div>
577589
<div className="sticky flex items-center flex-wrap bottom-2 z-10 right-0 text-xs md:text-sm px-1 print:hidden">
578590
<div className="w-1/2 px-1 flex justify-end flex-wrap">
579591
{prevItem ? (
@@ -609,7 +621,7 @@ export function DocsLayout({
609621
</div>
610622
</div>
611623
</div>
612-
<div className="-ml-2 pl-2 w-64 shrink-0 hidden md:block sticky top-0 max-h-screen overflow-y-auto">
624+
<div className="-ml-2 pl-2 w-[290px] xl:w-[340px] shrink-0 hidden md:block sticky top-0 max-h-screen overflow-y-auto">
613625
<div className="ml-auto flex flex-col space-y-4">
614626
<div className="bg-white dark:bg-black/40 border-gray-500/20 shadow-xl divide-y divide-gray-500/20 flex flex-col border border-r-0 border-t-0 rounded-bl-lg">
615627
<div className="uppercase font-black text-center p-3 opacity-50">
@@ -685,15 +697,12 @@ export function DocsLayout({
685697
)}
686698
</div>
687699

700+
<div className="bg-white dark:bg-black/40 border-gray-500/20 shadow-xl flex flex-col border-t border-l border-b p-4 space-y-2 rounded-l-lg">
701+
<GadRightRailSquare />
702+
</div>
703+
688704
<div className="bg-white dark:bg-black/40 border-gray-500/20 shadow-xl flex flex-col border-t border-l border-b p-4 space-y-2 rounded-l-lg">
689705
<Carbon />
690-
<div
691-
className="text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500 italic
692-
dark:bg-opacity-20 self-center opacity-50 hover:opacity-100 transition-opacity"
693-
>
694-
This ad helps to keep us from burning out and rage-quitting OSS
695-
just *that* much more, so chill. 😉
696-
</div>
697706
</div>
698707
</div>
699708
</div>

app/components/GoogleScripts.tsx

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import { Link } from '@tanstack/react-router'
2+
import React from 'react'
3+
4+
declare global {
5+
interface Window {
6+
googletag: any
7+
}
8+
}
9+
10+
const adSlots = {
11+
leaderboard: {
12+
id: 'div-gpt-ad-1738811978953-leaderboard',
13+
sizes: [[728, 90]],
14+
targeting: 'leaderboard',
15+
refreshInterval: 45_000, // 45 seconds
16+
},
17+
footer: {
18+
id: 'div-gpt-ad-1738811978953-footer',
19+
sizes: [[728, 90]],
20+
targeting: 'footer',
21+
refreshInterval: 45_000, // 45 seconds
22+
},
23+
rightRail: {
24+
id: 'div-gpt-ad-1738811978953-right-rail',
25+
sizes: [
26+
// [160, 600],
27+
[300, 250],
28+
[250, 250],
29+
],
30+
targeting: 'right-side-rail',
31+
refreshInterval: 45_000, // 45 seconds
32+
},
33+
leftRail: {
34+
id: 'div-gpt-ad-1738811978953-left-rail',
35+
sizes: [
36+
// [160, 600],
37+
[300, 250],
38+
],
39+
targeting: 'left-side-rail',
40+
refreshInterval: 45_000, // 45 seconds
41+
},
42+
}
43+
44+
const googleScriptFn = (slots: typeof adSlots) => {
45+
window.googletag = window.googletag || { cmd: [] }
46+
googletag.cmd.push(function () {
47+
// Define all ad slots
48+
const slotInstances = Object.values(slots).map((slot) => {
49+
return googletag
50+
.defineSlot('/23278945940/TopLevel', slot.sizes, slot.id)
51+
.addService(googletag.pubads())
52+
.setTargeting(slot.targeting, [slot.targeting])
53+
})
54+
55+
googletag.pubads().enableSingleRequest()
56+
googletag.enableServices()
57+
58+
// Set individual refresh intervals for each ad
59+
slotInstances.forEach((slotInstance, index) => {
60+
const slot = Object.values(slots)[index]
61+
setInterval(function () {
62+
googletag.cmd.push(function () {
63+
googletag.pubads().refresh([slotInstance])
64+
})
65+
}, slot.refreshInterval)
66+
})
67+
})
68+
}
69+
70+
export function GoogleScripts() {
71+
return (
72+
<>
73+
<script
74+
async
75+
src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"
76+
></script>
77+
78+
<script
79+
dangerouslySetInnerHTML={{
80+
__html: `(${googleScriptFn.toString()})(${JSON.stringify(adSlots)});`,
81+
}}
82+
/>
83+
</>
84+
)
85+
}
86+
87+
function Gad({
88+
adId,
89+
children,
90+
...props
91+
}: { adId: string } & React.HTMLAttributes<HTMLDivElement>) {
92+
React.useEffect(() => {
93+
window.googletag.cmd.push(function () {
94+
window.googletag.display(adId)
95+
})
96+
}, [])
97+
98+
return (
99+
<div {...props} className="grid [&>*]:col-start-1 [&>*]:row-start-1">
100+
<div id={adId} className="w-full flex-1 z-10"></div>
101+
<div className="flex items-center justify-center">{children}</div>
102+
</div>
103+
)
104+
}
105+
106+
export function GadLeader() {
107+
// return (
108+
// <div className="overflow-hidden h-0 w-0">
109+
// <Gad
110+
// adId={adSlots.leaderboard.id}
111+
// style={{
112+
// maxWidth: '728px',
113+
// aspectRatio: '728 / 90',
114+
// }}
115+
// />
116+
// </div>
117+
// )
118+
119+
return null
120+
}
121+
122+
export function GadFooter() {
123+
return (
124+
<Gad
125+
adId={adSlots.footer.id}
126+
style={{ maxWidth: '728px', aspectRatio: '728 / 90' }}
127+
/>
128+
)
129+
}
130+
131+
export function GadLeftRailSquare() {
132+
// return (
133+
// <Gad
134+
// adId={adSlots.leftRail.id}
135+
// style={{ maxWidth: '300px', aspectRatio: '300 / 250' }}
136+
// />
137+
// )
138+
139+
return null
140+
}
141+
142+
export function GadRightRailSquare() {
143+
return (
144+
<Gad
145+
adId={adSlots.rightRail.id}
146+
className="[aspect-ratio:250/250] xl:[aspect-ratio:300/250] flex items-center justify-center"
147+
>
148+
<Link
149+
to="/form"
150+
className="flex items-center gap-2 text-3xl font-black uppercase tracking-tighter h-full"
151+
>
152+
<span>TanStack</span>
153+
<span className="text-transparent bg-clip-text bg-gradient-to-r from-yellow-500 to-yellow-600">
154+
Form
155+
</span>
156+
<span className="text-xs">V1</span>
157+
</Link>
158+
</Gad>
159+
)
160+
}

app/libraries/start.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const startProject = {
1616
cardStyles: `shadow-xl shadow-cyan-500/20 dark:shadow-lg dark:shadow-cyan-500/30 text-cyan-500 dark:text-white-400 border-2 border-transparent hover:border-current`,
1717
to: '/start',
1818
tagline: `Full-stack React Framework powered by TanStack Router`,
19-
description: `Full-document SSR, Streaming, Server Functions, bundling and more, powered by TanStack Router, Nitro, Vite and ready to deploy to your favorite hosting provider.`,
19+
description: `Full-document SSR, Streaming, Server Functions, bundling and more, powered by TanStack Router and Vite - Ready to deploy to your favorite hosting provider.`,
2020
bgStyle: 'bg-cyan-500',
2121
textStyle: 'text-cyan-500',
2222
badge: 'beta',
@@ -124,7 +124,7 @@ export const startProject = {
124124
),
125125
},
126126
{
127-
title: 'Deploy Anywhere with Nitro Vite',
127+
title: 'Deploy Anywhere',
128128
icon: (
129129
<PiRocketLaunchDuotone
130130
className={twMerge('motion-safe:animate-bounce', textStyles)}
@@ -136,9 +136,9 @@ export const startProject = {
136136
),
137137
description: (
138138
<div>
139-
With Nitro and Vite under the hood, TanStack Start is designed to be{' '}
139+
TanStack Start can be{' '}
140140
<span className={twMerge('font-semibold', textStyles)}>
141-
deployable anywhere JS can run
141+
deployed anywhere JS can run
142142
</span>
143143
. Whether you're hosting on a traditional server, a serverless
144144
platform, or even a CDN, Start seamlessly builds, bundles and deploys

app/routes/__root.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { twMerge } from 'tailwind-merge'
2222
import { getThemeCookie, useThemeStore } from '~/components/ThemeToggle'
2323
import { useMounted } from '~/hooks/useMounted'
2424
import { usePrefersReducedMotion } from '~/utils/usePrefersReducedMotion'
25+
import { GoogleScripts } from '~/components/GoogleScripts'
2526

2627
export const Route = createRootRouteWithContext<{
2728
queryClient: QueryClient
@@ -344,6 +345,7 @@ function RootDocument({ children }: { children: React.ReactNode }) {
344345
{matches.find((d) => d.staticData?.baseParent) ? (
345346
<base target="_parent" />
346347
) : null}
348+
<GoogleScripts />
347349
</head>
348350
<body>
349351
<div

app/routes/_libraries/ethos.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export default function RouteComp() {
9191
<li>
9292
TanStack libraries are built on framework and platform-agnostic
9393
primitives. When our libraries build on other tools, like TanStack
94-
Start builds on Nitro, we ensure that these tools uphold these
95-
same values of openness and flexibility.
94+
Start builds on Vite, we ensure that these tools uphold these same
95+
values of openness and flexibility.
9696
</li>
9797
<li>
9898
<strong>TanStack Libraries</strong> either already support or will

app/routes/_libraries/start.$version.index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ export default function VersionIndex() {
7878
lg:text-xl lg:max-w-[600px]"
7979
>
8080
SSR, Streaming, Server Functions, API Routes, bundling and more
81-
powered by <strong>TanStack Router</strong>, <strong>Nitro</strong>,
82-
and <strong>Vite</strong>. Ready to deploy to your favorite hosting
83-
provider.
81+
powered by <strong>TanStack Router</strong> and <strong>Vite</strong>.
82+
Ready to deploy to your favorite hosting provider.
8483
</p>
8584
<div className="flex justify-center gap-4 flex-wrap">
8685
<Link

app/utils/sandbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const getInitialSandboxFileName = (
55
libraryId?: string
66
) => {
77
if (libraryId === 'start') {
8-
return 'app/routes/__root.tsx'
8+
return 'src/routes/__root.tsx'
99
}
1010

1111
const dir = 'src'

media/brand.sketch

321 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)