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
1 change: 1 addition & 0 deletions assets/flags/cambodia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/indonesia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/malaysia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/myanmar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/philippines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/singapore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/thailand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/flags/vietnam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BrowserRouter } from 'react-router-dom';
import { useEffect } from 'react';

import { AppRouter } from './navigation/AppRouter';
import { withTimeout } from './lib/asyncTimeout';
import { supabase } from './lib/supabase';
import { removeKey, STORAGE_KEYS } from './lib/storage';
import { useAuthStore } from './stores/authStore';
Expand All @@ -18,7 +19,11 @@ export default function App() {
const {
data: { session: nextSession },
error,
} = await supabase.auth.getSession();
} = await withTimeout(
supabase.auth.getSession(),
8000,
'Timed out while initialising session.',
);

if (error) {
throw error;
Expand Down Expand Up @@ -55,7 +60,7 @@ export default function App() {

return (
<IonApp>
<BrowserRouter>
<BrowserRouter future={{ v7_startTransition: true }}>
<AppRouter />
</BrowserRouter>
</IonApp>
Expand Down
100 changes: 79 additions & 21 deletions src/components/LearningLanguageBadge.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
.learning-language-badge {
align-items: center;
background: rgba(255, 249, 233, 0.86);
border: 1px solid rgba(96, 72, 40, 0.1);
background: rgba(255, 249, 233, 0.9);
border: 1px solid rgba(96, 72, 40, 0.08);
border-radius: 999px;
box-shadow:
0 6px 16px rgba(68, 46, 24, 0.14),
inset 0 1px 0 rgba(255, 255, 255, 0.78);
0 5px 14px rgba(68, 46, 24, 0.15),
inset 0 1px 0 rgba(255, 255, 255, 0.68);
color: #604828;
cursor: pointer;
display: inline-flex;
font-family: 'Satoshi', 'Poppins', ui-sans-serif, system-ui, sans-serif;
font-weight: 700;
gap: 5px;
justify-content: center;
line-height: 1;
gap: 8px;
justify-content: flex-start;
line-height: 1.1;
max-width: 100%;
min-width: 0;
-webkit-tap-highlight-color: transparent;
Expand All @@ -28,46 +27,105 @@
outline-offset: 2px;
}

.learning-language-badge span {
.learning-language-badge-copy {
display: grid;
gap: 1px;
justify-items: start;
min-width: 0;
}

.learning-language-badge-name,
.learning-language-badge-country {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.learning-language-badge-icon {
.learning-language-badge-name {
color: #3d291c;
font-weight: 800;
line-height: 1.18;
}

.learning-language-badge-country {
color: rgba(61, 41, 28, 0.72);
font-weight: 500;
line-height: 1.2;
}

.learning-language-badge-flag {
align-items: center;
border-radius: 999px;
box-shadow: 0 1px 4px rgba(68, 46, 24, 0.12);
display: inline-flex;
flex-shrink: 0;
justify-content: center;
overflow: hidden;
}

.learning-language-badge-flag img {
border-radius: 999px;
display: block;
height: 100%;
object-fit: cover;
width: 100%;
}

.learning-language-badge-chevron {
flex-shrink: 0;
opacity: 0.72;
margin-left: auto;
opacity: 0.9;
}

.learning-language-badge--home {
align-items: center;
font-size: 12px;
min-height: 30px;
padding: 0 10px;
min-height: 48px;
padding: 0 12px 0 8px;
width: 148px;
}

.learning-language-badge--home .learning-language-badge-icon {
font-size: 14px;
.learning-language-badge--home .learning-language-badge-copy {
align-content: center;
min-height: 32px;
}

.learning-language-badge--home .learning-language-badge-flag {
height: 32px;
width: 32px;
}

.learning-language-badge--home .learning-language-badge-country {
font-size: 11px;
}

.learning-language-badge--home .learning-language-badge-chevron {
font-size: 13px;
color: #3d291c;
font-size: 19px;
}

.learning-language-badge--compact {
font-size: 12px;
min-height: 28px;
font-size: 11px;
gap: 7px;
min-height: 38px;
padding: 0 9px;
width: 130px;
}

.learning-language-badge--compact .learning-language-badge-flag {
height: 24px;
width: 24px;
}

.learning-language-badge--compact .learning-language-badge-icon {
font-size: 13px;
.learning-language-badge--compact .learning-language-badge-copy {
align-content: center;
min-height: 24px;
}

.learning-language-badge--compact .learning-language-badge-country {
font-size: 10px;
}

.learning-language-badge--compact .learning-language-badge-chevron {
font-size: 12px;
font-size: 14px;
}
17 changes: 12 additions & 5 deletions src/components/LearningLanguageBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { chevronDownOutline, globeOutline } from 'ionicons/icons';
import { chevronDownOutline } from 'ionicons/icons';
import { IonIcon } from '@ionic/react';

import { getLearningLanguageMetadata } from '../lib/learningLanguages';

import './LearningLanguageBadge.css';

type LearningLanguageBadgeVariant = 'home' | 'compact';
Expand All @@ -18,7 +20,7 @@ export function LearningLanguageBadge({
onClick,
className,
}: LearningLanguageBadgeProps) {
const label = language;
const metadata = getLearningLanguageMetadata(language);
const classes = ['learning-language-badge', `learning-language-badge--${variant}`, className]
.filter(Boolean)
.join(' ');
Expand All @@ -28,10 +30,15 @@ export function LearningLanguageBadge({
type="button"
className={classes}
onClick={onClick}
aria-label={`Learning language: ${language}`}
aria-label={`Learning language: ${metadata.language}, ${metadata.country}`}
>
<IonIcon className="learning-language-badge-icon" icon={globeOutline} aria-hidden="true" />
<span>{label}</span>
<span className="learning-language-badge-flag" aria-hidden="true">
<img src={metadata.flagSrc} alt="" draggable={false} />
</span>
<span className="learning-language-badge-copy">
<span className="learning-language-badge-name">{metadata.language}</span>
<span className="learning-language-badge-country">{metadata.country}</span>
</span>
<IonIcon
className="learning-language-badge-chevron"
icon={chevronDownOutline}
Expand Down
5 changes: 3 additions & 2 deletions src/components/ui/AppButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IonButton, IonSpinner } from '@ionic/react';
import { IonButton } from '@ionic/react';
import type { ComponentProps } from 'react';
import { AppSkeleton } from './AppSkeleton';

type IonButtonProps = ComponentProps<typeof IonButton>;

Expand All @@ -10,7 +11,7 @@ type AppButtonProps = IonButtonProps & {
export function AppButton({ loading = false, disabled, children, ...props }: AppButtonProps) {
return (
<IonButton disabled={disabled ?? loading} {...props}>
{loading ? <IonSpinner name="crescent" /> : children}
{loading ? <AppSkeleton className="app-skeleton--pill" width={72} height={16} /> : children}

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 Skeleton used for an active-loading state instead of a spinner

AppSkeleton is a content-placeholder pattern meant to convey "data is absent". Using it inside a button while an action is in-progress (e.g. signing in, saving) makes the UI look broken rather than busy, because the shimmer animation implies missing content rather than work underway. The same pattern also appears in the send button in AiHelperPage.tsx. The original IonSpinner (or an equivalent animated indicator) better communicates that a request is in-flight.

Suggested change
{loading ? <AppSkeleton className="app-skeleton--pill" width={72} height={16} /> : children}
{loading ? <IonSpinner name="crescent" /> : children}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

</IonButton>
);
}
Loading
Loading