-
Notifications
You must be signed in to change notification settings - Fork 49
feat(devtools): initial setup and ui for devtool website #1641
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
alcercu
merged 10 commits into
feat/devtools
from
feat(devtools)/initial-setup-for-devtool-website
Jul 18, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3e78cc5
chore(devtools): setup nextjs app
nikhilverma360 c3ad571
chore(devtools): setup layout, header, footer
nikhilverma360 7c6ac30
chore(devtools): added necessary svgs
nikhilverma360 1e40626
feat(devtools): ruler ui
nikhilverma360 a6db67f
fix(devtools): fixed typings
nikhilverma360 72f9895
fix(devtools): fix footer to render client side
nikhilverma360 4b962d3
fix(webtools): fixed linting issues, and themes
nikhilverma360 fc1fdcc
chore(devtools): removed unused variables
nikhilverma360 3e314cc
refactor(devtools): global declaration of theme types
nikhilverma360 d1b1841
refactor(devtools): dynamic theme types
nikhilverma360 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { DefaultTheme } from "styled-components"; | ||
import { theme } from "styles/Theme"; | ||
declare module "styled-components" { | ||
type Theme = typeof theme; | ||
export interface DefaultTheme extends Theme {} | ||
} |
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,33 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
compiler: { | ||
styledComponents: true, | ||
}, | ||
webpack(config) { | ||
// Grab the existing rule that handles SVG imports | ||
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg")); | ||
|
||
config.module.rules.push( | ||
// Reapply the existing rule, but only for svg imports ending in ?url | ||
{ | ||
...fileLoaderRule, | ||
test: /\.svg$/i, | ||
resourceQuery: /url/, // *.svg?url | ||
}, | ||
// Convert all other *.svg imports to React components | ||
{ | ||
test: /\.svg$/i, | ||
issuer: fileLoaderRule.issuer, | ||
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url | ||
use: ["@svgr/webpack"], | ||
} | ||
); | ||
|
||
// Modify the file loader rule to ignore *.svg, since we have it handled now. | ||
fileLoaderRule.exclude = /\.svg$/i; | ||
|
||
return config; | ||
}, | ||
}; | ||
|
||
export default nextConfig; |
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 |
---|---|---|
|
@@ -8,18 +8,30 @@ | |
"license": "MIT", | ||
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186", | ||
"volta": { | ||
"node": "20.11.0" | ||
"node": "20.11.0", | ||
"yarn": "4.3.1" | ||
}, | ||
"scripts": { | ||
"hi": "echo hello world" | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"prettier": "@kleros/kleros-v2-prettier-config", | ||
"devDependencies": { | ||
"@svgr/webpack": "^8.1.0", | ||
"@types/node": "^20", | ||
"@types/react": "18.2.0", | ||
"@types/react-dom": "^18.2.18", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"@kleros/kleros-sdk": "workspace:^", | ||
"@kleros/ui-components-library": "^2.10.0", | ||
"next": "14.2.4", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"styled-components": "^5.3.11", | ||
"viem": "^1.21.4", | ||
"wagmi": "^1.4.13" | ||
} | ||
|
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,51 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { Field } from "@kleros/ui-components-library"; | ||
|
||
import LightButton from "components/LightButton"; | ||
|
||
const Container = styled.div` | ||
border: ${({ theme }) => theme.klerosUIComponentsPrimaryBlue} 1px solid; | ||
border-radius: 4px; | ||
padding: 16px; | ||
`; | ||
|
||
const RulingSettings = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
margin: 16px 0; | ||
`; | ||
const FieldContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
width: fit-content; | ||
height: fit-content; | ||
padding-left: 8px; | ||
gap: 8px; | ||
font-size: 14px; | ||
border-radius: 4px; | ||
border: ${({ theme }) => theme.klerosUIComponentsStroke} 1px solid; | ||
color: ${({ theme }) => theme.klerosUIComponentsPrimaryText}; | ||
`; | ||
|
||
const ChangeRuler: React.FC = () => { | ||
return ( | ||
<div> | ||
<h3>Change Ruler</h3> | ||
<Container> | ||
<label>Current Ruler</label> | ||
<Field value={"0xb78......09e441"}></Field> | ||
<RulingSettings> | ||
<LightButton text={"Change Ruler"} /> | ||
<FieldContainer> | ||
address <Field placeholder={"0x00[dev address]"}></Field> | ||
</FieldContainer> | ||
</RulingSettings> | ||
</Container> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChangeRuler; |
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 React, { useState } from "react"; | ||
nikhilverma360 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import styled from "styled-components"; | ||
|
||
import { Checkbox, Field } from "@kleros/ui-components-library"; | ||
|
||
import LightButton from "components/LightButton"; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 8px; | ||
margin: 16px 0; | ||
border: ${({ theme }) => theme.klerosUIComponentsPrimaryBlue} 1px solid; | ||
border-radius: 4px; | ||
padding: 16px; | ||
`; | ||
const RulingSettings = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
margin: 16px 0; | ||
`; | ||
const FieldContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
width: fit-content; | ||
height: fit-content; | ||
padding-left: 8px; | ||
gap: 8px; | ||
font-size: 14px; | ||
border-radius: 4px; | ||
border: ${({ theme }) => theme.klerosUIComponentsStroke} 1px solid; | ||
color: ${({ theme }) => theme.klerosUIComponentsPrimaryText}; | ||
`; | ||
|
||
const RulingModes: React.FC = () => { | ||
const [tie, setTie] = useState<boolean>(false); | ||
const [overriden, setOverriden] = useState<boolean>(false); | ||
|
||
return ( | ||
<div> | ||
<h3>Ruling Mode</h3> | ||
<Container> | ||
<RulingSettings> | ||
<LightButton text={"Rule Now Manually"} /> | ||
<FieldContainer> | ||
ruling <Field placeholder={"1"}></Field> | ||
</FieldContainer> | ||
</RulingSettings> | ||
|
||
<RulingSettings> | ||
<LightButton text={"Run Automatically with a Preset"} /> | ||
<FieldContainer> | ||
ruling <Field placeholder={"1"}></Field> | ||
</FieldContainer> | ||
<FieldContainer> | ||
<Checkbox label="" small checked={tie} onChange={() => setTie((old) => !old)} /> | ||
<Field placeholder={"tie"}></Field> | ||
</FieldContainer> | ||
<FieldContainer> | ||
<Checkbox label="" small checked={overriden} onChange={() => setOverriden((old) => !old)} /> | ||
<Field placeholder={"overriden"}></Field> | ||
</FieldContainer> | ||
</RulingSettings> | ||
|
||
<RulingSettings> | ||
<LightButton text={"Run Automatically Randomly"} /> | ||
</RulingSettings> | ||
</Container> | ||
</div> | ||
); | ||
nikhilverma360 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
export default RulingModes; |
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 @@ | ||
"use client"; | ||
nikhilverma360 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { DropdownCascader, Field } from "@kleros/ui-components-library"; | ||
|
||
import { SelectArbitrable } from "utils/dummyData"; | ||
|
||
import ChangeRuler from "./ChangeRuler"; | ||
import RulingModes from "./RulingModes"; | ||
|
||
const Container = styled.div` | ||
min-height: calc(100vh - 160px); | ||
display: flex; | ||
flex-direction: column; | ||
margin: 16px 32px; | ||
align-items: center; | ||
`; | ||
const Arbitrables = styled.div` | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 8px; | ||
margin: 16px 0; | ||
`; | ||
|
||
const SettingsPane = styled.div` | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 16px; | ||
margin: 16px 0; | ||
`; | ||
|
||
const Home: React.FC = () => { | ||
return ( | ||
<Container> | ||
<h1>Ruler</h1> | ||
|
||
<Arbitrables> | ||
<div> | ||
<label>Select Arbitrable</label> | ||
<DropdownCascader | ||
placeholder={"Select Arbitrable"} | ||
onSelect={() => { | ||
//todo; | ||
}} | ||
items={SelectArbitrable} | ||
/> | ||
</div> | ||
<div> | ||
<label>Current Ruling Mode</label> | ||
<Field value={"auto random"}></Field> | ||
</div> | ||
</Arbitrables> | ||
|
||
<SettingsPane> | ||
<RulingModes /> | ||
<ChangeRuler /> | ||
</SettingsPane> | ||
</Container> | ||
); | ||
}; | ||
export default Home; | ||
nikhilverma360 marked this conversation as resolved.
Show resolved
Hide resolved
|
Binary file not shown.
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,34 @@ | ||
import React from "react"; | ||
|
||
import type { Metadata } from "next"; | ||
import { Open_Sans } from "next/font/google"; | ||
|
||
import StyledComponentsProvider from "context/StyledComponentsProvider"; | ||
import StyledComponentsRegistry from "context/StyledComponentsRegistry"; | ||
|
||
import Footer from "layout/Footer"; | ||
import Header from "layout/Header"; | ||
|
||
const font = Open_Sans({ subsets: ["latin"] }); | ||
|
||
export const metadata: Metadata = { | ||
title: "Dev Tools", | ||
}; | ||
|
||
const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => { | ||
return ( | ||
<html lang="en"> | ||
<body className={font.className}> | ||
<StyledComponentsRegistry> | ||
<StyledComponentsProvider> | ||
<Header /> | ||
{children} | ||
<Footer /> | ||
</StyledComponentsProvider> | ||
</StyledComponentsRegistry> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
export default RootLayout; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.