Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update - minor foreign management UI updates #337

Merged
merged 8 commits into from
Aug 24, 2024
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
12 changes: 12 additions & 0 deletions app/segments/(team)/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Button, List } from "react-native-paper";
import { themeColors } from "~/Constants";
import { getErrorString } from "~/Utility";
import DialogComponent from "~/components/dialog";
import EmptyScreen from "~/components/emptyScreen";
import ErrorComponent from "~/components/errorComponent";
import Loading from "~/components/loading";
import RefreshInvalidate from "~/components/refreshInvalidate";
Expand Down Expand Up @@ -38,6 +39,17 @@ function Blacklist() {

if (blacklistError) return <ErrorComponent errorList={[blacklistError]} />;

if (Object.keys(blacklist).length === 0) {
return (
<EmptyScreen
invalidateKeys={invalidateKeys}
text={
"No users found on blacklist. \n To ban a user, select 'Ban' in the top right of their \n profile from the team page."
}
/>
);
}

return (
<ScrollView
refreshControl={<RefreshInvalidate invalidateKeys={invalidateKeys} />}
Expand Down
123 changes: 72 additions & 51 deletions app/segments/(team)/invitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Button, List } from "react-native-paper";
import { themeColors } from "~/Constants";
import { getErrorString } from "~/Utility";
import DialogComponent from "~/components/dialog";
import EmptyScreen from "~/components/emptyScreen";
import ErrorComponent from "~/components/errorComponent";
import Loading from "~/components/loading";
import RefreshInvalidate from "~/components/refreshInvalidate";
Expand Down Expand Up @@ -90,66 +91,86 @@ export function Invitelist() {
setRemoveCounter(0);
}}
/>
<ScrollView
refreshControl={<RefreshInvalidate invalidateKeys={invalidateKeys} />}
>
<List.Section
style={{
margin: 5,
borderRadius: 5,
}}

{Object.keys(invitelist).length === 0 ? (
<EmptyScreen
invalidateKeys={invalidateKeys}
text={"No invites found. \n Use the input below to invite users."}
/>
) : (
<ScrollView
refreshControl={<RefreshInvalidate invalidateKeys={invalidateKeys} />}
>
{Object.keys(invitelist).map((inviteId) => {
return (
<List.Item
title={invitelist[inviteId].email}
key={inviteId}
right={() => (
<View
style={{
flexDirection: "row",
alignItems: "center",
paddingLeft: 10,
}}
>
<Button
onPress={async () => {
setRemoveLoading({
...removeLoading,
[inviteId]: true,
});
await removeInvitelist(currentTeamId, inviteId);
await invalidateMultipleKeys(
queryClient,
invalidateKeys,
);
setRemoveCounter((prev) => prev + 1);
setSnackbarVisible(true);
setRemoveLoading({
...removeLoading,
[inviteId]: false,
});
}}
height={38} //so the button doesn't change size because of the spinner
textColor={themeColors.accent}
loading={removeLoading[inviteId]}
>
Remove
</Button>
</View>
)}
<List.Section
style={{
margin: 5,
borderRadius: 5,
}}
>
{Object.keys(invitelist).length === 0 ? (
<EmptyScreen
invalidateKeys={invalidateKeys}
text={"No invites found"}
/>
);
})}
</List.Section>
</ScrollView>
) : (
Object.keys(invitelist).map((inviteId) => {
return (
<List.Item
title={invitelist[inviteId].email}
key={inviteId}
right={() => (
<View
style={{
flexDirection: "row",
alignItems: "center",
paddingLeft: 10,
}}
>
<Button
onPress={async () => {
setRemoveLoading({
...removeLoading,
[inviteId]: true,
});
await removeInvitelist(currentTeamId, inviteId);
await invalidateMultipleKeys(
queryClient,
invalidateKeys,
);
setRemoveCounter((prev) => prev + 1);
setSnackbarVisible(true);
setRemoveLoading({
...removeLoading,
[inviteId]: false,
});
}}
height={38} //so the button doesn't change size because of the spinner
textColor={themeColors.accent}
loading={removeLoading[inviteId]}
>
Remove
</Button>
</View>
)}
/>
);
})
)}
</List.Section>
</ScrollView>
)}
<Text>{statusText}</Text>
<View
style={{
flexDirection: "row",
padding: 5,
paddingLeft: 20,
paddingRight: 35,
borderStyle: "solid",
borderWidth: 1,
borderRadius: 5,
borderColor: themeColors.border,
backgroundColor: themeColors.highlight,
}}
>
<TextInput
Expand Down
12 changes: 12 additions & 0 deletions app/segments/(team)/waitlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ActivityIndicator, Button, List } from "react-native-paper";
import { themeColors } from "~/Constants";
import { getErrorString } from "~/Utility";
import DialogComponent from "~/components/dialog";
import EmptyScreen from "~/components/emptyScreen";
import ErrorComponent from "~/components/errorComponent";
import Loading from "~/components/loading";
import RefreshInvalidate from "~/components/refreshInvalidate";
Expand Down Expand Up @@ -42,6 +43,17 @@ function Waitlist() {

const invalidateKeys = [["waitlist"], ["userInfo"]];

if (Object.keys(waitlist).length === 0) {
return (
<EmptyScreen
invalidateKeys={invalidateKeys}
text={
"No users found on waitlist. \n Users will be added upon signing up and \n clicking 'Request to Join Team'."
}
/>
);
}

return (
<ScrollView
refreshControl={<RefreshInvalidate invalidateKeys={invalidateKeys} />}
Expand Down
Loading