Skip to content
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

Add prettier #109

Merged
merged 5 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ coverage.txt
*.output

slrp
package-lock.json
.vagrant
package-lock.json
.vagrant
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ build-ui:
dev-ui:
npm --prefix ui start

fmt-ui:
npm --prefix ui run prettier

snapshot: build-ui
goreleaser build --snapshot --rm-dist --single-target

Expand All @@ -31,7 +34,7 @@ cpu-profile:
block-profile:
go tool pprof http://localhost:6060/debug/pprof/block

pprof:
pprof:
go tool pprof -http=:8080 slrp http://127.0.0.1:6060/debug/pprof/profile

race:
Expand Down
Empty file added ui/.prettierignore
Empty file.
19 changes: 19 additions & 0 deletions ui/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 300,
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"useTabs": false,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto",
"insertPragma": false,
"requirePragma": false
}
2 changes: 1 addition & 1 deletion ui/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Developing UI

Requires `nodejs`. Starting: `make dev-ui`
Requires `nodejs`. Starting: `make dev-ui`
22 changes: 22 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
"react-router-dom": "^6.2.1"
},
"devDependencies": {
"prettier": "2.8.8",
"react-scripts": "^5.0.0"
},
"scripts": {
"start": "node_modules/react-scripts/bin/react-scripts.js start",
"build": "node_modules/react-scripts/bin/react-scripts.js build",
"test": "node_modules/react-scripts/bin/react-scripts.js test",
"eject": "node_modules/react-scripts/bin/react-scripts.js eject"
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"prettier": "npx prettier --write ."
},
"eslintConfig": {
"extends": [
Expand Down
72 changes: 50 additions & 22 deletions ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tr.probe-running {
margin-bottom: 0;
}

.table>:not(:first-child) {
.table > :not(:first-child) {
border-top: none;
}

Expand All @@ -42,13 +42,13 @@ a {
}

.app-link {
color: #343a40!important;
color: #343a40 !important;
text-decoration: dotted underline;
transition-duration: 1s;
}

.app-link:hover {
color: #17a2b8!important;
color: #17a2b8 !important;
}

.logo img {
Expand Down Expand Up @@ -83,44 +83,72 @@ a {
}

.probes .metric {
font-family: var(--bs-font-monospace)!important;
font-family: var(--bs-font-monospace) !important;
}

@media screen and (max-width: 1000px) {
.col-provider { display: none; }
.col-rate { display: none; }
.col-provider {
display: none;
}
.col-rate {
display: none;
}
}

@media screen and (max-width: 780px) {
.col-offered { display:none; }
.text-muted { display: none; }
.col-offered {
display: none;
}
.text-muted {
display: none;
}
}

@media screen and (max-width: 500px) {
.size { display: none;}
.proxy { display: none;}
.took { display: none; }
.col-Exclusive { display: none; }
.col-Dirty { display: none; }
.col-Contribution { display: none; }
.col-Scheduled { display: none; }
.col-Probing { display: none; }
.col-New { display: none; }
.col-Ignored { display: none; }
.size {
display: none;
}
.proxy {
display: none;
}
.took {
display: none;
}
.col-Exclusive {
display: none;
}
.col-Dirty {
display: none;
}
.col-Contribution {
display: none;
}
.col-Scheduled {
display: none;
}
.col-Probing {
display: none;
}
.col-New {
display: none;
}
.col-Ignored {
display: none;
}
}

.search-facet {
padding: .5em;
padding: 0.5em;
}

.search-facet ul {
display: inline;
padding-left: .5em;
padding-left: 0.5em;
}

.search-facet li {
display: inline;
margin-right: .5em;
margin-right: 0.5em;
}

small {
Expand All @@ -147,4 +175,4 @@ small {
top: 0.5em;
color: #6c757d;
padding-right: 38px;
}
}
96 changes: 61 additions & 35 deletions ui/src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap-icons/font/bootstrap-icons.css";
import './App.css';
import React from 'react';
import {Routes, Route, NavLink, Outlet} from "react-router-dom";
import "./App.css";
import React from "react";
import { Routes, Route, NavLink, Outlet } from "react-router-dom";
import { ErrorBoundary } from "./util";
import Dashboard from "./Sources";
import Proxies from "./Proxies";
Expand All @@ -11,45 +11,71 @@ import Blacklist from "./Blacklist";
import Reverify from "./Reverify";

function Header() {
return <header className="p-1 mb-3 border-bottom">
<div className="container">
<div className="d-flex align-items-center justify-content-lg-start">
<a href="/" className="logo align-items-center mb-lg-0">
<img src="/logo.png" alt="slrp" />
</a>
<ul className="nav col-12 col-lg-auto me-lg-auto mb-2 mb-md-0">
<li><NavLink to="/" className="nav-link px-2 link-secondary">Overview</NavLink></li>
<li><NavLink to="/proxies" className="nav-link px-2 link-dark">Proxies</NavLink></li>
<li><NavLink to="/history" className="nav-link px-2 link-dark">History</NavLink></li>
<li><NavLink to="/reverify" className="nav-link px-2 link-dark">Reverify</NavLink></li>
<li><NavLink to="/blacklist" className="nav-link px-2 link-dark">Blacklist</NavLink></li>
</ul>
return (
<header className="p-1 mb-3 border-bottom">
<div className="container">
<div className="d-flex align-items-center justify-content-lg-start">
<a href="/" className="logo align-items-center mb-lg-0">
<img src="/logo.png" alt="slrp" />
</a>
<ul className="nav col-12 col-lg-auto me-lg-auto mb-2 mb-md-0">
<li>
<NavLink to="/" className="nav-link px-2 link-secondary">
Overview
</NavLink>
</li>
<li>
<NavLink to="/proxies" className="nav-link px-2 link-dark">
Proxies
</NavLink>
</li>
<li>
<NavLink to="/history" className="nav-link px-2 link-dark">
History
</NavLink>
</li>
<li>
<NavLink to="/reverify" className="nav-link px-2 link-dark">
Reverify
</NavLink>
</li>
<li>
<NavLink to="/blacklist" className="nav-link px-2 link-dark">
Blacklist
</NavLink>
</li>
</ul>
</div>
</div>
</div>
</header>
</header>
);
}

function Layout() {
return <div className="App">
<Header />
<main className="container">
<ErrorBoundary>
<Outlet />
</ErrorBoundary>
</main>
</div>
return (
<div className="App">
<Header />
<main className="container">
<ErrorBoundary>
<Outlet />
</ErrorBoundary>
</main>
</div>
);
}

function App() {
return <Routes>
<Route path="/" element={<Layout />}>
<Route index element={<Dashboard />} />
<Route path="proxies" element={<Proxies />} />
<Route path="history" element={<History />} />
<Route path="reverify" element={<Reverify />} />
<Route path="blacklist" element={<Blacklist />} />
</Route>
</Routes>
return (
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<Dashboard />} />
<Route path="proxies" element={<Proxies />} />
<Route path="history" element={<History />} />
<Route path="reverify" element={<Reverify />} />
<Route path="blacklist" element={<Blacklist />} />
</Route>
</Routes>
);
}

export default App;
Loading