diff --git a/src/App.jsx b/src/App.jsx index 828915f..61ea359 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useRef, useEffect, useCallback } from 'react'; import { LayoutDashboard, MessageSquareQuote, @@ -18,152 +18,198 @@ import { FolderOpen, Menu, X, + Loader2, + Volume2, } from 'lucide-react'; +/* ========================================================================== + CONFIG + ========================================================================== */ + +const GEMINI_API_KEY = 'AIzaSyDZn7tv1D3n2zuns8uaXIqp_z1FZTeVyKI'; +const GEMINI_URL = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${GEMINI_API_KEY}`; + +const AI_SYSTEM_PROMPT = `You are a hostile, senior executive playing a roleplay simulation for management consultants at Falah Consulting. +Your persona: a hard-nosed C-suite executive (CIO, CFO, or CEO) who is deeply sceptical of consultants and demands hard financial evidence. +Rules: +- Stay in character as the hostile executive. Never break character. +- Challenge every claim with "So what?", "Prove it financially", or "What's the EBITDA impact?" +- Be concise — max 3 sentences per reply. +- If the user uses buzzwords without data, push back aggressively. +- If the user gives a strong financial case, acknowledge it briefly then raise a new hard objection. +- Do not explain what you are doing or use meta-commentary.`; + /* ========================================================================== MOCK DATA ========================================================================== */ +// Public domain / freely licensed audio samples used as briefing placeholders const MOCK_AUDIO_TRACKS = [ - { id: 1, title: 'The 100-Day Turnaround', duration: '14:20', tag: 'Strategy', author: 'Senior Partner A' }, - { id: 2, title: 'Negotiating with Hostile Boards', duration: '22:15', tag: 'Leadership', author: 'Principal B' }, - { id: 3, title: 'M&A Synergy Identification', duration: '18:45', tag: 'Finance', author: 'Director C' }, - { id: 4, title: 'Digital Transformation Pitfalls', duration: '31:10', tag: 'Technology', author: 'Principal D' }, - { id: 5, title: 'Pricing Strategies in Inflation', duration: '12:55', tag: 'Economics', author: 'Partner E' }, + { + id: 1, + title: 'The 100-Day Turnaround', + duration: '14:20', + tag: 'Strategy', + author: 'Senior Partner A', + // Web Speech API script (real TTS audio) + ttsScript: `Welcome to the 100-Day Turnaround briefing. In a private equity turnaround, the first 100 days are existential. You must identify the three core value levers: cost, revenue, and working capital. In the first two weeks, conduct a rapid diagnostic: interview 20 key stakeholders, map the P&L to operational drivers, and identify the top 5 EBITDA improvement opportunities. By day 30, present a fully costed transformation roadmap with clear accountability. Prioritise quick wins — at least 3 million in annualised savings within 60 days — to build credibility with the board. The cardinal rule: never surprise your sponsor. Weekly steering updates, always leading with financial metrics. Thank you for listening.`, + }, + { + id: 2, + title: 'Negotiating with Hostile Boards', + duration: '22:15', + tag: 'Leadership', + author: 'Principal B', + ttsScript: `This briefing covers negotiating with hostile boards. A hostile board is not an obstacle — it is a data source. Their aggression tells you exactly where the credibility gap is. Rule one: never walk into a board session without pre-reads reviewed by at least 2 board members in advance. Rule two: lead with the number they care most about — usually free cash flow or EBITDA margin. Rule three: when challenged, do not defend your analysis. Reframe. Ask: "What evidence would change your view?" This turns a confrontation into a collaborative hypothesis. Always close with a decision matrix, not a recommendation. Give them the power to choose — between your option and an option you've already stress-tested as inferior. That's the Falah method for hostile board navigation.`, + }, + { + id: 3, + title: 'M&A Synergy Identification', + duration: '18:45', + tag: 'Finance', + author: 'Director C', + ttsScript: `M&A synergy identification is where most deals destroy value. Here is why: acquirers over-estimate revenue synergies by 40% and under-estimate integration costs by 30%. Our Falah framework starts with a synergy taxonomy: cost synergies, revenue synergies, and financial synergies. Cost synergies — headcount, procurement, and real estate — are the only ones you should bank on in year one. Revenue synergies require market overlap, sales force alignment, and at least 18 months of integration. The critical discipline is the synergy validation session: every synergy claim must be signed off by the business unit owner, not the deal team. If they won't sign, cut it from the model. Underpromise and overdeliver. That is the path to a successful integration.`, + }, + { + id: 4, + title: 'Digital Transformation Pitfalls', + duration: '31:10', + tag: 'Technology', + author: 'Principal D', + ttsScript: `Digital transformation fails 70% of the time. The cause is almost never technology. It is governance, change management, and unclear ROI definition. Pitfall one: starting with technology before defining the business problem. Always begin with the customer journey or the operational bottleneck. Pitfall two: underinvesting in change management. Allocate at least 20% of your transformation budget to people and process. Pitfall three: measuring outputs instead of outcomes. Replace "number of APIs deployed" with "reduction in order-to-cash cycle time." The Falah digital transformation framework has three phases: diagnose, design, and deploy. In diagnose, map every process that touches the customer. In design, identify the minimum viable change to deliver maximum impact. In deploy, run parallel operations until the new system proves reliability. Thank you.`, + }, + { + id: 5, + title: 'Pricing Strategies in Inflation', + duration: '12:55', + tag: 'Economics', + author: 'Partner E', + ttsScript: `Pricing in an inflationary environment requires a fundamental shift in mindset. Reactive pricing — simply passing on cost increases — destroys customer relationships. Proactive pricing — anticipating inflation and embedding flexibility in contracts — preserves margin and trust. There are three strategies we deploy at Falah. First, value-based pricing: anchor your price to the economic value you deliver, not your cost base. Second, dynamic pricing tiers: create good, better, best options so customers self-select, protecting your premium tier. Third, contract architecture: build in annual CPI-linked adjustments so price increases feel automatic, not adversarial. The bottom line: every 1% improvement in price realisation drops directly to EBITDA. Pricing is the highest-leverage tool in your margin toolkit.`, + }, ]; const MOCK_WIKI_DIRECTORY = [ - { - folder: 'Core Frameworks', - items: ['Falah MECE Guidelines', 'Value Creation Matrix', 'Go-To-Market Playbook'] - }, - { - folder: 'Banking Edition', - items: ['Retail Bank Cost Reduction', 'Fintech Threat Analysis', 'Regulatory Compliance 2026'] - }, - { - folder: 'Telco Edition', - items: ['5G Monetization', 'Churn Reduction Models'] - } -]; - -const MOCK_CHAT_HISTORY = [ - { role: 'system', text: 'Falah Simulator initialized. Persona: Hostile Telco CIO. Objective: Justify £2M Agile Transformation.' }, - { role: 'user', text: 'Good morning. I\'d like to walk you through the projected ROI for the Agile Transformation initiative.' }, - { role: 'assistant', text: 'I don\'t have time for buzzwords today. You want £2M of my budget to "transform" teams that are already delivering. Where is the hard financial justification? I need EBITDA impact, not velocity charts.' }, + { folder: 'Core Frameworks', items: ['Falah MECE Guidelines', 'Value Creation Matrix', 'Go-To-Market Playbook'] }, + { folder: 'Banking Edition', items: ['Retail Bank Cost Reduction', 'Fintech Threat Analysis', 'Regulatory Compliance 2026'] }, + { folder: 'Telco Edition', items: ['5G Monetization', 'Churn Reduction Models'] }, ]; /* ========================================================================== - SUB-VIEWS + HELPERS ========================================================================== */ -const MissionControlView = ({ setActiveView, setActiveAudio }) => { - return ( -
Welcome back. Your Falah Coach portal is ready.
-- Master the critical first 100 days of a private equity backed turnaround. Tactical insights from our top Senior Partners. -
-Practice hostile boardroom scenarios.
-Review the Falah MECE Guidelines.
-Engage in high-pressure executive roleplay to refine your delivery.
Exclusive micro-learning tracks from Falah's leadership network.
-Exclusive micro-learning tracks from Falah's leadership network.
+Welcome back. Your Falah Coach portal is ready.
++ Master the critical first 100 days of a private equity backed turnaround. Tactical insights from our top Senior Partners. +
+{desc}
Falah Playbooks & Living Intellectual Property.
+Falah Playbooks & Living Intellectual Property.
- This document serves as the canonical reference for exactly how our consultants should approach problem structuring in this domain. -
-This document serves as the canonical reference for exactly how our consultants should approach problem structuring in this domain.
+Drive unambiguous clarity to executive stakeholders within 3 minutes of engagement.
+Drive unambiguous clarity to executive stakeholders within 3 minutes of engagement.
Achieve client alignment before the first break in the agenda.
+Achieve client alignment before the first break in the agenda.
- The imperative here is not just structural elegance, but actionable intelligence. When framing the issue, prioritize the financial delta and the organizational capacity required to capture it. -
+The imperative here is not just structural elegance, but actionable intelligence. When framing the issue, prioritise the financial delta and the organisational capacity required to capture it.
- {activeAudio.title} -
-{activeAudio.author}
-{activeTrack.title}
+{activeTrack.author}
+ {/* Seekable progress bar */} +Coach Portal
{activeAudio.title}
-Now Playing
+ {activeTrack && ( +{activeTrack.title}
+{isPlaying ? 'Now Playing' : 'Paused'} · {formatTime(currentTime)}
+