feat(mobile): add loading indicator to buttons

This commit is contained in:
daniel31x13
2025-11-13 03:19:49 -05:00
parent fa4d9313ff
commit ffee9d0551
4 changed files with 17 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ export default function HomeScreen() {
const { auth, signIn } = useAuthStore();
const { colorScheme } = useColorScheme();
const [method, setMethod] = useState<"password" | "token">("password");
const [isLoading, setIsLoading] = useState(false);
const [form, setForm] = useState({
user: "",
@@ -161,12 +162,20 @@ export default function HomeScreen() {
<Button
variant="accent"
size="lg"
onPress={() => {
isLoading={isLoading}
onPress={async () => {
if (
((form.user && form.password) || form.token) &&
form.instance
) {
signIn(form.user, form.password, form.instance, form.token);
setIsLoading(true);
await signIn(
form.user,
form.password,
form.instance,
form.token
);
setIsLoading(false);
}
}}
>

View File

@@ -50,6 +50,7 @@ export default function AddLinkSheet() {
}
)
}
isLoading={addLink.isPending}
variant="accent"
className="mb-2"
>

View File

@@ -119,6 +119,7 @@ const Main = (props: SheetProps<"edit-link-sheet">) => {
},
})
}
isLoading={editLink.isPending}
variant="accent"
className="mb-2"
>

View File

@@ -10,10 +10,10 @@ type AuthStore = {
username: string,
password: string,
instance: string,
token: string
) => void;
signOut: () => void;
setAuth: () => void;
token?: string
) => Promise<void>;
signOut: () => Promise<void>;
setAuth: () => Promise<void>;
};
const useAuthStore = create<AuthStore>((set) => ({