feat: migrate to Next.js for Mini App and enhance project structure
- Replaced the previous webapp with a new Mini App built using Next.js, improving performance and maintainability. - Updated the `.gitignore` to exclude Next.js build artifacts and node modules. - Revised documentation in `AGENTS.md`, `README.md`, and `architecture.md` to reflect the new Mini App structure and technology stack. - Enhanced Dockerfile to support the new build process for the Next.js application. - Updated CI workflow to build and test the Next.js application. - Added new configuration options for the Mini App, including `MINI_APP_SHORT_NAME` for improved deep linking. - Refactored frontend testing setup to accommodate the new structure and testing framework. - Removed legacy webapp files and dependencies to streamline the project.
This commit is contained in:
25
webapp-next/src/lib/telegram-ready.ts
Normal file
25
webapp-next/src/lib/telegram-ready.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Single-call wrapper for Telegram Mini App ready().
|
||||
* Called once when the first visible screen has finished loading so Telegram
|
||||
* hides its native loading animation only after our content is ready.
|
||||
*/
|
||||
|
||||
import { miniAppReady } from "@telegram-apps/sdk-react";
|
||||
|
||||
let readyCalled = false;
|
||||
|
||||
/**
|
||||
* Calls Telegram miniAppReady() at most once per session.
|
||||
* Safe when SDK is unavailable (e.g. non-Telegram environment).
|
||||
*/
|
||||
export function callMiniAppReadyOnce(): void {
|
||||
if (readyCalled) return;
|
||||
try {
|
||||
if (miniAppReady.isAvailable()) {
|
||||
miniAppReady();
|
||||
readyCalled = true;
|
||||
}
|
||||
} catch {
|
||||
// SDK not available or not in Mini App context; no-op.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user