Skip to content

Commit

Permalink
Better wording for Discord role perks (#5966)
Browse files Browse the repository at this point in the history
Do not show in changelog
  • Loading branch information
ClementPasteau authored Nov 27, 2023
1 parent 38651ed commit 9718fb7
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 16 deletions.
2 changes: 1 addition & 1 deletion newIDE/app/src/Profile/EditProfileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const EditProfileDialog = ({
disabled={actionInProgress}
maxLength={discordUsernameConfig.maxLength}
helperMarkdownText={i18n._(
t`Add your Discord username to get access to a dedicated channel if you have a subscription! Join the [GDevelop Discord](https://discord.gg/gdevelop).`
t`Add your Discord username to get access to a dedicated channel if you have a Gold or Pro subscription! Join the [GDevelop Discord](https://discord.gg/gdevelop).`
)}
/>
<TextField
Expand Down
17 changes: 11 additions & 6 deletions newIDE/app/src/Profile/ProfileDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ const ProfileDetails = ({
[assetPacksListingDatas, onAssetPackOpen, receivedAssetPacks]
);

const hasGoldOrProSubscription =
!!subscription &&
!!subscription.planId &&
(subscription.planId === 'gdevelop_gold' ||
subscription.planId === 'gdevelop_startup');

if (error)
return (
<PlaceholderError onRetry={onRetry}>
Expand Down Expand Up @@ -316,8 +322,7 @@ const ProfileDetails = ({
<Trans>Discord username</Trans>
</Text>
{isAuthenticatedUserProfile &&
!!subscription &&
!!subscription.planId &&
hasGoldOrProSubscription &&
!!discordUsername && (
<IconButton
onClick={onSyncDiscordUsername}
Expand All @@ -337,9 +342,9 @@ const ProfileDetails = ({
{!isAuthenticatedUserProfile ? (
discordUsername
) : !discordUsername ? (
!subscription || !subscription.planId ? (
!hasGoldOrProSubscription ? (
<MarkdownText
translatableSource={t`No discord username defined. Add it and get a subscription to claim your role on the [GDevelop Discord](https://discord.gg/gdevelop).`}
translatableSource={t`No discord username defined. Add it and get a Gold or Pro subscription to claim your role on the [GDevelop Discord](https://discord.gg/gdevelop).`}
/>
) : (
<MarkdownText
Expand All @@ -349,11 +354,11 @@ const ProfileDetails = ({
) : (
<>
{discordUsername}
{(!subscription || !subscription.planId) && (
{!hasGoldOrProSubscription && (
<>
{' - '}
<MarkdownText
translatableSource={t`Get a subscription to claim your role on the [GDevelop Discord](https://discord.gg/gdevelop).`}
translatableSource={t`Get a Gold or Pro subscription to claim your role on the [GDevelop Discord](https://discord.gg/gdevelop).`}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export default function SubscriptionPendingDialog({
!!authenticatedUser &&
!!authenticatedUser.subscription &&
!!authenticatedUser.subscription.planId;
const hasGoldOrStartupPlan =
!!authenticatedUser &&
!!authenticatedUser.subscription &&
(authenticatedUser.subscription.planId === 'gdevelop_gold' ||
authenticatedUser.subscription.planId === 'gdevelop_startup');
useInterval(
() => {
authenticatedUser.onRefreshUserProfile().catch(() => {
Expand Down Expand Up @@ -176,7 +181,7 @@ export default function SubscriptionPendingDialog({
</Trans>
</BackgroundText>
</Line>
{!currentDiscordUsername && (
{!currentDiscordUsername && !!hasGoldOrStartupPlan && (
<Line>
<TextField
value={discordUsername}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import paperDecorator from '../../../PaperDecorator';
import {
indieUserProfile,
fakeSilverAuthenticatedUser,
fakeStartupAuthenticatedUser,
fakeAuthenticatedUserWithNoSubscription,
} from '../../../../fixtures/GDevelopServicesTestData';
import SubscriptionPendingDialog from '../../../../Profile/Subscription/SubscriptionPendingDialog';
Expand Down Expand Up @@ -36,7 +37,7 @@ const fakeProfileWithoutDiscordUsername = {
discordUsername: '',
};

export const AuthenticatedUserWithSubscriptionButWithoutDiscordUsername = () => (
export const AuthenticatedUserWithSilverSubscriptionButWithoutDiscordUsername = () => (
<SubscriptionPendingDialog
authenticatedUser={{
...fakeSilverAuthenticatedUser,
Expand All @@ -45,3 +46,13 @@ export const AuthenticatedUserWithSubscriptionButWithoutDiscordUsername = () =>
onClose={action('on close')}
/>
);

export const AuthenticatedUserWithStartupSubscriptionButWithoutDiscordUsername = () => (
<SubscriptionPendingDialog
authenticatedUser={{
...fakeStartupAuthenticatedUser,
profile: fakeProfileWithoutDiscordUsername,
}}
onClose={action('on close')}
/>
);
23 changes: 16 additions & 7 deletions newIDE/app/src/stories/componentStories/ProfileDetails.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import paperDecorator from '../PaperDecorator';
import ProfileDetails from '../../Profile/ProfileDetails';
import {
indieUserProfile,
subscriptionForBusinessUser,
subscriptionForStartupUser,
subscriptionForSilverUser,
} from '../../fixtures/GDevelopServicesTestData';
import { type Profile } from '../../Utils/GDevelopServices/Authentication';
import { type PrivateAssetPackListingData } from '../../Utils/GDevelopServices/Shop';
Expand Down Expand Up @@ -54,16 +55,24 @@ const getAssetPacksListingData = (
},
];

export const MyCompleteProfileWithSubscription = () => (
export const MyCompleteProfileWithoutSubscription = () => (
<ProfileDetails profile={indieUserProfile} isAuthenticatedUserProfile />
);

export const MyCompleteProfileWithSilverSubscription = () => (
<ProfileDetails
profile={indieUserProfile}
isAuthenticatedUserProfile
subscription={subscriptionForBusinessUser}
subscription={subscriptionForSilverUser}
/>
);

export const MyCompleteProfileWithoutSubscription = () => (
<ProfileDetails profile={indieUserProfile} isAuthenticatedUserProfile />
export const MyCompleteProfileWithBusinessSubscription = () => (
<ProfileDetails
profile={indieUserProfile}
isAuthenticatedUserProfile
subscription={subscriptionForStartupUser}
/>
);

export const MyProfileWithoutDiscordUsernameNorSubscription = () => (
Expand All @@ -73,11 +82,11 @@ export const MyProfileWithoutDiscordUsernameNorSubscription = () => (
/>
);

export const MyProfileWithoutDiscordUsernameButWithSubscription = () => (
export const MyProfileWithoutDiscordUsernameWithStartupSubscription = () => (
<ProfileDetails
profile={{ ...indieUserProfile, discordUsername: '' }}
isAuthenticatedUserProfile
subscription={subscriptionForBusinessUser}
subscription={subscriptionForStartupUser}
/>
);

Expand Down

0 comments on commit 9718fb7

Please sign in to comment.