-
Notifications
You must be signed in to change notification settings - Fork 50
feat: new profile page #1871
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
Draft
kemuru
wants to merge
14
commits into
dev
Choose a base branch
from
feat(web)/profile-page-new-design
base: dev
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.
Draft
feat: new profile page #1871
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
45bc1fb
feat: setup new profile page structure, new juror card style, add tab…
kemuru c3213ca
feat: url path tab logic, refactors, add voted ballot svg, add icons …
kemuru f701d8f
feat: add support for sharing your own profile, variable renaming
kemuru 6197733
feat: add total stake info in stakes tab
kemuru c0c8158
Merge branch 'dev' into feat(web)/profile-page-new-design
kemuru 59b50e9
fix: commify fails when string contains < or >, responsiveness issues…
kemuru 6908af8
feat: test in staging atlas, votes tab setup, pagination setup, styli…
kemuru 4172322
feat: build vote cards and stylings
kemuru 91b35fb
Merge branch 'dev' into feat(web)/profile-page-new-design
kemuru d374caf
Merge branch 'dev' into feat(web)/profile-page-new-design
kemuru 89fa758
fix: smalldisplay fix on the jurorlinks
kemuru 3342328
feat: merge conflicts
kemuru 574f8c9
feat: add new section latest stakes in this court, substitute the pro…
kemuru e6b8207
chore: change naming to staking history
kemuru 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { useQuery } from "@tanstack/react-query"; | ||
|
|
||
| // dynamic atlasUri would go here | ||
| const atlasUri = "https://url.example/graphql"; | ||
|
|
||
| const AUTH_TOKEN = "Bearer tokenExampleGoesHere"; | ||
|
|
||
| export const useStakingHistory = (take: number, lastCursorId?: number) => { | ||
| const variables = { | ||
| pagination: { take, lastCursorId: lastCursorId ?? null }, | ||
| }; | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["stakingHistoryQuery", take, lastCursorId], | ||
| enabled: true, | ||
| staleTime: 60000, | ||
| queryFn: async () => { | ||
| console.log("Fetching with variables:", variables); | ||
|
|
||
| try { | ||
| const response = await fetch(atlasUri, { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: AUTH_TOKEN, | ||
| }, | ||
| body: JSON.stringify({ | ||
| query: ` | ||
| query GetStakingEvents($pagination: PaginationArgs) { | ||
| userStakingEvents(pagination: $pagination) { | ||
| edges { | ||
| node { | ||
| name | ||
| args | ||
| blockTimestamp | ||
| transactionHash | ||
| } | ||
| cursor | ||
| } | ||
| count | ||
| hasNextPage | ||
| } | ||
| } | ||
| `, | ||
| variables, | ||
| }), | ||
| }); | ||
|
|
||
| const result = await response.json(); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`GraphQL error: ${JSON.stringify(result)}`); | ||
| } | ||
|
|
||
| return result; | ||
| } catch (error) { | ||
| console.error("GraphQL Fetch Error:", error); | ||
| throw error; | ||
| } | ||
| }, | ||
| }); | ||
| }; | ||
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 |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { request } from "graphql-request"; | ||
|
|
||
| import { isUndefined } from "src/utils"; | ||
|
|
||
| export type StakingEventItem = { | ||
| id: string; | ||
| blockHash: string; | ||
| transactionHash: string; | ||
| blockTimestamp: string; | ||
| network: { | ||
| chainId: number; | ||
| }; | ||
| args: { | ||
| _address: string; | ||
| _courtID: string; | ||
| _amount: string; | ||
| }; | ||
| }; | ||
|
|
||
| type StakingEventsResponse = { | ||
| userStakingEvents: { | ||
| items: Array<{ item: StakingEventItem }>; | ||
| count: number; | ||
| }; | ||
| }; | ||
|
|
||
| const atlasUri = import.meta.env.REACT_APP_ATLAS_URI; | ||
|
|
||
| export const useStakingEventsByCourt = (courtIds: number[], skip: number, take: number, partialAddress?: string) => { | ||
| const addressParam = partialAddress ?? ""; | ||
| // Allow empty courtIds array for "all courts" query | ||
| const isEnabled = !isUndefined(atlasUri); | ||
|
|
||
| const query = ` | ||
| query GetStakingEvents($partialAddress: String!, $courtIDs: [Int!], $pagination: PaginationArgs) { | ||
| userStakingEvents(partialAddress: $partialAddress, courtIDs: $courtIDs, pagination: $pagination) { | ||
| items { | ||
| item { | ||
| id | ||
| blockHash | ||
| transactionHash | ||
| blockTimestamp | ||
| network { | ||
| chainId | ||
| } | ||
| args { | ||
| _address | ||
| _courtID | ||
| _amount | ||
| } | ||
| } | ||
| } | ||
| count | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| const variables = { | ||
| partialAddress: addressParam, | ||
| // If courtIds is empty, pass null to query all courts | ||
| courtIDs: courtIds.length > 0 ? courtIds : null, | ||
| pagination: { skip, take }, | ||
| }; | ||
|
|
||
| return useQuery<StakingEventsResponse>({ | ||
| queryKey: ["stakingEventsByCourt", courtIds, skip, take, partialAddress], | ||
| enabled: isEnabled, | ||
| staleTime: 60000, | ||
| queryFn: async () => { | ||
| return await request<StakingEventsResponse>(`${atlasUri}/graphql`, query, variables); | ||
| }, | ||
| }); | ||
| }; |
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
7 changes: 3 additions & 4 deletions
7
web/src/pages/Courts/CourtDetails/JurorsStakedByCourt/index.tsx
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
9 changes: 9 additions & 0 deletions
9
web/src/pages/Courts/CourtDetails/StakingHistoryByCourt/DisplayStakes/Header.tsx
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import React from "react"; | ||
|
|
||
| import { DesktopHeader } from "./Header/DesktopHeader"; | ||
|
|
||
| const Header: React.FC = () => { | ||
| return <DesktopHeader />; | ||
| }; | ||
|
|
||
| export default Header; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.