This commit is contained in:
HugeFrog24
2026-04-26 17:40:52 +02:00
parent 99cc7218a7
commit 02bb07e780
73 changed files with 8846 additions and 6774 deletions
+41
View File
@@ -0,0 +1,41 @@
export const appConfig = {
name: 'Shake the Frog',
description: 'A fun interactive frog that reacts to shaking!',
url: 'https://shakethefrog.com',
assets: {
favicon: '/images/frog.svg',
ogImage: {
width: 1200,
height: 630,
bgColor: '#c9ffda',
textColor: '#000000'
}
},
skins: {
frog: {
id: 'frog',
name: 'Frog',
normal: '/images/frog.svg',
shaken: '/images/frog-shaken.svg',
isPremium: false
},
mandarin: {
id: 'mandarin',
name: 'Mandarin',
normal: '/images/mandarin.svg',
// TODO: Create a proper shaken version of the mandarin skin
shaken: '/images/mandarin.svg', // Using the same image for both states until a shaken version is created
isPremium: false,
variantId: 'your_mandarin_variant_id_here' // Replace with actual variant ID when created
},
beaver: {
id: 'beaver',
name: 'Beaver',
normal: '/images/beaver.svg',
shaken: '/images/beaver-shaken.svg',
isPremium: true,
variantId: '1047017'
}
},
defaultSkin: 'frog'
} as const
+14
View File
@@ -0,0 +1,14 @@
// Define our curated emoji pool
const emojiPool = [
'💫', '💝', '💘', '💖', '💕',
'💓', '💗', '💞', '✨', '🌟',
'🔥', '👼', '⭐', '💎', '💨',
'🎉', '🕸️', '🤗', '💋', '😘',
'🫂', '👫', '💟', '💌', '🥰',
'😍', '🥺', '😢', '😭'
];
// Helper function to get a random emoji
export function getRandomEmoji(): string {
return emojiPool[Math.floor(Math.random() * emojiPool.length)];
}
+20
View File
@@ -0,0 +1,20 @@
/**
* Server-side feature flag definitions.
*
* Flags are read from environment variables. The abstraction is kept thin
* so a runtime provider (Flipt, Unleash, Flags SDK adapter, etc.) can be
* swapped in later without changing any consumer code.
*
* Convention: FEATURE_<NAME>=1 → enabled
* anything else → disabled
*/
export interface FeatureFlags {
paymentsEnabled: boolean;
}
export function getFeatureFlags(): FeatureFlags {
return {
paymentsEnabled: process.env.FEATURE_PAYMENTS === '1',
};
}
+45
View File
@@ -0,0 +1,45 @@
import { lemonSqueezySetup } from '@lemonsqueezy/lemonsqueezy.js';
// Initialize Lemon Squeezy SDK
export function initializeLemonSqueezy() {
const apiKey = process.env.LEMONSQUEEZY_API_KEY;
if (!apiKey) {
throw new Error('LEMONSQUEEZY_API_KEY is required');
}
lemonSqueezySetup({
apiKey,
onError: (error) => {
throw error; // Fail fast instead of just logging
},
});
}
// Lemon Squeezy configuration with lazy validation.
// Config is only resolved on first access so the module can be safely
// imported even when payment env vars are absent (e.g. payments disabled).
let _config: { storeId: string; webhookSecret: string; baseUrl: string } | null = null;
export function getLemonSqueezyConfig() {
if (_config) return _config;
const storeId = process.env.LEMONSQUEEZY_STORE_ID;
const webhookSecret = process.env.LEMONSQUEEZY_WEBHOOK_SECRET;
const baseUrl = process.env.NEXT_PUBLIC_APP_URL;
if (!storeId) {
throw new Error('LEMONSQUEEZY_STORE_ID is required');
}
if (!webhookSecret) {
throw new Error('LEMONSQUEEZY_WEBHOOK_SECRET is required');
}
if (!baseUrl) {
throw new Error('NEXT_PUBLIC_APP_URL is required');
}
_config = { storeId, webhookSecret, baseUrl };
return _config;
}
+32
View File
@@ -0,0 +1,32 @@
export const shakeConfig = {
// Threshold for triggering shake (lower = more sensitive)
threshold: 20, // Increased from 15 to make it less sensitive
// Minimum time between shake detections (in ms)
debounceTime: 100,
// Animation durations (in ms)
animations: {
shakeReset: 600, // Reduced from 10000ms to 600ms (0.6 seconds)
heartsReset: 300, // How long the hearts animation lasts
heartFloat: 2000, // Duration of floating heart animation
heartFadeOut: 2000 // Duration of heart fade out
},
// Hearts configuration
hearts: {
waves: 4, // Number of waves per shake
waveDelay: 200, // Delay between waves in ms
cleanupInterval: 1000, // How often to check for and remove old hearts
minSpeed: 0.8, // Minimum heart float speed
maxSpeed: 1.2, // Maximum heart float speed
minScale: 0.8, // Minimum heart size
maxScale: 1.2, // Maximum heart size
spreadX: 20, // How far hearts can spread horizontally from center
spreadY: 20, // How far hearts can spread vertically from center
maxPerShake: 50 // Maximum number of hearts per shake
},
// Default intensity for manual triggers (click/spacebar)
defaultTriggerIntensity: 25
};
+100
View File
@@ -0,0 +1,100 @@
import { type Locale } from '../../i18n/request';
// Define grammatical cases for languages that need them
type GrammaticalCase = 'nominative' | 'accusative' | 'dative' | 'genitive' | 'instrumental' | 'prepositional';
// Define which languages need grammatical cases
const languagesWithCases: Partial<Record<Locale, boolean>> = {
ru: true,
ka: true
};
// Localized skin names for different languages with grammatical cases
const skinNames: Record<string, Record<Locale, string | Record<GrammaticalCase, string>>> = {
frog: {
en: 'Frog',
de: 'Frosch',
ru: {
nominative: 'Лягушка',
accusative: 'Лягушку',
dative: 'Лягушке',
genitive: 'Лягушки',
instrumental: 'Лягушкой',
prepositional: 'Лягушке'
},
ka: {
nominative: 'ბაყაყი',
accusative: 'ბაყაყს',
dative: 'ბაყაყს',
genitive: 'ბაყაყის',
instrumental: 'ბაყაყით',
prepositional: 'ბაყაყზე'
},
ar: 'ضفدع'
},
mandarin: {
en: 'Mandarin',
de: 'Mandarine',
ru: {
nominative: 'Мандарин',
accusative: 'Мандарин',
dative: 'Мандарину',
genitive: 'Мандарина',
instrumental: 'Мандарином',
prepositional: 'Мандарине'
},
ka: {
nominative: 'მანდარინი',
accusative: 'მანდარინს',
dative: 'მანდარინს',
genitive: 'მანდარინის',
instrumental: 'მანდარინით',
prepositional: 'მანდარინზე'
},
ar: 'ماندرين'
},
beaver: {
en: 'Beaver',
de: 'Biber',
ru: {
nominative: 'Бобр',
accusative: 'Бобра',
dative: 'Бобру',
genitive: 'Бобра',
instrumental: 'Бобром',
prepositional: 'Бобре'
},
ka: {
nominative: 'თახვი',
accusative: 'თახვს',
dative: 'თახვს',
genitive: 'თახვის',
instrumental: 'თახვით',
prepositional: 'თახვზე'
},
ar: 'قندس'
}
};
/**
* Get the localized name for a skin with the appropriate grammatical case
* @param skinId The skin ID
* @param language The language code
* @param grammaticalCase The grammatical case to use (for languages that need it)
* @returns The localized skin name
*/
export function getLocalizedSkinName(
skinId: string,
language: Locale,
grammaticalCase: GrammaticalCase = 'nominative'
): string {
const skinName = skinNames[skinId]?.[language];
// If the language doesn't use cases or we don't have cases for this skin
if (!skinName || typeof skinName === 'string' || !languagesWithCases[language]) {
return typeof skinName === 'string' ? skinName : skinNames[skinId]?.en as string || skinId;
}
// Return the appropriate case, or fallback to nominative if the case doesn't exist
return skinName[grammaticalCase] || skinName.nominative;
}