Skip to content

Commit

Permalink
Merge branch 'develop-website'
Browse files Browse the repository at this point in the history
  • Loading branch information
ziteh committed Jul 27, 2024
2 parents 10cc3c8 + f208e1b commit 11f5a8b
Show file tree
Hide file tree
Showing 22 changed files with 4,383 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: GitHub Pages deploy

on:
workflow_dispatch:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- uses: pnpm/action-setup@v4
with:
version: 8

- name: Change working directory
run: cd website

- name: Installing packages
run: pnpm ci

- name: Build
run: pnpm run build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: out
7 changes: 6 additions & 1 deletion elebox.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"name": "cli",
"path": "./elebox-cli"
},
{
"name": "website",
"path": "./website"
},
{
"name": "root",
"path": "."
Expand All @@ -30,7 +34,8 @@
"Jamm",
"jammdb",
"tauri",
"vuetify"
"vuetify",
"nextra"
],
"files.exclude": {
"**/.git": true,
Expand Down
3 changes: 3 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.next
node_modules
out/
Empty file added website/components/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions website/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// export { locales as middleware } from "nextra/locales";
5 changes: 5 additions & 0 deletions website/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
27 changes: 27 additions & 0 deletions website/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});

module.exports = withNextra({
output: "export",
// i18n: {
// locales: ["en", "zh"],
// defaultLocale: "en",
// },
assetPrefix: "./",
basePath: "https://github.com/ziteh/elebox",
images: {
loader: "akamai",
path: "",
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "i.imgur.com",
port: "",
pathname: "/**",
},
],
},
});
22 changes: 22 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "elebox-website",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@mui/material": "^5.16.5",
"next": "^14.2.5",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^20.14.12",
"typescript": "^5.5.4"
}
}
19 changes: 19 additions & 0 deletions website/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from "react";
import { ThemeProvider, createTheme, CssBaseline } from "@mui/material";

const App = ({ Component, pageProps }) => {
const muiTheme = createTheme({
palette: {
mode: "dark",
},
});

return (
<ThemeProvider theme={muiTheme}>
<CssBaseline />
<Component {...pageProps} />
</ThemeProvider>
);
};

export default App;
18 changes: 18 additions & 0 deletions website/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"index": {
"title": "Home",
"type": "page",
"display": "hidden",
"theme": {
"layout": "raw"
}
},
"docs": {
"title": "Docs",
"type": "page"
},
"about": {
"title": "About",
"type": "page"
}
}
5 changes: 5 additions & 0 deletions website/pages/about.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# About

Elebox is licensed under either [Apache-2.0](https://github.com/ziteh/elebox/blob/main/LICENSE-APACHE) or [MIT license](https://github.com/ziteh/elebox/blob/main/LICENSE-MIT).

This website built with [Next.js](https://nextjs.org/) and [Nextra](https://github.com/shuding/nextra) theme.
7 changes: 7 additions & 0 deletions website/pages/docs/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"overview": "Overview",
"get-started": "Get started",
"gui": "GUI",
"cli": "CLI",
"data-field": "Data Field"
}
101 changes: 101 additions & 0 deletions website/pages/docs/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import Alert from "@mui/material/Alert";
import AlertTitle from "@mui/material/AlertTitle";
import Box from "@mui/material/Box";

# CLI

Command line edition of Elebox, powered by [clap](https://docs.rs/clap/latest/clap/).

<Box mt={4}>
<Alert severity="warning">CLI currently has limited functionality.</Alert>
</Box>

## Usage

<Box mt={4}>
<Alert severity="info">
If you're run via Cargo workspace (i.e. not using the released executable),
replace `elebox` with `cargo run -p elebox-cli --` in the following command.
For example, use `cargo run -p elebox-cli -- help` instead of `elebox help`.
</Alert>
</Box>

### Basic

Print help message:

```bash copy
elebox help
```

Use and operate on the default database path and filename `./elebox.db`:

```bash copy
elebox COMMAND
```

or a specified `./my_box.db`:

```bash copy
elebox my_box.db COMMAND
```

where `COMMAND` can be `init`, `part`, `category`, `export` or `import`.

### Init

You need to initialize a database before you can proceed with the next steps.

Create and initialize a new database with the default path:

```bash copy
elebox init
```

### Category

List part categories:

```bash copy
elebox category
```

Create a new part category named `MCU`:

```bash copy
elebox category new MCU
```

Create new part category named `ARM` and `RISC-V`, and designate them as a subcategory of `MCU`:

```bash copy
elebox category new ARM -p MCU
elebox category new "RISC-V" -p MCU
```

### Part

List parts:

```bash copy
elebox part
```

Create a new part named `RP2040` with a part category of `ARM`, and a quantity of `25`:

```bash copy
elebox part new RP2040 25 ARM
```

Consume or restock 10 `RP2040`:

```bash copy
elebox part use RP2040 10
elebox part add RP2040 10
```

Rename `RP2040` to `rpi-RP2040`:

```bash copy
elebox part update RP2040 "rpi-RP2040"
```
Loading

0 comments on commit 11f5a8b

Please sign in to comment.