Skip to content

Commit

Permalink
IWB-8: debounce some buttons (#309)
Browse files Browse the repository at this point in the history
* added blacklist hook

* black list feature works

* some unused stuff removal

* waitlist seems to work

* simplified removeBlacklist.js

* pretty

* removed transaction and hope that it works

* fixed useBlackList.js hook firestore error, and made blacklist check functional

* added refresh spinner for chooseTeam.js

* updated invalidateKeys and fixed some styling

* updated faulty invalidateKeys lists

* kinda works lmao

* updated the invalidateKeys again

* navigation off chooseTeam works. Tech debt +1

* half finished progress

* invite works

* added waitlistError to ErrorComponent

* pretty

* text input moves above keyboard now

* minor comment change

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* changed console log wording in removeBlacklist

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* removed copied over comment

* updated tiny comment

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* removed redundant log

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* fix - added email to blacklist record

* fix - added assertion if pfp exists when removing a user

* added loading spinner to all buttons

* can't invite already invited email

* accepting invite will remove the invite

* workin on remove user

* added invitelist bug fix

* migrating to react native paper Button's loading property for loading spinner

* redundant comment

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* :/

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>

* prevent double navigation to chooseTeam screen

* remove half baked loading spinner on dialog component (will be its own pr)

* changed dialog component's signature to contain loading

* fixed "invalid-argument"

* debounced invite button

* added key

* last usage of Activity Indicator in a simple button replaced

temp

* Fixed Android keyboard avoiding for invitelist

* removed redundant remove user fix

* pretty

* pretty

* pretty

* pretty

* pretty

* pretty

* IWB-7: allow using the "loading" property in DialogComponent (#313)

* added missing state from merge

* simple fix

* better align invite input with above elements

* debounced invitelist without changing the color of the loading wheel

* changed more "white" to use themecolors, and added spinner color to some buttons

* debounced and error handled Unban

---------

Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>
Co-authored-by: Jake Gehrke <gehrkej@oregonstate.edu>
  • Loading branch information
3 people committed Aug 15, 2024
1 parent 4ce5a04 commit 93695d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions app/segments/(team)/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useState } from "react";
import { ScrollView, View } from "react-native";
import { Button, List } from "react-native-paper";
import { themeColors } from "~/Constants";
import { getErrorString } from "~/Utility";
import ErrorComponent from "~/components/errorComponent";
import Loading from "~/components/loading";
import RefreshInvalidate from "~/components/refreshInvalidate";
Expand Down Expand Up @@ -55,10 +56,20 @@ function Blacklist() {
>
<Button
onPress={async () => {
setUnbanLoading({ ...unbanLoading, [userId]: true });
await removeBlacklist(currentTeamId, userId);
await invalidateMultipleKeys(queryClient, invalidateKeys);
setUnbanLoading({ ...unbanLoading, [userId]: false });
try {
if (unbanLoading[userId]) return;
setUnbanLoading({ ...unbanLoading, [userId]: true });
await removeBlacklist(currentTeamId, userId);
await invalidateMultipleKeys(
queryClient,
invalidateKeys,
);
setUnbanLoading({ ...unbanLoading, [userId]: false });
} catch (e) {
console.log(e);
setUnbanLoading({ ...unbanLoading, [userId]: false });
showDialog("Error", getErrorString(e));
}
}}
textColor={themeColors.accent}
loading={unbanLoading[userId]}
Expand Down
1 change: 1 addition & 0 deletions app/segments/(team)/invitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function Invitelist() {
const [inviteLoading, setInviteLoading] = useState(false);

const onInvite = async () => {
if (inviteLoading) return;
setInviteLoading(true);
if (invitedEmail.includes(currentEmailInput)) {
setStatusText("Email already invited");
Expand Down

0 comments on commit 93695d3

Please sign in to comment.