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

Geist UI redesign #11

Merged
merged 49 commits into from
May 29, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
56b5105
Uses Geist UI as design system
lukbukkit May 5, 2021
869dc70
Extracts the GitHub URL function
lukbukkit May 5, 2021
28b9cf0
Extracts components from the 'App.tsx' file
lukbukkit May 5, 2021
db594f6
A single context for the fetched data and a potential error
lukbukkit May 6, 2021
f8cae31
Adds a set of icon buttons above the table
lukbukkit May 6, 2021
ffa9413
Ignores files for Vercel deployment
lukbukkit May 6, 2021
d05d310
Text for the help modal
lukbukkit May 7, 2021
5029a21
Adds a favicon
lukbukkit May 7, 2021
a81e2da
Adds a unique key to each Popover.Item
lukbukkit May 8, 2021
96c8365
Adds a modal for filtering by certain properties
lukbukkit May 8, 2021
f0c1919
Documentation on how to test the React front end
lukbukkit May 9, 2021
f035e67
Upgrades React dependencies
lukbukkit May 9, 2021
bcaf7c0
Removes unused React imports
lukbukkit May 9, 2021
570d2eb
Require all semicolons to be removed
lukbukkit May 9, 2021
1b7e265
Fixes a flaw in the pagination logic for the filter
lukbukkit May 9, 2021
c4f2328
Separate scripts for linting and formatting
lukbukkit May 9, 2021
06df586
Sticks the operating system to the top of the table
lukbukkit May 9, 2021
d6e795a
Replaces more '* as React' imports
lukbukkit May 9, 2021
f2fba7f
Open the footer link in a new tab
lukbukkit May 10, 2021
26f2dfd
Close modals by pressing the 'Escape' key
lukbukkit May 10, 2021
d17f2ad
Preload hints for 'data.json'
lukbukkit May 10, 2021
8a8639b
Upgrade test and type dependencies
lukbukkit May 12, 2021
297e737
Fix typos
lukbukkit May 13, 2021
d9aa808
Link to the 'main' branch of the tldr-pages/tldr repository
lukbukkit May 13, 2021
af15053
Rename 'GitHubPage.tsx' to 'tldrPageUrl.tsx'
lukbukkit May 13, 2021
42bc4fa
Show the commit used to build the frontend
lukbukkit May 13, 2021
e855881
Show action buttons while scrolling the content
lukbukkit May 13, 2021
c7d00ab
Assign ids to table rows which aren't sticky
lukbukkit May 13, 2021
847d4e4
Set enter delays for tooltips and popovers to zero
lukbukkit May 13, 2021
4bb0fc7
Formats the code using prettier
lukbukkit May 13, 2021
617f38e
Dockerfile: Install git for build
lukbukkit May 13, 2021
8e14b92
Dockerfile: Cache go and yarn packages
lukbukkit May 13, 2021
1c75966
Correct name for a favicon in index.html
lukbukkit May 13, 2021
6b70fa5
Run 'yarn data' to download the 'data.json' file
lukbukkit May 15, 2021
da5df90
Setup CI for linting JS code
lukbukkit May 15, 2021
b659769
Run the CI lint process in the 'resources' subdirectory
lukbukkit May 15, 2021
d016a5f
Suggestions by @bl-ue & yarn.lock update
lukbukkit May 16, 2021
e0b8fa5
The keyboard shortcut for searching is now device dependent
lukbukkit May 16, 2021
7bf4481
Remove unnecessary names of build steps + Node 16
lukbukkit May 16, 2021
4241be3
More saturation for the background colors
lukbukkit May 16, 2021
dfaa2fd
Moves 'react-git-info' to the non-dev dependencies
lukbukkit May 21, 2021
f070238
Select columns to highlight
lukbukkit May 22, 2021
94374c1
Order column checkboxes using a grid
lukbukkit May 22, 2021
c791bbb
Order column checkboxes using a grid (linted)
lukbukkit May 22, 2021
0bdd56b
A more common way to execute a command in a subdirectory
lukbukkit May 23, 2021
894f224
Explanation for the bookmark icon
lukbukkit May 26, 2021
f647281
Apply the convention for TypeScript enum names
lukbukkit May 29, 2021
79e7ed2
Use 'highlighted' instead of 'highlights'
lukbukkit May 29, 2021
8260639
Same contrast for highlighted elements which are blue
lukbukkit May 29, 2021
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
3 changes: 3 additions & 0 deletions resources/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ yarn-error.log*

# Custom data.json file for testing
public/data.json

# Vercel
.vercel
10 changes: 0 additions & 10 deletions resources/craco.config.js

This file was deleted.

6 changes: 6 additions & 0 deletions resources/logo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Favicon

* The SVG image uses the font family [Inter](https://rsms.me/inter/)
* You can create a `favicon.ico` using [icoconverter.com](https://www.icoconverter.com/)


lukbukkit marked this conversation as resolved.
Show resolved Hide resolved
113 changes: 113 additions & 0 deletions resources/logo/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 6 additions & 10 deletions resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"private": true,
"homepage": "./",
"dependencies": {
"@craco/craco": "^6.1.1",
"@geist-ui/react": "^2.1.5",
"@geist-ui/react-icons": "^1.0.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
Expand All @@ -13,25 +14,20 @@
"@types/react": "^17.0.3",
lukbukkit marked this conversation as resolved.
Show resolved Hide resolved
"@types/react-dom": "^17.0.2",
"install": "^0.13.0",
"inter-ui": "^3.18.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"typescript": "^4.2.3",
"web-vitals": "^1.0.1"
},
"devDependencies": {
"@tailwindcss/postcss7-compat": "npm:@tailwindcss/postcss7-compat",
"autoprefixer": "^9",
"postcss": "^7",
"tailwindcss": "npm:@tailwindcss/postcss7-compat"
},
"resolutions": {
"is-svg": "^4.2.2"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand Down
Binary file added resources/public/favicon.ico
Binary file not shown.
Binary file added resources/public/favicon192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/public/favicon512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions resources/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="View the translation progress of the tldr project"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
25 changes: 25 additions & 0 deletions resources/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "tldr i18n",
"name": "tldr translation progress",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 16x16",
"type": "image/x-icon"
},
{
"src": "favicon192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "favicon512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
15 changes: 15 additions & 0 deletions resources/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body {
lukbukkit marked this conversation as resolved.
Show resolved Hide resolved
font-family: 'Inter', sans-serif;
}

.cursor-pointer {
cursor: pointer;
}

.small-font {
font-size: 80%;
}

.vertical-algin-icons {
vertical-align: middle;
}
77 changes: 25 additions & 52 deletions resources/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,30 @@
import {DataFetcher, ErrorMessageContext} from "./Data";
import {DataTable, Footer, JumpList} from "./Table";
import * as React from "react";
import {GeistProvider, Page, Text} from "@geist-ui/react";
import {DataFetcher} from "./Data";
import {DataTable} from "./Table";
import {AppLoader} from "./AppLoader";
import {ErrorMessage} from "./ErrorMessage";
import {AppFooter} from "./AppFooter";
import {IconActions} from "./IconActions"
import 'inter-ui/inter.css'
import './App.css'

const App = () =>
<div className="container mx-auto text-center">
<h1 className="font-bold text-4xl m-10">tldr translation progress</h1>
<DataFetcher loading={<Loading/>} error={<ErrorMessage/>}>
<Legend/>
<JumpList/>
<DataTable/>
<Footer/>
</DataFetcher>
</div>;

const Legend = () =>
<div className="mt-2">
<h3 className="text-2xl p-5">Legend</h3>
<table className="border-collapse mx-auto">
<tbody>
<tr>
<td className="border-b border-gray-400 px-4 py-2">✔</td>
<td className="border-b border-gray-400 px-4 py-2">
translated & same number of entries as the english version
</td>
</tr>
<tr>
<td className="border-b border-gray-400 px-4 py-2">⚠</td>
<td className="border-b border-gray-400 px-4 py-2">
not up-to-date (different number of entries than the english version)
</td>
</tr>
<tr>
<td className="px-4 py-2">✖</td>
<td className="px-4 py-2">not translated</td>
</tr>
</tbody>
</table>
</div>;

const Loading = () =>
<div className="text-3xl text-blue-400">
Loading ...
</div>;

const ErrorMessage = () => {
const error = React.useContext(ErrorMessageContext);

return (
<div className="text-2xl text-red-400">
Unable to load the data ): <br/>
<div className="text-lg">{error}</div>
</div>
);
}
<GeistProvider>
<Page size='large' style={{minHeight: '1px'}}>
<Page.Header>
<Text h1>tldr translation progress</Text>
</Page.Header>
<Page.Content>
<DataFetcher loading={<AppLoader/>} error={<ErrorMessage/>}>
<IconActions/>
<DataTable/>
</DataFetcher>
</Page.Content>
<Page.Footer style={{position: 'static'}}>
<AppFooter/>
</Page.Footer>
</Page>
</GeistProvider>;

export {App}
11 changes: 11 additions & 0 deletions resources/src/AppFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as React from "react";
import {Link, Text} from "@geist-ui/react";

const AppFooter = () => {
return <Text p>
Generated by <Link href="https://github.com/LukWebsForge/TldrProgress" icon> tldr-translation-progress</Link>
• Thanks for using this site
</Text>;
}

export {AppFooter}
9 changes: 9 additions & 0 deletions resources/src/AppLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from "react";
lukbukkit marked this conversation as resolved.
Show resolved Hide resolved
import {Loading, Row} from "@geist-ui/react";

const AppLoader = () =>
<Row style={{padding: '10px 0'}}>
<Loading>Loading</Loading>
</Row>;

export {AppLoader}
14 changes: 7 additions & 7 deletions resources/src/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ interface TranslationPage {
status: Record<Language, TranslationStatus>,
}

const DataContext = React.createContext<TranslationData | null>(null);
const ErrorMessageContext = React.createContext<string | null>(null);
const DataContext = React.createContext<{ data: TranslationData | null, error: string | null }>(
{data: null, error: null});

// We're using React.ReactElement & React.ReactNode instead of JSX.Element: https://stackoverflow.com/a/47899926/4106848
type DataFetcherProps = { error: React.ReactElement, loading: React.ReactElement, children: React.ReactNode };
Expand Down Expand Up @@ -59,17 +59,17 @@ const DataFetcher = (props: DataFetcherProps) => {
}, []);

if (error) {
return <ErrorMessageContext.Provider value={error}>
return <DataContext.Provider value={{data: null, error: error}}>
{props.error}
</ErrorMessageContext.Provider>
</DataContext.Provider>
} else if (!isLoaded) {
return props.loading
} else {
return <DataContext.Provider value={data}>
return <DataContext.Provider value={{data: data, error: null}}>
{props.children}
</DataContext.Provider>
}
}

export {DataFetcher, DataContext, TranslationStatus, ErrorMessageContext};
export type {OperatingSystem, Language, PageName};
export {DataFetcher, DataContext, TranslationStatus};
export type {TranslationData, OperatingSystem, Language, PageName};
Loading