-
Notifications
You must be signed in to change notification settings - Fork 244
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
fix: gift subscription feedback #4160
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4370ce9
fix: gift modal UI
sshanzel 1eb138a
fix: app crash
sshanzel 1da1ee9
fix: spacing
sshanzel 317f89c
fix: minor
sshanzel fe57b27
fix: error
sshanzel 73709a8
fix: urls
sshanzel 3971a34
fix: keyboard nav without data
sshanzel 5a6d438
Merge branch 'MI-746-gifting-plus' into fix-gift-feedback
sshanzel 09ef44b
Merge branch 'MI-746-gifting-plus' into fix-gift-feedback
sshanzel 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ import { ContentPreferenceType } from '../../graphql/contentPreference'; | |
import { isFollowingContent } from '../../hooks/contentPreference/types'; | ||
import { useIsSpecialUser } from '../../hooks/auth/useIsSpecialUser'; | ||
import { GiftIcon } from '../icons/gift'; | ||
import { usePaymentContext } from '../../contexts/PaymentContext'; | ||
|
||
export interface CommentActionProps { | ||
onComment: (comment: Comment, parentId: string | null) => void; | ||
|
@@ -89,7 +88,7 @@ export default function CommentActionButtons({ | |
const { onMenuClick, isOpen, onHide } = useContextMenu({ id }); | ||
const { openModal } = useLazyModal(); | ||
const { displayToast } = useToastNotification(); | ||
const { isPlusAvailable } = usePaymentContext(); | ||
const { isValidRegion: isPlusAvailable } = useAuthContext(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see we actually already just re-export it lol. |
||
const { logSubscriptionEvent } = usePlusSubscription(); | ||
const [voteState, setVoteState] = useState<VoteEntityPayload>(() => { | ||
return { | ||
|
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
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
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
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.
I wanted to avoid the ugly ternary ladder, which adds indent and confusing conditions.
For example:
Instead, we can just do something similar to our
ConditionalWrapper
by doing:This will keep the ternaries to a single level.
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.
It doesn't really though right, it's just masking it.
Technically still read it as if...else inside if...else
Not against it, but not sure it's that much clearer.
@capJavert // @omBratteng what you guys think?
I'm happy to keep it though to unblock you.
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.
Personally, I just hate excessive indents and multiple ternaries at once, especially when combined together, as it would require you to focus deeply just to understand the simple if-else-if conditions. Also a simple misplacement of the parenthesis, the result would be totally different. Hence hard to follow.
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.
Probably more of a cosmetic than functional change for readability.
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.
Ah agreed I'd love to avoid the nested ternaries in the first place.
But to me this is just a wrapper the result is still having the ternary.
One other solution is to render 2 functions and do the inside ternary inside 1 function?
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.
Yeah, that can work too, by doing early returns. I'll be merging this now but I'll update and raise another PR once we get more answers on what could fit our current setup.