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
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.
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.
4 changes: 2 additions & 2 deletions apps/mobile/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Build a ⋯ menu with `ActionMenuButton` (`src/ui/primitives/action-menu-button`

- Activity has two header entries: **Filter and sort** and **Search Activity**. Sorting is part of the same options sheet as category, unread-only, Bot and conversation filters.
- iOS uses native navigation toolbar buttons: the system supplies Liquid Glass on iOS 26 and its supported appearance on earlier versions. Active search replaces the title, Filter and Search buttons with the same header search field as Chats, in the measured header row, so accessibility text can grow without clipping. Android uses opaque Material-style icon actions and its native text input.
- The iOS options sheet uses system page-sheet presentation with swipe dismissal, inset grouped rows and trailing checkmarks. Android uses the modal bottom-sheet surface, leading radio indicators and system Back dismissal. Unread-only uses a native switch on each platform. Long option lists virtualize and scroll; footer actions remain reachable.
- The iOS options sheet uses system page-sheet presentation with swipe dismissal, inset grouped rows and trailing checkmarks. Android uses the modal bottom-sheet surface, leading Material 3 radio buttons (Compose `RadioButton` through the `RadioMark` primitive) and system Back dismissal. Unread-only uses the `Toggle` primitive, so each platform gets its native switch. Long option lists virtualize and scroll; footer actions remain reachable.
- Options apply immediately and remain selected after swipe dismissal or Android Back; there are no Cancel/Done actions. Reset all immediately restores default ordering and the Needs you tab, with all Bots/conversations and unread-only off. Search is independent of this reset. The search field keeps the header's outer gutters; iOS search keeps its built-in clear control. Tapping blank list space or ending editing returns the header to its title and buttons and preserves the query for reopening, with the Search button tinted while a query applies, so Filter and sort stay reachable during a search. The close button (iOS) or back arrow and system Back (Android) clears the query. The focused Activity screen owns status-bar contrast for its current appearance.

References: [Apple toolbars](https://developer.apple.com/design/human-interface-guidelines/toolbars), [Apple sheets](https://developer.apple.com/design/human-interface-guidelines/sheets), [Material bottom sheets](https://m3.material.io/components/bottom-sheets/guidelines), [Android radio selection](https://developer.android.com/develop/ui/compose/components/radio-button).
Expand Down Expand Up @@ -299,7 +299,7 @@ Each layer has `fill`, `pressed`, `selected` (neutral, such as the current tab),
- A drawer owns one `SheetStack`: its handle stays fixed while secondary pages push/back inside the same native sheet. Global usage, App icon and notifications, profile model/workspace/notifications, routine detail/create/edit, Token detail and memory files share this navigation. Child headers consume no second status-bar inset; headers and bodies use `theme.overlay.fill`, with raised content groups. Editors reuse their existing validation and Host mutation ports.
- Profile token totals retain reported usage when other calls are unknown, using the global Settings count format (`674.7K+`, for example). Completely unreported usage remains unknown; an idle, fully reported window may show zero.
- `src/ui/design/` holds the tokens and theme (ADR-0201).
- `src/ui/primitives/` holds `Text` (variant `meta` / `body` / `title`, and a tone that is a colour role), `Button`, `Toggle`, `SettingsRow`, `SettingsSection` and `SettingsGroupItem`, `CountBadge`, `Segmented` (the native segmented control: a SwiftUI segmented `Picker` on iOS, a Material 3 `SingleChoiceSegmentedButtonRow` on Android; each label is one short word so no segment wraps), `DayBars` (one bar per day or week, scaled to the busiest, optionally stacked in tones from `design/chart.ts`; an empty day keeps a stub on the layer's `inset`), `DayHeat` (a weeks × weekdays heatmap), and later `Icon`, `IconButton`, `Button`, `Avatar`, `Card`, `SettingsRow` and `EmptyState`.
- `src/ui/primitives/` holds `Text` (variant `meta` / `body` / `title`, and a tone that is a colour role), `Button`, `Toggle`, `SettingsRow`, `SettingsSection` and `SettingsGroupItem`, `CountBadge`, `Segmented` (the native segmented control: a SwiftUI segmented `Picker` on iOS, a Material 3 `SingleChoiceSegmentedButtonRow` on Android with single-line labels; on Android, when the labels cannot fit on one row at the current system text size it becomes a radio list of the same options, never a wrapped or clipped segment), `PercentageSlider` (a 0–100 slider; Compose `Slider` on Android), `Chip` (a single-choice chip; Compose `FilterChip` on Android), `RadioMark` (a decorative leading radio for a row that owns the radio semantics; Compose `RadioButton` on Android), `DayBars` (one bar per day or week, scaled to the busiest, optionally stacked in tones from `design/chart.ts`; an empty day keeps a stub on the layer's `inset`), `DayHeat` (a weeks × weekdays heatmap), and later `Icon`, `IconButton`, `Button`, `Avatar`, `Card`, `SettingsRow` and `EmptyState`.
- Forms use `TextField` from `primitives/text-field`: the `field` layer, a hairline `field` edge, `radius.md`, a touch-height minimum (two lines when multiline) and the system clear button on single-line fields. Give every field a placeholder or a visible label, and the keyboard and content type its value needs (`url`, `emailAddress`). `SearchField` leads with a magnifying glass and relies on the native iOS clear button; Android, which has none, adds its own.
- Follow the HIG for alerts and action sheets. An action that can't be undone (unpair, remove access, revoke, sign out, reset) asks first through `confirmDestructive`: a title that names the action, Cancel first, then the destructive button. A short list of actions on one item uses `showActionMenu`, which on iOS is an action sheet with the destructive action last and Cancel set apart; never show such a list as a centered alert.
- `src/ui/chat/` will hold the conversation row, bubble, message group, time separator, action cards, composer, working status and scroll-to-bottom.
Expand Down
39 changes: 39 additions & 0 deletions apps/mobile/src/ui/primitives/chip.android.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { FilterChip, Host, Text as ComposeText } from '@expo/ui/jetpack-compose';
import { View } from 'react-native';

import { useDesignTheme } from '../design/theme';

export function Chip({
label,
count,
selected,
onPress,
}: {
label: string;
count?: number;
selected: boolean;
onPress(): void;
}) {
const theme = useDesignTheme();
return (
<View style={{ minHeight: theme.touch, justifyContent: 'center' }}>
<Host colorScheme={theme.scheme} seedColor={theme.color.accent} matchContents>
<FilterChip
selected={selected}
onClick={onPress}
border={{ color: selected ? theme.color.accent : theme.color.muted }}
colors={{
containerColor: 'transparent',
labelColor: theme.color.fg,
selectedContainerColor: theme.layer.canvas.chosen,
selectedLabelColor: theme.color.fg,
}}
>
<FilterChip.Label>
<ComposeText>{count === undefined ? label : `${label} ${count}`}</ComposeText>
</FilterChip.Label>
</FilterChip>
</Host>
</View>
);
}
55 changes: 55 additions & 0 deletions apps/mobile/src/ui/primitives/percentage-slider.android.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Host, Slider } from '@expo/ui/jetpack-compose';
import { View } from 'react-native';

import { useDesignTheme } from '../design/theme';

export function PercentageSlider({
label,
value,
onChange,
}: {
label: string;
value: number;
onChange(value: number): void;
}) {
const theme = useDesignTheme();
return (
<View
accessible
accessibilityRole="adjustable"
accessibilityLabel={label}
accessibilityValue={{ min: 0, max: 100, now: value, text: `${value}%` }}
accessibilityActions={[{ name: 'increment' }, { name: 'decrement' }]}
onAccessibilityAction={(event) =>
onChange(
Math.max(
0,
Math.min(100, value + (event.nativeEvent.actionName === 'increment' ? 5 : -5)),
),
)
}
style={{ minHeight: theme.touch, justifyContent: 'center' }}
>
<View importantForAccessibility="no-hide-descendants">
<Host
colorScheme={theme.scheme}
seedColor={theme.color.accent}
matchContents={{ vertical: true }}
style={{ width: '100%' }}
>
<Slider
value={value}
min={0}
max={100}
onValueChange={(next) => onChange(Math.round(next))}
colors={{
thumbColor: theme.color.accent,
activeTrackColor: theme.color.accent,
inactiveTrackColor: theme.layer.raised.inset,
}}
/>
</Host>
</View>
</View>
);
}
18 changes: 18 additions & 0 deletions apps/mobile/src/ui/primitives/radio-mark.android.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Host, RadioButton } from '@expo/ui/jetpack-compose';
import { View } from 'react-native';

import { useDesignTheme } from '../design/theme';

export function RadioMark({ selected }: { selected: boolean }) {
const theme = useDesignTheme();
return (
<View importantForAccessibility="no-hide-descendants" pointerEvents="none">
<Host colorScheme={theme.scheme} seedColor={theme.color.accent} matchContents>
<RadioButton
selected={selected}
colors={{ selectedColor: theme.color.accent, unselectedColor: theme.color.muted }}
/>
</Host>
</View>
);
}
32 changes: 32 additions & 0 deletions apps/mobile/src/ui/primitives/radio-mark.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { View } from 'react-native';

import { useDesignTheme } from '../design/theme';
import { edge, radius, space } from '../design/tokens';

export function RadioMark({ selected }: { selected: boolean }) {
const theme = useDesignTheme();
return (
<View
style={{
width: theme.type.body.line,
height: theme.type.body.line,
borderRadius: radius.round,
borderWidth: edge.focus,
borderColor: selected ? theme.color.accent : theme.color.muted,
alignItems: 'center',
justifyContent: 'center',
}}
>
{selected ? (
<View
style={{
width: space.x3,
height: space.x3,
borderRadius: radius.round,
backgroundColor: theme.color.accent,
}}
/>
) : null}
</View>
);
}
95 changes: 87 additions & 8 deletions apps/mobile/src/ui/primitives/segmented.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,119 @@ import {
Host,
SegmentedButton,
SingleChoiceSegmentedButtonRow,
Text,
Text as ComposeText,
} from '@expo/ui/jetpack-compose';
import { fillMaxWidth } from '@expo/ui/jetpack-compose/modifiers';
import { View } from 'react-native';
import { Pressable, View, useWindowDimensions } from 'react-native';

import { useDesignTheme } from '../design/theme';
import { pressTint, useDesignTheme } from '../design/theme';
import { radius, space } from '../design/tokens';
import { RadioMark } from './radio-mark';
import type { SegmentedProps } from './segmented';
import { Text } from './text';

const LABEL_SIZE = 14;
const SEGMENT_PADDING = 24;
const CHECK_WIDTH = 26;

function labelWidth(text: string, fontScale: number): number {
let ems = 0;
for (const char of text) ems += (char.codePointAt(0) ?? 0) >= 0x2e80 ? 1 : 0.5;
return ems * LABEL_SIZE * fontScale;
}

export function segmentsFit(labels: readonly string[], width: number, fontScale: number): boolean {
const widest = Math.max(0, ...labels.map((text) => labelWidth(text, fontScale)));
return labels.length * (widest + SEGMENT_PADDING) + CHECK_WIDTH <= width - space.x5 * 2;
}

export function Segmented<T extends string>({
label,
options,
value,
on = 'canvas',
onChange,
}: SegmentedProps<T>) {
const theme = useDesignTheme();
const layer = theme.layer[on];
const { width, fontScale } = useWindowDimensions();
if (
!segmentsFit(
options.map((option) => option.label),
width,
fontScale,
)
)
return (
<View accessibilityRole="radiogroup" accessibilityLabel={label} style={{ gap: space.x1 }}>
{options.map((option, index) => {
const selected = option.value === value;
const top = index === 0 ? radius.lg : radius.xs;
const bottom = index === options.length - 1 ? radius.lg : radius.xs;
return (
<Pressable
key={option.value}
accessibilityRole="radio"
accessibilityLabel={option.label}
accessibilityState={{ checked: selected }}
onPress={() => {
if (!selected) onChange(option.value);
}}
android_ripple={{ color: pressTint(theme.color.fg) }}
style={{
minHeight: theme.touch,
flexDirection: 'row',
alignItems: 'center',
gap: space.x4,
paddingHorizontal: space.x5,
paddingVertical: space.x3,
overflow: 'hidden',
borderTopLeftRadius: top,
borderTopRightRadius: top,
borderBottomLeftRadius: bottom,
borderBottomRightRadius: bottom,
backgroundColor: selected ? layer.chosen : layer.fill,
}}
>
<RadioMark selected={selected} />
<Text style={{ flex: 1 }}>{option.label}</Text>
</Pressable>
);
})}
</View>
);
return (
<View accessibilityRole="tablist" accessibilityLabel={label}>
<View accessibilityRole="radiogroup" accessibilityLabel={label}>
<Host
matchContents={{ vertical: true }}
colorScheme={theme.scheme}
seedColor={theme.color.accent}
style={{ alignSelf: 'stretch' }}
matchContents={{ vertical: true }}
style={{ width: '100%' }}
>
<SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
<SingleChoiceSegmentedButtonRow
key={options.map((option) => option.value).join('\n')}
modifiers={[fillMaxWidth()]}
>
{options.map((option) => (
<SegmentedButton
key={option.value}
selected={option.value === value}
onClick={() => {
if (option.value !== value) onChange(option.value);
}}
colors={{
activeContainerColor: layer.chosen,
activeContentColor: theme.color.fg,
activeBorderColor: theme.color.muted,
inactiveContainerColor: 'transparent',
inactiveContentColor: theme.color.fg,
inactiveBorderColor: theme.color.muted,
}}
>
<SegmentedButton.Label>
<Text maxLines={1}>{option.label}</Text>
<ComposeText maxLines={1} softWrap={false}>
{option.label}
</ComposeText>
</SegmentedButton.Label>
</SegmentedButton>
))}
Expand Down
37 changes: 8 additions & 29 deletions apps/mobile/src/ui/shell/activity-filters.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { ReactNode } from 'react';
import { FlatList, Modal, Platform, Pressable, Switch, View } from 'react-native';
import { FlatList, Modal, Platform, Pressable, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import { INBOX_SECTIONS, type InboxSection, type InboxSetAside } from '../../host/inbox';
import { Sheet } from '../chat/sheet';
import { useDesignTheme } from '../design/theme';
import { edge, radius, space } from '../design/tokens';
import { DrawerHeader } from '../primitives/drawer-header';
import { RadioMark } from '../primitives/radio-mark';
import { Text } from '../primitives/text';
import { Toggle } from '../primitives/toggle';
import { CheckIcon } from './icons';
import { t } from '../strings';

Expand Down Expand Up @@ -71,30 +73,7 @@ function Selection({ selected }: { selected: boolean }) {
const theme = useDesignTheme();
if (Platform.OS === 'ios')
return selected ? <CheckIcon color={theme.color.accent} size={theme.type.body.line} /> : null;
return (
<View
style={{
width: theme.type.body.line,
height: theme.type.body.line,
borderRadius: radius.round,
borderWidth: edge.focus,
borderColor: selected ? theme.color.accent : theme.color.muted,
alignItems: 'center',
justifyContent: 'center',
}}
>
{selected ? (
<View
style={{
width: space.x3,
height: space.x3,
borderRadius: radius.round,
backgroundColor: theme.color.accent,
}}
/>
) : null}
</View>
);
return <RadioMark selected={selected} />;
}

function OptionsEditor({ bots, channels, filter, sort, onFilter, onSort, onClose }: Props) {
Expand Down Expand Up @@ -229,11 +208,11 @@ function OptionsEditor({ bots, channels, filter, sort, onFilter, onSort, onClose
}}
>
<Text style={{ flex: 1 }}>{t.activityUnreadOnly}</Text>
<Switch
accessibilityLabel={t.activityUnreadOnly}
<Toggle
label={t.activityUnreadOnly}
value={filter.unreadOnly === true}
onValueChange={(unreadOnly) => onFilter({ ...filter, unreadOnly })}
trackColor={{ true: theme.color.accent }}
on="raised"
onChange={(unreadOnly) => onFilter({ ...filter, unreadOnly })}
/>
</View>
);
Expand Down
Loading
Loading