Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export const metadata: Metadata = {
title: appName,
},
themeColor,
other: {
"base:app_id": "69c257e93c2c56b9bbd2f62a",
},
};

export default function RootLayout({
Expand Down
16 changes: 7 additions & 9 deletions src/components/FarcasterMiniApp.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
"use client";

import { useEffect } from "react";
import { usePlatformDetection } from "../hooks/usePlatformDetection";

/**
* Detects whether the app is running inside a Farcaster client via sdk.context
* and calls `sdk.actions.ready()` to dismiss the splash screen.
* Calls `sdk.actions.ready()` to dismiss the splash screen — only in Farcaster clients.
* After Base App migration (April 2026), Base App operates as standard web app.
*
* Renders nothing — mount once near the root of the component tree.
*/
export function FarcasterMiniApp() {
const { platform, isLoading } = usePlatformDetection();

useEffect(() => {
if (typeof window === "undefined") return;
if (isLoading || platform !== "farcaster") return;

let cancelled = false;

import("@farcaster/miniapp-sdk").then(async ({ sdk }) => {
if (cancelled) return;

// sdk.context is only available when running inside a Farcaster client
const context = await sdk.context;
if (!context || cancelled) return;

sdk.actions.ready();
}).catch(() => {
// Not in a Farcaster context — silently ignore
Expand All @@ -29,7 +27,7 @@ export function FarcasterMiniApp() {
return () => {
cancelled = true;
};
}, []);
}, [platform, isLoading]);

return null;
}
29 changes: 5 additions & 24 deletions src/components/ShareToFarcaster.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client";

import { useEffect, useState, useCallback } from "react";
import { useCallback } from "react";
import { usePlatformDetection } from "../hooks/usePlatformDetection";

/**
* "Share to Farcaster" button — only renders inside a Farcaster Mini App context.
* "Share to Farcaster" button — only renders when platform === 'farcaster'.
* Calls sdk.actions.composeCast() with pre-filled text and story URL as embed.
*/
export function ShareToFarcaster({
Expand All @@ -13,27 +14,7 @@ export function ShareToFarcaster({
storylineId: number;
title: string;
}) {
const [visible, setVisible] = useState(false);

useEffect(() => {
if (typeof window === "undefined") return;

let cancelled = false;

import("@farcaster/miniapp-sdk")
.then(async ({ sdk }) => {
if (cancelled) return;
const ctx = await sdk.context;
if (ctx && !cancelled) setVisible(true);
})
.catch(() => {
// Not in a Farcaster context
});

return () => {
cancelled = true;
};
}, []);
const { platform, isLoading } = usePlatformDetection();

const handleShare = useCallback(async () => {
const { sdk } = await import("@farcaster/miniapp-sdk");
Expand All @@ -48,7 +29,7 @@ export function ShareToFarcaster({
});
}, [storylineId, title]);

if (!visible) return null;
if (isLoading || platform !== "farcaster") return null;

return (
<button
Expand Down
6 changes: 3 additions & 3 deletions src/components/token/SwapInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export function SwapInterface() {
);
}

// Farcaster / Base App — native swap
if (platform === "farcaster" || platform === "base") {
const platformName = platform === "base" ? "Base App" : "Farcaster";
// Farcaster only — native swap (Base App migrated to standard web app Apr 2026)
if (platform === "farcaster") {
const platformName = "Farcaster";

return (
<div className="border-border rounded border p-5 space-y-4">
Expand Down
Loading