Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Telegram Mini Apps #2436

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apps/laboratory/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from 'react'
import { ChakraProvider } from '@chakra-ui/react'
import type { AppProps } from 'next/app'
import Layout from '../layout'
Expand All @@ -7,12 +8,22 @@ import type { Session } from 'next-auth'

bootstrapSentry()

declare global {
interface Window {
Telegram: { WebApp: { ready: () => void } }
}
}

export default function App({
Component,
pageProps
}: AppProps<{
session: Session
}>) {
useEffect(() => {
window.Telegram?.WebApp.ready()
}, [])

return (
<ChakraProvider>
<Layout>
Expand Down
4 changes: 3 additions & 1 deletion apps/laboratory/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { ColorModeScript } from '@chakra-ui/react'
export default function Document() {
return (
<Html lang="en">
<Head />
<Head>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</Head>
<body>
<ColorModeScript initialColorMode="system" />
<Main />
Expand Down
Loading