feat: polish on windows

This commit is contained in:
reya
2024-01-27 15:53:19 +07:00
parent b11e2a4291
commit 8295625a44
11 changed files with 48 additions and 178 deletions

View File

@@ -13,6 +13,7 @@ export function UserFollowButton({
const [followed, setFollowed] = useState(false);
const toggleFollow = async () => {
setLoading(true);
if (!followed) {
const add = await ark.createContact(target);
if (add) setFollowed(true);
@@ -20,6 +21,7 @@ export function UserFollowButton({
const remove = await ark.deleteContact(target);
if (remove) setFollowed(false);
}
setLoading(false);
};
useEffect(() => {
@@ -37,7 +39,12 @@ export function UserFollowButton({
}, []);
return (
<button type="button" onClick={toggleFollow} className={cn("", className)}>
<button
type="button"
disabled={loading}
onClick={toggleFollow}
className={cn("", className)}
>
{loading ? (
<LoaderIcon className="size-4 animate-spin" />
) : followed ? (