Skip to content

Commit 8078d80

Browse files
committed
Attempt to switch to nextjs app dir
1 parent 855dd41 commit 8078d80

File tree

51 files changed

+639
-490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+639
-490
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { DataFetchingScreen } from 'app/features/data-fetching/screen'
2+
import { Metadata } from 'next'
3+
4+
export const metadata: Metadata = {
5+
title: 'Data Fetching',
6+
}
7+
8+
export default function Page() {
9+
return <DataFetchingScreen />
10+
}

apps/next/app/globals.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
html,
2+
body,
3+
#__next {
4+
width: 100%;
5+
/* To smooth any scrolling behavior */
6+
-webkit-overflow-scrolling: touch;
7+
margin: 0px;
8+
padding: 0px;
9+
/* Allows content to fill the viewport and go beyond the bottom */
10+
min-height: 100%;
11+
}
12+
#__next {
13+
flex-shrink: 0;
14+
flex-basis: auto;
15+
flex-direction: column;
16+
flex-grow: 1;
17+
display: flex;
18+
flex: 1;
19+
}
20+
html {
21+
scroll-behavior: smooth;
22+
/* Prevent text size change on orientation change https://gist.github.com/tfausak/2222823#file-ios-8-web-app-html-L138 */
23+
-webkit-text-size-adjust: 100%;
24+
height: 100%;
25+
}
26+
body {
27+
display: flex;
28+
/* Allows you to scroll below the viewport; default value is visible */
29+
overflow-y: auto;
30+
overscroll-behavior-y: none;
31+
text-rendering: optimizeLegibility;
32+
-webkit-font-smoothing: antialiased;
33+
-moz-osx-font-smoothing: grayscale;
34+
-ms-overflow-style: scrollbar;
35+
}

apps/next/app/layout.tsx

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
if (typeof requestAnimationFrame === 'undefined') {
2+
if (typeof setImmediate !== 'undefined') {
3+
globalThis.requestAnimationFrame = setImmediate
4+
} else {
5+
globalThis.requestAnimationFrame = (callback) => {
6+
const now = Date.now()
7+
callback(now)
8+
return now
9+
}
10+
}
11+
}
12+
import '@tamagui/core/reset.css'
13+
import '@tamagui/font-inter/css/400.css'
14+
import '@tamagui/font-inter/css/700.css'
15+
16+
import { Provider } from 'app/provider'
17+
import { StylesProvider } from './styles-provider'
18+
import { Metadata, Viewport } from 'next'
19+
20+
if (process.env.NODE_ENV === 'production') {
21+
require('../public/tamagui.css')
22+
}
23+
24+
const appUrl = `${process.env.NEXT_PUBLIC_APP_URL}`
25+
const title = `${process.env.NEXT_PUBLIC_METADATA_NAME}`
26+
const description = `${process.env.NEXT_PUBLIC_METADATA_DESCRIPTION}`
27+
28+
export const viewport: Viewport = {
29+
width: 'device-width',
30+
initialScale: 1,
31+
themeColor: '#FFFFFF',
32+
// minimumScale: 1,
33+
// maximumScale: 1,
34+
// userScalable: false,
35+
}
36+
37+
export const metadata: Metadata = {
38+
metadataBase: new URL(appUrl),
39+
title,
40+
description,
41+
openGraph: {
42+
type: 'website',
43+
url: appUrl,
44+
title,
45+
description,
46+
images: [
47+
{
48+
url: `${appUrl}/pwa/icons/apple-touch-icon.png`,
49+
width: 180,
50+
height: 180,
51+
alt: title,
52+
},
53+
],
54+
},
55+
appleWebApp: {
56+
title,
57+
statusBarStyle: 'black-translucent',
58+
},
59+
icons: [
60+
/* Favicons */
61+
{
62+
url: '/pwa/icons/favicon.ico',
63+
rel: 'icon',
64+
},
65+
{
66+
url: '/pwa/icons/favicon.ico',
67+
rel: 'shortcut icon',
68+
},
69+
/* PWA App Icons for iOS */
70+
{
71+
url: '/pwa/icons/touch-icon-iphone.png',
72+
rel: 'apple-touch-icon',
73+
},
74+
{
75+
url: '/pwa/icons/touch-icon-ipad.png',
76+
sizes: '152x152',
77+
rel: 'apple-touch-icon',
78+
},
79+
{
80+
url: '/pwa/icons/touch-icon-iphone-retina.png',
81+
sizes: '180x180',
82+
rel: 'apple-touch-icon',
83+
},
84+
{
85+
url: '/pwa/icons/touch-icon-ipad-retina.png',
86+
sizes: '167x167',
87+
rel: 'apple-touch-icon',
88+
},
89+
/* PWA Splash Screens for iOS */
90+
{
91+
url: '/pwa/splash-screens/iPhone_14_Pro_Max_landscape.png',
92+
media:
93+
'screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
94+
rel: 'apple-touch-startup-image',
95+
},
96+
{
97+
url: '/pwa/splash-screens/iPhone_14_Pro_landscape.png',
98+
media:
99+
'screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
100+
rel: 'apple-touch-startup-image',
101+
},
102+
{
103+
url: '/pwa/splash-screens/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_landscape.png',
104+
media:
105+
'screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
106+
rel: 'apple-touch-startup-image',
107+
},
108+
{
109+
url: '/pwa/splash-screens/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_landscape.png',
110+
media:
111+
'screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
112+
rel: 'apple-touch-startup-image',
113+
},
114+
{
115+
url: '/pwa/splash-screens/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_landscape.png',
116+
media:
117+
'screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
118+
rel: 'apple-touch-startup-image',
119+
},
120+
{
121+
url: '/pwa/splash-screens/iPhone_11_Pro_Max__iPhone_XS_Max_landscape.png',
122+
media:
123+
'screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
124+
rel: 'apple-touch-startup-image',
125+
},
126+
{
127+
url: '/pwa/splash-screens/iPhone_11__iPhone_XR_landscape.png',
128+
media:
129+
'screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
130+
rel: 'apple-touch-startup-image',
131+
},
132+
{
133+
url: '/pwa/splash-screens/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_landscape.png',
134+
media:
135+
'screen and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)',
136+
rel: 'apple-touch-startup-image',
137+
},
138+
{
139+
url: '/pwa/splash-screens/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_landscape.png',
140+
media:
141+
'screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
142+
rel: 'apple-touch-startup-image',
143+
},
144+
{
145+
url: '/pwa/splash-screens/4__iPhone_SE__iPod_touch_5th_generation_and_later_landscape.png',
146+
media:
147+
'screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
148+
rel: 'apple-touch-startup-image',
149+
},
150+
{
151+
url: '/pwa/splash-screens/12.9__iPad_Pro_landscape.png',
152+
media:
153+
'screen and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
154+
rel: 'apple-touch-startup-image',
155+
},
156+
{
157+
url: '/pwa/splash-screens/11__iPad_Pro__10.5__iPad_Pro_landscape.png',
158+
media:
159+
'screen and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
160+
rel: 'apple-touch-startup-image',
161+
},
162+
{
163+
url: '/pwa/splash-screens/10.9__iPad_Air_landscape.png',
164+
media:
165+
'screen and (device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
166+
rel: 'apple-touch-startup-image',
167+
},
168+
{
169+
url: '/pwa/splash-screens/10.5__iPad_Air_landscape.png',
170+
media:
171+
'screen and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
172+
rel: 'apple-touch-startup-image',
173+
},
174+
{
175+
url: '/pwa/splash-screens/10.2__iPad_landscape.png',
176+
media:
177+
'screen and (device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
178+
rel: 'apple-touch-startup-image',
179+
},
180+
{
181+
url: '/pwa/splash-screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_landscape.png',
182+
media:
183+
'screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
184+
rel: 'apple-touch-startup-image',
185+
},
186+
{
187+
url: '/pwa/splash-screens/8.3__iPad_Mini_landscape.png',
188+
media:
189+
'screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)',
190+
rel: 'apple-touch-startup-image',
191+
},
192+
{
193+
url: '/pwa/splash-screens/iPhone_14_Pro_Max_portrait.png',
194+
media:
195+
'screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
196+
rel: 'apple-touch-startup-image',
197+
},
198+
{
199+
url: '/pwa/splash-screens/iPhone_14_Pro_portrait.png',
200+
media:
201+
'screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
202+
rel: 'apple-touch-startup-image',
203+
},
204+
{
205+
url: '/pwa/splash-screens/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_portrait.png',
206+
media:
207+
'screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
208+
rel: 'apple-touch-startup-image',
209+
},
210+
{
211+
url: '/pwa/splash-screens/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_portrait.png',
212+
media:
213+
'screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
214+
rel: 'apple-touch-startup-image',
215+
},
216+
{
217+
url: '/pwa/splash-screens/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_portrait.png',
218+
media:
219+
'screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
220+
rel: 'apple-touch-startup-image',
221+
},
222+
{
223+
url: '/pwa/splash-screens/iPhone_11_Pro_Max__iPhone_XS_Max_portrait.png',
224+
media:
225+
'screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
226+
rel: 'apple-touch-startup-image',
227+
},
228+
{
229+
url: '/pwa/splash-screens/iPhone_11__iPhone_XR_portrait.png',
230+
media:
231+
'screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
232+
rel: 'apple-touch-startup-image',
233+
},
234+
{
235+
url: '/pwa/splash-screens/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_portrait.png',
236+
media:
237+
'screen and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)',
238+
rel: 'apple-touch-startup-image',
239+
},
240+
{
241+
url: '/pwa/splash-screens/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_portrait.png',
242+
media:
243+
'screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
244+
rel: 'apple-touch-startup-image',
245+
},
246+
{
247+
url: '/pwa/splash-screens/4__iPhone_SE__iPod_touch_5th_generation_and_later_portrait.png',
248+
media:
249+
'screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
250+
rel: 'apple-touch-startup-image',
251+
},
252+
{
253+
url: '/pwa/splash-screens/12.9__iPad_Pro_portrait.png',
254+
media:
255+
'screen and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
256+
rel: 'apple-touch-startup-image',
257+
},
258+
{
259+
url: '/pwa/splash-screens/11__iPad_Pro__10.5__iPad_Pro_portrait.png',
260+
media:
261+
'screen and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
262+
rel: 'apple-touch-startup-image',
263+
},
264+
{
265+
url: '/pwa/splash-screens/10.9__iPad_Air_portrait.png',
266+
media:
267+
'screen and (device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
268+
rel: 'apple-touch-startup-image',
269+
},
270+
{
271+
url: '/pwa/splash-screens/10.5__iPad_Air_portrait.png',
272+
media:
273+
'screen and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
274+
rel: 'apple-touch-startup-image',
275+
},
276+
{
277+
url: '/pwa/splash-screens/10.2__iPad_portrait.png',
278+
media:
279+
'screen and (device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
280+
rel: 'apple-touch-startup-image',
281+
},
282+
{
283+
url: '/pwa/splash-screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png',
284+
media:
285+
'screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
286+
rel: 'apple-touch-startup-image',
287+
},
288+
{
289+
url: '/pwa/splash-screens/8.3__iPad_Mini_portrait.png',
290+
media:
291+
'screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)',
292+
rel: 'apple-touch-startup-image',
293+
},
294+
],
295+
}
296+
297+
const T4App = ({ children }: { children: React.ReactNode }) => {
298+
return (
299+
<html lang='en'>
300+
<body>
301+
<script
302+
key='tamagui-animations-mount'
303+
dangerouslySetInnerHTML={{
304+
// avoid flash of animated things on enter
305+
__html: `document.documentElement.classList.add('t_unmounted')`,
306+
}}
307+
/>
308+
<StylesProvider>
309+
<Provider initialSession={null}>{children}</Provider>
310+
</StylesProvider>
311+
</body>
312+
</html>
313+
)
314+
}
315+
316+
export default T4App
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { OAuthSignInScreen, OAuthSignInScreenProps } from 'app/features/oauth/screen'
2+
import { Metadata } from 'next'
3+
import { headers } from 'next/headers'
4+
5+
export const metadata: Metadata = {
6+
title: 'OAuth Sign In',
7+
}
8+
export const runtime = 'edge'
9+
10+
// Apple will POST form data to the redirect URI when scopes have been requested
11+
// @link https://developer.apple.com/documentation/sign_in_with_apple/request_an_authorization_to_the_sign_in_with_apple_server
12+
function getServerSideProps(): OAuthSignInScreenProps {
13+
// Fetch data from external API
14+
let appleUser = null
15+
try {
16+
const userJSON = headers().get('x-apple-user') as string | undefined
17+
if (typeof userJSON === 'string') {
18+
appleUser = JSON.parse(userJSON)
19+
}
20+
} catch (e: unknown) {
21+
console.error(e)
22+
}
23+
return { appleUser }
24+
}
25+
26+
export default async function Page() {
27+
return <OAuthSignInScreen {...getServerSideProps()} />
28+
}

0 commit comments

Comments
 (0)