Skip to content

Commit

Permalink
Merge branch 'main' into email-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahuldeb5 committed Oct 6, 2024
2 parents cb9c69a + 1ea60f7 commit 0c53f17
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/comps/pages/orgs/OrgNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ const OrgNav = ({ isMobile }: { isMobile: boolean }) => {
return (
<Link
key={i}
component={NavLink}
to={social}
href={social}
target="_blank"
rel="noopener noreferrer"
style={{ textAlign: "center" }}
>
{social}
Expand Down
53 changes: 52 additions & 1 deletion src/pages/orgs/admin/Members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import OrgContext from "../../../comps/context/OrgContext";
import UserContext from "../../../comps/context/UserContext";

import AdminMember from "../../../comps/pages/orgs/admin/AdminMember";
import { Box, Typography } from "@mui/material";
import { Box, Button, TextField, Typography } from "@mui/material";

import { sortByRole } from "../../../utils/DataFormatters";
import { useSnackbar } from "notistack";

const Members = () => {
const { enqueueSnackbar } = useSnackbar();

const user = useContext(UserContext);
const organization = useContext<OrgContextType>(OrgContext);
const members = organization.memberships
Expand All @@ -25,6 +28,7 @@ const Members = () => {
is_faculty: member.users?.is_faculty,
};
});
const member_emails = members.map((member) => member.email).join(", ");

const userMember = organization.memberships.find(
(member) => member.users?.id === user.id,
Expand All @@ -35,6 +39,53 @@ const Members = () => {
<Typography variant="h1" align="center" width="100%">
Manage Members
</Typography>
<Box
sx={{
width: "100%",
display: "flex",
flexWrap: "nowrap",
alignItems: "center",
paddingLeft: "16px",
paddingRight: "16px",
}}
>
<Box
sx={{
paddingTop: "8px",
paddingBottom: "8px",
width: "100%",
}}
>
<TextField
disabled
fullWidth
value={member_emails}
variant="outlined"
/>
</Box>
<Box sx={{ paddingLeft: "16px", width: "100px" }}>
<Button
onClick={async () => {
try {
await navigator.clipboard.writeText(
member_emails,
);
enqueueSnackbar("Copied emails to clipboard!", {
variant: "success",
});
} catch (error) {
enqueueSnackbar(
"Failed to copy emails to clipboard. :( Try manually copying from the page.",
{ variant: "error" },
);
}
}}
variant="contained"
>
Copy
</Button>
</Box>
</Box>
{members
?.sort(sortByRole)
.map((member, i) => (
Expand Down

0 comments on commit 0c53f17

Please sign in to comment.