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

Add team feature fake door #1587

Merged
merged 4 commits into from
Sep 28, 2021
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
77 changes: 77 additions & 0 deletions packages/files-ui/src/Components/Elements/TeamModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { Button, Typography } from "@chainsafe/common-components"
import { createStyles, makeStyles } from "@chainsafe/common-theme"
import { Trans } from "@lingui/macro"
import React, { useCallback } from "react"
import { CSFTheme } from "../../Themes/types"
import { ROUTE_LINKS } from "../FilesRoutes"
import CustomModal from "./CustomModal"

const useStyles = makeStyles(
({ constants }: CSFTheme) => {
return createStyles({
root: {
padding: `${constants.generalUnit * 6}px ${constants.generalUnit * 4}px`,
flexDirection: "column",
display: "flex",
alignItems: "center"
},
title: {
marginBottom: constants.generalUnit * 3
},
modalInner: {
maxWidth: "600px !important"
},
buttonContainer: {
width: "100%"
},
nextButton: {
margin: "auto",
marginTop: constants.generalUnit * 3
}
})
})

interface Props {
onHide: () => void
}

const TeamModal = ({ onHide }: Props) => {
const classes = useStyles()

const onSignupTeamClick = useCallback(() => {
window.open(ROUTE_LINKS.TeamSignup, "_blank")
onHide()
}, [onHide])

return (
<CustomModal
injectedClass={{ inner: classes.modalInner }}
active={true}
closePosition="right"
maxWidth="sm"
onClose={onHide}
mobileStickyBottom={false}
>
<div className={classes.root}>
<Typography variant="h2"
className={classes.title}
>
<Trans>Teams</Trans>
</Typography>
<Typography variant="h4">
<Trans>A better sharing experience is coming soon.</Trans>
</Typography>
<div className={classes.buttonContainer}>
<Button
data-posthog="Sign-me-up"
className={classes.nextButton}
onClick={onSignupTeamClick}
>
<Trans>Sign me up!</Trans>
</Button>
</div>
</div>
</CustomModal>
)}

export default TeamModal
3 changes: 2 additions & 1 deletion packages/files-ui/src/Components/FilesRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const ROUTE_LINKS = {
const adjustedRawCurrentPath = !rawCurrentPath ? "/" : rawCurrentPath
return `/shared/${bucketId}${adjustedRawCurrentPath}`
},
DiscordInvite: "https://discord.gg/zAEY37fNb2"
DiscordInvite: "https://discord.gg/zAEY37fNb2",
TeamSignup: "https://shrl.ink/cgQy"
}

export const SETTINGS_PATHS = ["profile", "plan", "security"] as const
Expand Down
28 changes: 23 additions & 5 deletions packages/files-ui/src/Components/Layouts/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useThresholdKey } from "../../Contexts/ThresholdKeyContext"
import { CSFTheme } from "../../Themes/types"
import { useUser } from "../../Contexts/UserContext"
import { useFilesApi } from "../../Contexts/FilesApiContext"
import { usePosthog } from "../../Contexts/PosthogContext"
import TeamModal from "../Elements/TeamModal"

const useStyles = makeStyles(
({ palette, animation, breakpoints, constants, zIndex }: CSFTheme) => {
Expand Down Expand Up @@ -149,7 +149,11 @@ const useStyles = makeStyles(
margin: `0 ${constants.generalUnit * 2}px`,

"& button" : {
height: constants.generalUnit * 4
height: constants.generalUnit * 4,

"&:not(:first-child)": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this

marginLeft: constants.generalUnit * 2
}
}
}
})
Expand All @@ -168,8 +172,8 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => {
const { publicKey, isNewDevice, shouldInitializeAccount, logout } = useThresholdKey()
const { getProfileTitle, removeUser } = useUser()
const [searchActive, setSearchActive] = useState(false)
const [isTeamModalOpen, setIsTeamModalOpen] = useState(false)
const { history } = useHistory()
const posthog = usePosthog()

const signOut = useCallback(async () => {
logout()
Expand All @@ -182,9 +186,12 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => {
}, [logout, removeUser, history])

const onReportBugClick = useCallback(() => {
posthog && posthog.capture("Report Bug")
window.open(ROUTE_LINKS.DiscordInvite, "_blank")
}, [posthog])
}, [])

const onStartATeamClick = useCallback(() => {
setIsTeamModalOpen(true)
}, [])

return (
<header
Expand Down Expand Up @@ -214,13 +221,23 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => {
</section>
<section className={classes.buttonsSection}>
<Button
data-posthog="Report-a-bug"
data-cy="send-feedback-nav"
variant="tertiary"
size="small"
onClick={onReportBugClick}
>
<Trans>Report a bug</Trans>
</Button>
<Button
data-posthog="Start-a-team"
data-cy="start-team-nav"
variant="tertiary"
size="small"
onClick={onStartATeamClick}
>
<Trans>Start a team</Trans>
</Button>
</section>
<section className={classes.accountControls}>
<MenuDropdown
Expand Down Expand Up @@ -285,6 +302,7 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => {
)}
</>
)}
{isTeamModalOpen && <TeamModal onHide={() => setIsTeamModalOpen(false)}/>}
</header>
)
}
Expand Down
12 changes: 1 addition & 11 deletions packages/files-ui/src/Contexts/PosthogContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,4 @@ function usePageTrack() {
}, [pathname, hasOptedIn, posthogInitialized])
}

function usePosthog() {
const { hasOptedIn, posthogInitialized } = usePosthogContext()

if (posthogInitialized && hasOptedIn){
return posthog
}

return undefined
}

export { PosthogProvider, usePosthogContext, usePageTrack, usePosthog }
export { PosthogProvider, usePosthogContext, usePageTrack }