Skip to content

Commit

Permalink
Merge pull request #2234 from wondrous-dev/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
andywong418 authored Mar 7, 2024
2 parents 8feeb38 + a762968 commit d034ce1
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 49 deletions.
79 changes: 38 additions & 41 deletions wondrous-bot-admin/src/components/Analytics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const AnalyticsComponent = () => {
data: onboardedUsersData,
refetch: onboardedUsersRefetch,
loading: onboardedUsersLoading,
error: onboardedUsersError
error: onboardedUsersError,
} = useQuery(GET_ONBOARDED_USERS_DATA, {
fetchPolicy: "cache-and-network",
notifyOnNetworkStatusChange: true,
Expand All @@ -71,7 +71,6 @@ const AnalyticsComponent = () => {
skip: !activeOrg?.id,
});


return (
<>
<PageHeader title="Analytics" withBackButton={false} />
Expand All @@ -92,46 +91,44 @@ const AnalyticsComponent = () => {
}}
>
<CardsComponent />
<Box data-tour="tutorial-analytics-graphs-selector" width="100%"/>
<Grid display="flex" flexDirection="column" data-tour="tutorial-analytics-graphs" container gap="42px" >
<Grid
display="flex"
gap="24px"
flexWrap="nowrap"
maxWidth="100%"
overflow="hidden"
flexDirection={{
xs: "column",
sm: "row",
}}
>
<MessagesAndReactions data={data?.getCmtyEntitiesCount} refetch={refetch} loading={loading} />
<OnboardedUsers
data={onboardedUsersData?.getOnboardedUsersCount}
refetch={onboardedUsersRefetch}
loading={onboardedUsersLoading}
error={onboardedUsersError}

/>
</Grid>
<Grid
display="flex"
gap="24px"
flexWrap="nowrap"
flexDirection={{
xs: "column",
sm: "row",
}}
>
<Grid width="100%">
<Submissions
data={submissionReports?.getQuestsSubmissionsReport}
refetch={submissionRefetch}
loading={submissionLoading}
/>
<Box data-tour="tutorial-analytics-graphs-selector" width="100%" />
<Grid display="flex" flexDirection="column" data-tour="tutorial-analytics-graphs" container gap="42px">
<Grid
display="flex"
gap="24px"
flexWrap="nowrap"
maxWidth="100%"
overflow="hidden"
flexDirection={{
xs: "column",
sm: "row",
}}
>
<MessagesAndReactions data={data?.getCmtyEntitiesCount} refetch={refetch} loading={loading} />
<OnboardedUsers
data={onboardedUsersData?.getOnboardedUsersCount}
refetch={onboardedUsersRefetch}
loading={onboardedUsersLoading}
error={onboardedUsersError}
/>
</Grid>
<Grid
display="flex"
gap="24px"
flexWrap="nowrap"
flexDirection={{
xs: "column",
sm: "row",
}}
>
<Grid width="100%">
<Submissions
data={submissionReports?.getQuestsSubmissionsReport}
refetch={submissionRefetch}
loading={submissionLoading}
/>
</Grid>
</Grid>
<Heatmap data={presenceData?.getCmtyPresenceAnalytics} loading={presenceLoading} refetch={presenceRefetch} />
</Grid>
</Grid>
<QuestLeaderboard />
<UsersLeaderboard />
Expand Down
17 changes: 14 additions & 3 deletions wondrous-bot-admin/src/components/CmtyUserActivity/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ export default function CmtyUserHeaderComponent({ org }) {
return (
<HeaderBar>
<Box padding="14px" display="flex" justifyContent="space-between" alignItems="center">
<Box display="flex" gap="24px" justifyContent="center" alignItems="center">
<Box
display="flex"
gap="24px"
justifyContent="center"
alignItems="center"
flexWrap={{
xs: "wrap",
sm: "nowrap",
}}
>
<Box display="flex" alignItems="center" gap="8px">
<OrgProfilePicture
profilePicture={org?.profilePicture}
style={{
height: "100%",
width: "100%",
height: "40px",
width: "40px",
objectFit: "cover",
objectPosition: "center",
}}
/>
<Typography
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { Box, ClickAwayListener, Popper, Typography } from "@mui/material";
import { useGlobalContext } from "utils/hooks";
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import { useRef, useState } from "react";
import { WorkspaceDAOIcon } from "components/Icons/DAOIcon";
import { OrgProfilePicture } from "components/Shared/ProjectProfilePicture";
import { WorkspaceContainer, WorkspaceWrapper, WorkspaceImageWrapper } from "components/WorkspaceSwitch/styles";
import { Label } from "components/CreateTemplate/styles";
import CheckCircleOutlineOutlinedIcon from "@mui/icons-material/CheckCircleOutlineOutlined";
import { useNavigate } from "react-router-dom";
import AddImage from "components/Icons/Add.svg";

const InlineWorkspacePicker = () => {
const { activeOrg, userOrgs, setActiveOrg } = useGlobalContext();

const anchorEl = useRef(null);
const hasMoreThanOneOrg = userOrgs.length > 1;

const [isOpen, setIsOpen] = useState(false);

const onClickAway = () => (isOpen ? setIsOpen(false) : null);

const onOrgClick = (org) => {
setActiveOrg(org);
onClickAway();
};

const navigate = useNavigate();
return (
<ClickAwayListener onClickAway={onClickAway}>
<Box
display="flex"
gap="4px"
ref={anchorEl}
onClick={() => setIsOpen((prev) => !prev)}
justifyContent="center"
alignItems="center"
sx={{
borderBottom: "1px solid transparent",
pointerEvents: hasMoreThanOneOrg ? "auto" : "none",
"&:hover": {
cursor: "pointer",
borderColor: "white",
},
}}
>
<Typography
fontSize={{
xs: "28px",
sm: "32px",
}}
whiteSpace="nowrap"
fontWeight={600}
color="white"
>
{activeOrg?.name}
</Typography>
{hasMoreThanOneOrg && (
<KeyboardArrowDownIcon
sx={{
fontSize: {
xs: "28px",
sm: "32px",
},
color: "white",
}}
/>
)}
<Popper
open={isOpen}
placement="bottom-start"
anchorEl={anchorEl.current}
sx={{
zIndex: 999999,
}}
>
<WorkspaceContainer
bgcolor="white"
border="1px solid #000000"
boxShadow="0px 4px 4px rgba(0, 0, 0, 0.25)"
borderRadius="12px"
container
direction={"column"}
gap="8px"
maxHeight="400px"
flexWrap="nowrap"
overflow="auto"
padding="14px"
>
<Label color="#4D4D4D" fontWeight="600" fontSize="13px">
Workspaces
</Label>
{userOrgs?.map((org, idx) => {
const isActive = org.id === activeOrg?.id;
return (
<WorkspaceWrapper onClick={() => onOrgClick(org)} key={org.id}>
<Box display="flex" gap="10px" alignItems="center">
<WorkspaceImageWrapper borderRadius="6px" height="30px" width="30px">
{org?.profilePicture ? (
<OrgProfilePicture
profilePicture={org?.profilePicture}
style={{
width: "100%",
height: "100%",
}}
/>
) : (
<WorkspaceDAOIcon width="100%" height="100%" />
)}
</WorkspaceImageWrapper>
<Label fontWeight={500} fontSize="15px" color="#1D1D1D">
{org.name}
</Label>
</Box>
{isActive && (
<CheckCircleOutlineOutlinedIcon
sx={{
color: "#2A8D5C",
}}
/>
)}
</WorkspaceWrapper>
);
})}
<WorkspaceWrapper onClick={() => navigate("/onboarding/welcome?ref=workspace")}>
<Box display="flex" gap="10px" alignItems="center">
<img
style={{
width: "30px",
height: "30px",
}}
src={AddImage}
/>
<Label color="#1D1D1D" fontWeight={500} fontSize="15px">
Add new
</Label>
</Box>
</WorkspaceWrapper>
</WorkspaceContainer>
</Popper>
</Box>
</ClickAwayListener>
);
};

export default InlineWorkspacePicker;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GET_CHECKOUT_LINK } from "graphql/queries/subscription";
import useAlerts, { useGlobalContext } from "utils/hooks";
import PostHeaderGoogleTag from "components/GoogleTag/PostHeaderGoogleTag";
import PostBodyGoogleTag from "components/GoogleTag/PostBodyGoogleTag";
import InlineWorkspacePicker from "./InlineWorkspacePicker";

const PlanSelectComponent = () => {
const { setSnackbarAlertOpen, setSnackbarAlertMessage, setSnackbarAlertAutoHideDuration } = useAlerts();
Expand Down Expand Up @@ -91,11 +92,14 @@ const PlanSelectComponent = () => {
>
<Box
display="flex"
flexDirection="column"
gap="18px"
gap="10px"
justifyContent="center"
alignItems="center"
padding="42px 42px 0px 42px"
flexDirection={{
xs: "column",
sm: "row",
}}
>
<Typography
fontSize={{
Expand All @@ -105,8 +109,9 @@ const PlanSelectComponent = () => {
fontWeight={600}
color="white"
>
Select your plan
Select your plan for
</Typography>
<InlineWorkspacePicker />
</Box>
<Box
display="flex"
Expand Down
2 changes: 1 addition & 1 deletion wondrous-bot-admin/src/components/Onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const OnboardingComponent = () => {
notifyOnNetworkStatusChange: true,
refetchQueries: ["getLoggedInUserFullAccessOrgs"],
onCompleted: (data) => {
setActiveOrg(data?.createOrg);
setActiveOrg(data?.createCmtyOrg);
navigate("/onboarding/plan-select");
},
});
Expand Down
2 changes: 1 addition & 1 deletion wondrous-bot-admin/src/components/Shared/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const SelectComponent = ({
grouped = false,
groupedOptions = [],
minWidth = "100px",
selectProps={}
selectProps={},
}) => {
const handleChange = (e) => onChange(e.target.value);

Expand Down
4 changes: 4 additions & 0 deletions wondrous-bot-admin/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ button:focus-visible {
left: 42%;
top: 30%;
}

w3m-modal {
z-index: 99999 !important;
}
2 changes: 2 additions & 0 deletions wondrous-bot-admin/src/utils/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const PAGES_WITHOUT_HEADER = [
"/activity",
"/onboarding/plan-select",
"/onboarding/finalize",
"/oauth/google/callback"
];

export const BG_TYPES = {
Expand Down Expand Up @@ -357,6 +358,7 @@ export const EXCLUDED_PATHS = [
"/referral",
"/referral-campaign",
"/activity",
"/oauth/google/callback"
];

export const TUTORIALS = {
Expand Down

0 comments on commit d034ce1

Please sign in to comment.