-
Notifications
You must be signed in to change notification settings - Fork 0
Slider refactor #193
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
Open
mcgingras
wants to merge
16
commits into
main
Choose a base branch
from
slider-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Slider refactor #193
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4dcbc57
stashing slider work
mcgingras 8934d00
updating query param util so it doesn't rely on next router
mcgingras 0f98183
progress on a shared slider manager
mcgingras ac517d0
moving all sliders to the slider manager
mcgingras 0dc86c8
update useEffect
mcgingras ab2fdd9
fixing up quite a few of the sliders
mcgingras 2f8eec8
allow claim from terminal page
mcgingras 528c39d
removing animate bounce
mcgingras 1e2ed4e
resolving some bugs with sliders
mcgingras 0fd6d16
opening slider from create a proposal modal
mcgingras a9bf9bc
ensuring some of the callback behavior is working for a few different…
mcgingras e0edc05
cleaning up store
mcgingras afe692f
adding some review feedback
mcgingras f31ce43
fixing history issue?
mcgingras e28dc95
double safe guard on slider
mcgingras d55af0a
only allow authed parties to view claim slider
mcgingras 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,65 +1,41 @@ | ||
| import Breakpoint from "@ui/Breakpoint" | ||
| import ClaimListView from "components/claim/ClaimListView" | ||
| import dynamic from "next/dynamic" | ||
| import Link from "next/link" | ||
| import { useRouter } from "next/router" | ||
| import React, { useEffect, useState } from "react" | ||
| import React from "react" | ||
| import { | ||
| addQueryParam, | ||
| removeQueryParam, | ||
| } from "../../lib/utils/updateQueryParam" | ||
| Sliders, | ||
| useSliderManagerStore, | ||
| } from "../../hooks/stores/useSliderManagerStore" | ||
| import { ReadyToClaim } from "./ReadyToClaim" | ||
|
|
||
| const RightSlider = dynamic(() => | ||
| import("../../components/ui/RightSlider").then((mod) => mod.RightSlider), | ||
| ) | ||
|
|
||
| export const ProfileReadyToClaim = () => { | ||
| const router = useRouter() | ||
| const setActiveSlider = useSliderManagerStore( | ||
| (state) => state.setActiveSlider, | ||
| ) | ||
| const accountAddress = router.query.address as string | ||
|
|
||
| const [claimSliderOpen, setClaimSliderOpen] = useState<boolean>(false) | ||
| const closeClaimSlider = (isOpen: boolean) => { | ||
| if (!isOpen) { | ||
| removeQueryParam(router, "claimSliderOpen") | ||
| } | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| if (router.query.claimSliderOpen) { | ||
| setClaimSliderOpen(true) | ||
| } else { | ||
| setClaimSliderOpen(false) | ||
| } | ||
| }, [router.query]) | ||
|
|
||
| return ( | ||
| <> | ||
| <RightSlider open={claimSliderOpen} setOpen={closeClaimSlider}> | ||
| <ClaimListView recipientAddress={accountAddress} /> | ||
| </RightSlider> | ||
| <Breakpoint> | ||
| {(isMobile) => { | ||
| if (isMobile) { | ||
| return ( | ||
| <Link href={`/u/${accountAddress}/profile/claim`}> | ||
| <ReadyToClaim address={accountAddress} /> | ||
| </Link> | ||
| ) | ||
| } | ||
| <Breakpoint> | ||
| {(isMobile) => { | ||
| if (isMobile) { | ||
| return ( | ||
| <span | ||
| className="cursor-pointer" | ||
| onClick={() => { | ||
| setClaimSliderOpen(true) | ||
| addQueryParam(router, "claimSliderOpen", "true") | ||
| }} | ||
| > | ||
| <Link href={`/u/${accountAddress}/profile/claim`}> | ||
| <ReadyToClaim address={accountAddress} /> | ||
| </span> | ||
| </Link> | ||
| ) | ||
| }} | ||
| </Breakpoint> | ||
| </> | ||
| } | ||
| return ( | ||
| <span | ||
| className="cursor-pointer" | ||
| onClick={() => { | ||
| setActiveSlider(Sliders.CLAIM_TOKENS, { value: true }) | ||
| }} | ||
| > | ||
| <ReadyToClaim address={accountAddress} /> | ||
| </span> | ||
| ) | ||
| }} | ||
| </Breakpoint> | ||
| ) | ||
| } |
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.
maybe the recipient address should always be the logged-in user?
Uh oh!
There was an error while loading. Please reload this page.
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.
ya, if its a profile page we could use the logged in user, and if its a terminal page then it should belong to the terminal but we should definitely make sure the person claiming is authed.
I agree it feels like an exploit, but "claiming" doesn't mean you are sending the tokens to yourself. If I were able to see the claim CTAs on your profile, all I would be able to do is pay the gas to execute the transaction that sends the tokens to your address lol. It's a reverse exploit, exploiting the exploiter to pay the gas for you! 😆
but I agree, just to make the app not feel janky we should make sure to protect these pages.