@@ -56,6 +56,7 @@ import { UsageLimitsSection } from "./UsageLimitsPooled";
5656import { Menu } from "../../components/ui/Menu" ;
5757import { SymbolView } from "../../components/ui/AppSymbol" ;
5858import { NativeStackScreenOptions } from "../../native/StackHeader" ;
59+ import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items" ;
5960import type { UsageChartMetric } from "./usageChartData" ;
6061import { PROVIDER_LABEL , useProviderColors , useUsageMixColors } from "./usageProviders" ;
6162
@@ -245,8 +246,31 @@ function UsageScreen(props: {
245246 < SettingsScreen title = "Usage" trailing = { environmentFilter } workspaceRoot = { props . workspace } >
246247 { Platform . OS === "ios" ? (
247248 < NativeStackScreenOptions
248- optionsVersion = { environmentFilter }
249- options = { { headerRight : ( ) => environmentFilter } }
249+ optionsVersion = { JSON . stringify ( { showEnvironmentFilter, filterIcon, environmentActions } ) }
250+ options = { {
251+ // A native menu item, unlike a custom view, moves into the Duo's vertical bar.
252+ unstable_headerRightItems : ( ) =>
253+ showEnvironmentFilter
254+ ? [
255+ withNativeGlassHeaderItem ( {
256+ accessibilityLabel : "Filter usage environments" ,
257+ icon : { name : filterIcon , type : "sfSymbol" } ,
258+ label : "" ,
259+ type : "menu" ,
260+ menu : {
261+ title : "Environments" ,
262+ items : environmentActions . map ( ( action ) => ( {
263+ type : "action" as const ,
264+ label : action . title ,
265+ description : action . subtitle ,
266+ state : action . state === "on" ? ( "on" as const ) : undefined ,
267+ onPress : ( ) => selectEnvironment ( action . id ) ,
268+ } ) ) ,
269+ } ,
270+ } ) ,
271+ ]
272+ : [ ] ,
273+ } }
250274 />
251275 ) : null }
252276 < ScrollView
0 commit comments