- 
                Notifications
    
You must be signed in to change notification settings  - Fork 50
 
feat: jurors page #1840
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
          
     Merged
      
      
    
  
     Merged
                    feat: jurors page #1840
Changes from 2 commits
      Commits
    
    
            Show all changes
          
          
            21 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      ed63810
              
                feat: initial jurors page setup, jurors explore navlink, small stylin…
              
              
                kemuru 1b22294
              
                feat: filter by totalresolvedvotes bigger than 0, types fix
              
              
                kemuru 63c308b
              
                fix: subgraph bug which has not counting missed votes
              
              
                kemuru ac069a3
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                kemuru 118feb6
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                kemuru af51757
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                kemuru db29a3d
              
                feat: myprofile links, subgraph changes, pagination, query optimizati…
              
              
                kemuru c95ee8a
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                kemuru f2867a2
              
                feat: add subgraph field, ranking icon, fix extra stats bug, filters,…
              
              
                kemuru c749b2d
              
                fix: nitpick text change
              
              
                kemuru 132743a
              
                chore: add arrow back into the accordiontitle
              
              
                kemuru 07f83fa
              
                chore: layout improvement
              
              
                kemuru 94c7637
              
                fix: search to lower case in query
              
              
                kemuru 22e54d7
              
                chore: move coherence percent function to utils, change name for clarity
              
              
                kemuru 81a3412
              
                fix: layout shift if there is no rank, hide pagination if searching
              
              
                kemuru b5d969b
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                kemuru 535508a
              
                fix: few code smells
              
              
                kemuru d04f0e1
              
                chore: change label in mobile if search is active
              
              
                kemuru 876e208
              
                Merge branch 'dev' into feat(web)/jurors-page
              
              
                alcercu e6875eb
              
                chore: subgraphs redeploy, scripts tweaks
              
              
                jaybuidl 2bb0a19
              
                chore: txt
              
              
                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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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,76 @@ | ||
| import React, { useRef, useState } from "react"; | ||
| import styled, { css } from "styled-components"; | ||
| 
     | 
||
| import { useNavigate, useParams, useSearchParams } from "react-router-dom"; | ||
| import { useDebounce } from "react-use"; | ||
| import { Searchbar } from "@kleros/ui-components-library"; | ||
| 
     | 
||
| import { isEmpty } from "utils/index"; | ||
| import { decodeURIFilter, encodeURIFilter, useRootPath } from "utils/uri"; | ||
| 
     | 
||
| import { landscapeStyle } from "styles/landscapeStyle"; | ||
| import { responsiveSize } from "styles/responsiveSize"; | ||
| 
     | 
||
| const Container = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: ${responsiveSize(8, 16)}; | ||
| 
     | 
||
| ${landscapeStyle( | ||
| () => css` | ||
| flex-direction: row; | ||
| ` | ||
| )} | ||
| `; | ||
| 
     | 
||
| const StyledSearchbar = styled(Searchbar)` | ||
| flex: 1; | ||
| flex-basis: 310px; | ||
| 
     | 
||
| input { | ||
| font-size: 16px; | ||
| height: 45px; | ||
| padding-top: 0px; | ||
| padding-bottom: 0px; | ||
| } | ||
| `; | ||
| 
     | 
||
| const Search: React.FC = () => { | ||
| const { page, order, filter } = useParams(); | ||
| const location = useRootPath(); | ||
| const decodedFilter = decodeURIFilter(filter ?? "all"); | ||
| const { id: searchValue, ...filterObject } = decodedFilter; | ||
| const [search, setSearch] = useState(searchValue ?? ""); | ||
| const initialRenderRef = useRef(true); | ||
| const navigate = useNavigate(); | ||
| const [searchParams] = useSearchParams(); | ||
| 
     | 
||
| useDebounce( | ||
| () => { | ||
| if (initialRenderRef.current && isEmpty(search)) { | ||
| initialRenderRef.current = false; | ||
| return; | ||
| } | ||
| initialRenderRef.current = false; | ||
| const newFilters = isEmpty(search) ? { ...filterObject } : { ...filterObject, id: search }; | ||
| const encodedFilter = encodeURIFilter(newFilters); | ||
| navigate(`${location}/${page}/${order}/${encodedFilter}?${searchParams.toString()}`); | ||
| }, | ||
| 500, | ||
| [search] | ||
| ); | ||
                
      
                  kemuru marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| return ( | ||
| <Container> | ||
| <StyledSearchbar | ||
| dir="auto" | ||
| type="text" | ||
| placeholder="Search" | ||
| value={search} | ||
| onChange={(e) => setSearch(e.target.value)} | ||
| /> | ||
| </Container> | ||
| ); | ||
| }; | ||
| 
     | 
||
| export default Search; | ||
  
    
      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,28 @@ | ||
| import React from "react"; | ||
| import styled from "styled-components"; | ||
| 
     | 
||
| const FieldWrapper = styled.div` | ||
| display: inline-flex; | ||
| gap: 8px; | ||
| `; | ||
| 
     | 
||
| const StyledLabel = styled.label` | ||
| color: ${({ theme }) => theme.primaryText}; | ||
| `; | ||
| 
     | 
||
| const Field: React.FC<{ label: string; value: string }> = ({ label, value }) => ( | ||
| <FieldWrapper> | ||
| <StyledLabel>{label}</StyledLabel> | ||
| <small>{value}</small> | ||
| </FieldWrapper> | ||
| ); | ||
| 
     | 
||
| export interface IStats { | ||
| totalJurors: number; | ||
| } | ||
| 
     | 
||
| const Stats: React.FC<IStats> = ({ totalJurors }) => { | ||
| return <Field label="Total" value={`${totalJurors} Jurors`} />; | ||
| }; | ||
| 
     | 
||
| export default Stats; | 
  
    
      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,22 @@ | ||
| import React from "react"; | ||
| import styled from "styled-components"; | ||
| 
     | 
||
| import { responsiveSize } from "styles/responsiveSize"; | ||
| import Stats, { IStats } from "./Stats"; | ||
| 
     | 
||
| const Container = styled.div` | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 8px; | ||
| margin-top: ${responsiveSize(4, 8)}; | ||
| margin-bottom: ${responsiveSize(16, 32)}; | ||
| justify-content: space-between; | ||
| `; | ||
| 
     | 
||
| const StatsAndFilters: React.FC<IStats> = ({ totalJurors }) => ( | ||
| <Container> | ||
| <Stats {...{ totalJurors }} /> | ||
| </Container> | ||
| ); | ||
| 
     | 
||
| export default StatsAndFilters; | 
      
      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.