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
Binary file added FinalPresentation_Taleka.pdf
Binary file not shown.
285 changes: 204 additions & 81 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions android/app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/ic_launcher_background" />
</shape>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/android-icon-foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 37 additions & 14 deletions src/lib/elderStudio.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Directory, Filesystem } from '@capacitor/filesystem';

import type { Database } from '../types/database';
import { withTimeout } from './asyncTimeout';
import { normalizeSemaiKey } from './semaiText';
import { getJSON, setJSON, STORAGE_KEYS } from './storage';
import { supabase } from './supabase';
Expand All @@ -11,6 +12,10 @@ const LOCAL_AUDIO_DIRECTORY = 'studio-recordings';
const AI_BASE_URL = (import.meta.env.VITE_AI_BASE_URL as string | undefined)?.replace(/\/$/, '');
const RECORDINGS_BUCKET = 'recordings';
const PRONUNCIATIONS_BUCKET = 'pronunciations';
const LOCAL_AUDIO_READ_TIMEOUT_MS = 20_000;
const STORAGE_UPLOAD_TIMEOUT_MS = 45_000;
const RECORDING_UPSERT_TIMEOUT_MS = 20_000;
const AI_TRANSCRIPTION_SYNC_TIMEOUT_MS = 45_000;

export const STUDIO_CULTURAL_TAGS = [
'forest',
Expand Down Expand Up @@ -615,10 +620,14 @@ const enqueueForSync = async (recordingId: string): Promise<void> => {
};

const readLocalAudioBlob = async (recording: StudioRecording): Promise<Blob> => {
const { data } = await Filesystem.readFile({
path: recording.localFilePath,
directory: Directory.Data,
});
const { data } = await withTimeout(
Filesystem.readFile({
path: recording.localFilePath,
directory: Directory.Data,
}),
LOCAL_AUDIO_READ_TIMEOUT_MS,
'Unable to read the local audio file. Reopen Elder Studio and retry sync.',
);

if (typeof data !== 'string') {
return data;
Expand Down Expand Up @@ -1001,24 +1010,38 @@ const uploadRecordingToSupabase = async (
const storagePath = `${recording.uploaderId}/${recording.id}.${extension}`;
const audioBlob = await readLocalAudioBlob(recording);

const { error: uploadError } = await supabase.storage
.from('recordings')
.upload(storagePath, audioBlob, {
const { error: uploadError } = await withTimeout(
supabase.storage.from('recordings').upload(storagePath, audioBlob, {
upsert: true,
contentType: recording.mimeType,
});
}),
STORAGE_UPLOAD_TIMEOUT_MS,
'Storage upload timed out. Keep the app open and retry sync.',
);

if (uploadError) {
throw new Error(`Storage upload failed: ${uploadError.message}`);
}

const aiDraft = await requestAiTranscription(storagePath, {
recordingType: recording.recordingType,
});
let aiDraft: StudioAiDraft | null = null;
try {
aiDraft = await withTimeout(
requestAiTranscription(storagePath, {
recordingType: recording.recordingType,
}),
AI_TRANSCRIPTION_SYNC_TIMEOUT_MS,
'AI transcription timed out.',
);
} catch (error) {
console.warn('AI transcription skipped during studio sync:', error);
}

const payload = toRecordingInsertPayload(recording, storagePath, aiDraft, null);
const { error: insertError } = await supabase
.from('recordings')
.upsert(payload, { onConflict: 'id' });
const { error: insertError } = await withTimeout(
supabase.from('recordings').upsert(payload, { onConflict: 'id' }),
RECORDING_UPSERT_TIMEOUT_MS,
'Recording metadata sync timed out. Retry sync from Elder Studio.',
);

if (insertError) {
throw new Error(`Recordings upsert failed: ${insertError.message}`);
Expand Down
61 changes: 55 additions & 6 deletions src/pages/AiHelperPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,15 @@

.tavi-chat-header {
align-items: center;
background: #fff9e9;
display: flex;
flex-shrink: 0;
justify-content: space-between;
position: sticky;
top: 0;
margin: 0 calc((var(--safe-area-right) + 24px) * -1) 0 calc((var(--safe-area-left) + 24px) * -1);
padding: calc(var(--safe-area-top) + 30px) calc(var(--safe-area-right) + 24px) 14px
calc(var(--safe-area-left) + 24px);
position: relative;
z-index: 30;
background: #fff9e9;
padding: calc(var(--safe-area-top) + 12px) 0px 0;
}

.tavi-chat-header-pill {
Expand Down Expand Up @@ -541,7 +543,7 @@
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 16px 0px;
padding: 2px 0px 16px;
-webkit-overflow-scrolling: touch;
}

Expand Down Expand Up @@ -589,7 +591,9 @@

.tavi-bubble {
border-radius: 18px;
box-sizing: border-box;
max-width: 72%;
min-width: 0;
padding: 10px 14px;
}

Expand All @@ -598,13 +602,24 @@
flex-direction: column;
gap: 6px;
max-width: 72%;
min-width: 0;
}

.tavi-bubble-tavi-stack .tavi-bubble {
max-width: 100%;
}
Comment on lines +608 to 610

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The new rule sets max-width: 100% on every .tavi-bubble that lives inside .tavi-bubble-tavi-stack, which includes the translation bubble and the coach-note bubble, not just the loading reply. Previously those bubbles were capped at 72% by the base .tavi-bubble rule. If keeping translation/coach-note bubbles narrower is desired, scope this override to the reply bubble only.

Suggested change
.tavi-bubble-tavi-stack .tavi-bubble {
max-width: 100%;
}
.tavi-bubble-tavi-stack .tavi-bubble--tavi-reply {
max-width: 100%;
}


.tavi-bubble--tavi-reply {
background: #f5c0be;
border-bottom-left-radius: 4px;
}

.tavi-bubble--loading-reply {
max-width: calc(100vw - 120px);
min-width: 186px;
width: 186px;
}

.tavi-bubble--translation {
background: #fff;
border-radius: 18px;
Expand Down Expand Up @@ -825,8 +840,42 @@
.tavi-bubble-loading {
display: grid;
gap: 8px;
min-width: 172px;
max-width: 100%;
min-width: 0;
overflow: hidden;
padding: 3px 0;
width: 100%;
}

.tavi-bubble-loading-line {
background: rgba(137, 88, 61, 0.18);
border-radius: 999px;
display: block;
height: 12px;
overflow: hidden;
position: relative;
}

.tavi-bubble-loading-line::after {
animation: app-skeleton-shimmer 1400ms ease-in-out infinite;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 249, 233, 0.58) 48%,
transparent 100%
);
content: '';
inset: 0;
position: absolute;
transform: translateX(-100%);
}

.tavi-bubble-loading-line--long {
width: 82%;
}

.tavi-bubble-loading-line--short {
width: 54%;
}

.tavi-chat-inputbar {
Expand Down
8 changes: 5 additions & 3 deletions src/pages/AiHelperPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,13 @@ function ChatBubble({
<img src={taviImg} alt="Tavi" className="tavi-bubble-avatar" />

<div className="tavi-bubble-tavi-stack">
<div className="tavi-bubble tavi-bubble--tavi-reply">
<div
className={`tavi-bubble tavi-bubble--tavi-reply${message.loading ? ' tavi-bubble--loading-reply' : ''}`}
>
{message.loading ? (
<div className="tavi-bubble-loading" aria-label="Tavi is preparing a reply">
<AppSkeleton className="app-skeleton--pill" width="82%" height={12} />
<AppSkeleton className="app-skeleton--pill" width="54%" height={12} />
<span className="tavi-bubble-loading-line tavi-bubble-loading-line--long" />
<span className="tavi-bubble-loading-line tavi-bubble-loading-line--short" />
</div>
) : (
<div className="tavi-bubble-text">
Expand Down
4 changes: 4 additions & 0 deletions src/pages/HomePage.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
background: #fff9e9;
}

.home-content-ai-chat-mode::part(scroll) {
overflow: hidden;
}

.home-shell.is-landing {
background: transparent;
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ export function HomePage() {
isGardenRoute ? 'home-content-garden-mode' : '',
isQuizRoute ? 'home-content-quiz-mode' : '',
isLandingRoute ? 'home-content-landing-mode' : '',
isAiChatRoute ? 'home-content-ai-chat-mode' : '',
]
.filter(Boolean)
.join(' ') || undefined;
Expand Down Expand Up @@ -478,7 +479,7 @@ export function HomePage() {

return (
<IonPage>
<IonContent fullscreen className={ionContentClassName}>
<IonContent fullscreen className={ionContentClassName} scrollY={!isAiChatRoute}>
<div className={homeShellClassName}>
<div className={`home-content ${usesStudioSurface ? 'is-studio-surface' : ''}`}>
<div key={routeAnimationKey} className={routeFrameClassName}>
Expand Down
34 changes: 24 additions & 10 deletions src/pages/OnboardingPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}

.onboarding-phone {
--onboarding-panel-top: 300px;
background: #d43d3d;
box-shadow: 0 26px 60px rgba(0, 0, 0, 0.25);
color: #fff;
Expand All @@ -32,12 +33,21 @@
background-size:
auto,
460px 185px;
height: 260px;
height: var(--onboarding-panel-top);
padding: calc(var(--safe-area-top) + 24px) 25px 0;
position: relative;
}

.onboarding-hero--cards {
--onboarding-panel-top: 326px;
}

.onboarding-hero--list {
--onboarding-panel-top: 304px;
}

.onboarding-hero--summary {
--onboarding-panel-top: 193px;
height: 193px;
}

Expand Down Expand Up @@ -122,7 +132,7 @@

.onboarding-heading h1 {
color: #fff;
font-size: 24px;
font-size: clamp(22px, 6.2vw, 28px);
font-weight: 900;
letter-spacing: -0.4px;
line-height: 1.16;
Expand All @@ -131,7 +141,7 @@

.onboarding-heading p {
color: rgba(255, 255, 255, 0.72);
font-size: 16px;
font-size: clamp(14px, 4.2vw, 18px);
font-weight: 400;
line-height: 1.35;
margin: 10px 0 0;
Expand All @@ -143,28 +153,32 @@
bottom: 0;
color: #211916;
left: 0;
min-height: calc(100% - 212px);
padding: 22px 20px calc(var(--safe-area-bottom) + 22px);
position: absolute;
right: 0;
top: var(--onboarding-panel-top);
}

.onboarding-panel--list {
--onboarding-panel-top: 304px;
}

.onboarding-panel--cards {
min-height: calc(100% - 225px);
--onboarding-panel-top: 326px;
}

.onboarding-panel--summary {
min-height: calc(100% - 193px);
--onboarding-panel-top: 193px;
padding: 56px 33px calc(var(--safe-area-bottom) + 22px);
}

.onboarding-option-list {
display: flex;
flex-direction: column;
gap: 10px;
max-height: calc(100dvh - 334px);
max-height: calc(100dvh - var(--onboarding-panel-top) - var(--safe-area-bottom) - 104px);
overflow-y: auto;
padding-right: 1px;
padding: 0 1px 78px 0;
}

.onboarding-option {
Expand Down Expand Up @@ -264,9 +278,9 @@
display: grid;
gap: 28px 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
max-height: calc(100dvh - 358px);
max-height: calc(100dvh - var(--onboarding-panel-top) - var(--safe-area-bottom) - 104px);
overflow-y: auto;
padding: 38px 19px 8px;
padding: 38px 19px 86px;
}

.onboarding-country-card {
Expand Down
Loading