-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2262 from wondrous-dev/staging
Staging
- Loading branch information
Showing
5 changed files
with
188 additions
and
87 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
wondrous-bot-admin/src/components/StartReferralQuests/ReferralAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Masonry } from "@mui/lab"; | ||
import { Box } from "@mui/material"; | ||
import { useMemo } from "react"; | ||
import IndividualQuestComponent from "./IndividualQuestComponent"; | ||
import { useDiscordConnect } from "./utils/hooks"; | ||
import { SharedSecondaryButton } from "components/Shared/styles"; | ||
import { shouldDisplayJoinDiscordButton } from "./utils/customization"; | ||
|
||
const EndedCampaignPrompt = ({ orgId }) => { | ||
const { isMember, handleJoinDiscord } = useDiscordConnect({ | ||
orgId, | ||
}); | ||
|
||
const handleClick = () => { | ||
return handleJoinDiscord({ | ||
shouldVerify: false, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Box height="100%"> | ||
<SharedSecondaryButton onClick={handleClick}>{isMember ? "Visit Discord" : "Join Discord"}</SharedSecondaryButton> | ||
</Box> | ||
); | ||
}; | ||
|
||
const ReferralAction = ({ quests, onStartQuest, hasEnded = false, orgId }) => { | ||
const masonryColumnsConfig = useMemo(() => { | ||
if (quests?.length <= 1) { | ||
return { xs: 1 }; | ||
} else if (quests?.length <= 2) { | ||
return { xs: 1, sm: 2 }; | ||
} | ||
return { xs: 1, sm: 2, md: 2, lg: 3 }; | ||
}, [quests?.length]); | ||
|
||
const showDiscordButton = shouldDisplayJoinDiscordButton(orgId); | ||
if (hasEnded && showDiscordButton) return <EndedCampaignPrompt orgId={orgId} />; | ||
return ( | ||
<Box | ||
bgcolor="#AF9EFF" | ||
height="100%" | ||
padding="32px 56px" | ||
display="flex" | ||
width="100%" | ||
flex="1" | ||
justifyContent="center" | ||
alignItems="flex-start" | ||
> | ||
<Masonry | ||
spacing={4} | ||
columns={masonryColumnsConfig} | ||
sx={{ | ||
alignContent: "center", | ||
width: "100%", | ||
}} | ||
> | ||
{quests?.map((quest, index) => ( | ||
<Box | ||
width="100%" | ||
display="flex" | ||
justifyContent="center" | ||
sx={{ | ||
maxWidth: "350px", | ||
}} | ||
> | ||
<IndividualQuestComponent quest={quest} key={index} onStartQuest={onStartQuest} /> | ||
</Box> | ||
))} | ||
</Masonry> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default ReferralAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
wondrous-bot-admin/src/components/StartReferralQuests/utils/customization.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { EXOCORE_ORG_ID } from "utils/constants"; | ||
|
||
export const shouldDisplayJoinDiscordButton = (orgId) => { | ||
return [EXOCORE_ORG_ID, '113598456040259806', '112829438976065706'].includes(orgId); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters