-
Notifications
You must be signed in to change notification settings - Fork 2k
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
A4A > Agency Tier: Implement tier permission check #95547
Merged
+246
−2
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
client/a8c-for-agencies/sections/agency-tier/lib/get-tier-permission-data.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,37 @@ | ||
import { A4A_AGENCY_TIER_LINK } from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants'; | ||
|
||
const getTierPermissionData = ( | ||
section: string, | ||
translate: ( key: string, args?: Record< string, unknown > ) => string | ||
) => { | ||
const content: Record< | ||
string, | ||
{ | ||
title: string; | ||
content: { | ||
heading: string; | ||
description: string; | ||
buttonProps: { text: string; href: string }; | ||
}; | ||
} | ||
> = { | ||
'a8c-for-agencies-partner-directory': { | ||
title: translate( 'Partner Directory' ), | ||
content: { | ||
heading: translate( | ||
"Reach the next tier to be showcased in Automattic's partner directories." | ||
), | ||
description: translate( | ||
"Agency Partners and Pro Agency Partners get to be included in Automatic's directories. Pro Agency Partners also get co-marketing opportunities." | ||
), | ||
buttonProps: { | ||
text: translate( 'Learn more' ), | ||
href: A4A_AGENCY_TIER_LINK, | ||
}, | ||
}, | ||
}, | ||
}; | ||
return content?.[ section ]; | ||
}; | ||
|
||
export default getTierPermissionData; |
54 changes: 54 additions & 0 deletions
54
client/a8c-for-agencies/sections/agency-tier/tier-permission-error/index.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,54 @@ | ||
import { Button } from '@wordpress/components'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import Layout from 'calypso/a8c-for-agencies/components/layout'; | ||
import LayoutBody from 'calypso/a8c-for-agencies/components/layout/body'; | ||
import LayoutHeader, { | ||
LayoutHeaderTitle as Title, | ||
LayoutHeaderActions as Actions, | ||
} from 'calypso/a8c-for-agencies/components/layout/header'; | ||
import LayoutTop from 'calypso/a8c-for-agencies/components/layout/top'; | ||
import MobileSidebarNavigation from 'calypso/a8c-for-agencies/components/sidebar/mobile-sidebar-navigation'; | ||
import AgencyTierLevels from 'calypso/assets/images/a8c-for-agencies/agency-tier/agency-tier-levels.svg'; | ||
import getTierPermissionData from '../lib/get-tier-permission-data'; | ||
|
||
import './style.scss'; | ||
|
||
export default function TierPermissionError( { section }: { section: string } ) { | ||
const translate = useTranslate(); | ||
|
||
const { title, content } = getTierPermissionData( section, translate ); | ||
|
||
return ( | ||
<Layout className="agency-tier-permission-error__layout" title={ title } wide> | ||
<LayoutTop> | ||
<LayoutHeader> | ||
<Title>{ title } </Title> | ||
<Actions> | ||
<MobileSidebarNavigation /> | ||
</Actions> | ||
</LayoutHeader> | ||
</LayoutTop> | ||
|
||
<LayoutBody> | ||
<div className="agency-tier-permission-error__content"> | ||
<div className="agency-tier-permission-error__content-image"> | ||
<img | ||
className="agency-tier-permission-error__content-image" | ||
alt="agency-tier-levels" | ||
src={ AgencyTierLevels } | ||
/> | ||
</div> | ||
<div className="agency-tier-permission-error__content-text"> | ||
<div className="agency-tier-permission-error__content-heading">{ content.heading }</div> | ||
<div className="agency-tier-permission-error__content-description"> | ||
{ content.description } | ||
</div> | ||
<Button href={ content.buttonProps.href } variant="primary"> | ||
{ content.buttonProps.text } | ||
</Button> | ||
</div> | ||
</div> | ||
</LayoutBody> | ||
</Layout> | ||
); | ||
} |
82 changes: 82 additions & 0 deletions
82
client/a8c-for-agencies/sections/agency-tier/tier-permission-error/style.scss
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,82 @@ | ||
@import "@wordpress/base-styles/breakpoints"; | ||
@import "@wordpress/base-styles/mixins"; | ||
|
||
.agency-tier-permission-error__layout { | ||
.a4a-layout__container { | ||
height: 100%; | ||
} | ||
.a4a-layout__body { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
height: 100%; | ||
} | ||
} | ||
|
||
.agency-tier-permission-error__content { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 700px; | ||
background-color: var(--color-neutral-0); | ||
border-radius: 12px; /* stylelint-disable-line scales/radii */ | ||
|
||
@include break-large { | ||
flex-direction: row; | ||
height: 350px; | ||
} | ||
|
||
@include break-wide { | ||
height: unset; | ||
} | ||
|
||
|
||
.agency-tier-permission-error__content-image { | ||
display: none; | ||
|
||
@include break-large { | ||
display: block; | ||
min-width: 250px; | ||
height: 350px; | ||
} | ||
|
||
@include break-wide { | ||
min-width: 350px; | ||
height: unset; | ||
} | ||
|
||
img { | ||
border-radius: 12px 0 0 12px; /* stylelint-disable-line scales/radii */ | ||
} | ||
} | ||
|
||
.agency-tier-permission-error__content-text { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
padding: 72px 32px 48px; | ||
margin: 8px; | ||
background-color: var(--color-text-white); | ||
border-radius: 8px; /* stylelint-disable-line scales/radii */ | ||
|
||
@include break-large { | ||
margin-inline-start: 0; | ||
padding: 32px; | ||
} | ||
|
||
@include break-wide { | ||
padding: 72px 32px 48px; | ||
} | ||
} | ||
|
||
.agency-tier-permission-error__content-heading { | ||
@include a4a-font-heading-xl; | ||
} | ||
|
||
.agency-tier-permission-error__content-description { | ||
@include a4a-font-body-md; | ||
} | ||
|
||
a.components-button { | ||
width: fit-content; | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
client/assets/images/a8c-for-agencies/agency-tier/agency-tier-levels.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are mainly replacing the context's primary content with the error content.