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
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
import { AppText as Text, AppTextInput } from "../../components/ui/AppText";
import { Button } from "../../components/ui/Button";
import { ProjectFavicon } from "../../components/ProjectFavicon";
import { deriveProjectGroupLabel } from "@t3tools/client-runtime/state/project-grouping";
import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
import { useState } from "react";
import { Platform, Pressable, View } from "react-native";
import { Platform, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { projectEnvironment } from "../../state/projects";
Expand Down Expand Up @@ -123,14 +124,12 @@ function ProjectOverviewContent(props: {
editable={!isSaving}
/>
{canSave ? (
<Pressable
accessibilityRole="button"
accessibilityLabel="Save project name"
<Button
label="Save"
accessibilityHint="Save project name"
tone="secondary"
onPress={saveName}
className="rounded-full bg-subtle-strong px-4 py-2 active:opacity-70"
>
<Text className="text-sm font-t3-medium text-foreground">Save</Text>
</Pressable>
/>
) : null}
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ vi.mock("../../state/use-atom-command", () => ({
vi.mock("../threads/thread-settings-options", () => ({ RUNTIME_MODE_CHOICES: [] }));
vi.mock("../../components/ui/ScreenScrollView", () => ({ ScreenScrollView: Children }));
vi.mock("../../components/ui/AppText", () => ({ AppText: Children }));
vi.mock("../../components/ui/Button", () => ({
Button: ({
label,
disabled,
onPress,
}: {
label: string;
disabled?: boolean;
onPress: () => void;
}) => (
<button disabled={disabled} onClick={onPress}>
{label}
</button>
),
}));
vi.mock("./components/SettingsScreen", () => ({ SettingsScreen: Children }));
vi.mock("./components/SettingsEnvironmentFilterHeader", () => ({
AndroidSettingsEnvironmentFilter: () => null,
Expand Down Expand Up @@ -272,15 +287,15 @@ describe.each([
}));
act(() => root.render(<Screen />));

await act(async () => button("Use environment defaults").click());
await act(async () => button("Use defaults").click());

expectFailures();
expect(button(label).getAttribute("aria-checked")).toBe("true");
expect(button("Use environment defaults").disabled).toBe(false);
expect(button("Use defaults").disabled).toBe(false);

mocks.alert.mockClear();
mocks.updateSettings.mockResolvedValue(AsyncResult.success(undefined));
await act(async () => button("Use environment defaults").click());
await act(async () => button("Use defaults").click());
expect(mocks.updateSettings).toHaveBeenCalledTimes(6);
expect(mocks.alert).not.toHaveBeenCalled();
expect(button(label).getAttribute("aria-checked")).toBe("true");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Pressable, View } from "react-native";
import { View } from "react-native";

import { Button } from "../../../components/ui/Button";
import { AppText as Text } from "../../../components/ui/AppText";
import { SettingsSection } from "./SettingsSection";

Expand All @@ -18,15 +19,13 @@ export function SettingsProjectOverridesSection(props: {
{props.projectLabel}
</Text>
{!props.pending && props.supportsOverrides && props.hasOverrides ? (
<Pressable
accessibilityRole="button"
accessibilityLabel="Use environment defaults"
<Button
label="Use defaults"
accessibilityHint="Use environment defaults for this project"
tone="text"
disabled={props.disabled}
onPress={props.onClear}
className="px-2 py-2 active:opacity-70"
>
<Text className="text-sm font-t3-medium text-primary-text">Use defaults</Text>
</Pressable>
/>
) : null}
</View>
{!props.supportsOverrides ? (
Expand Down
Loading