ode-explorer 1.0.0-explorer
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +61 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +6 -0
- package/README.md +136 -0
- package/TOOLS.md +31 -0
- package/index.html +19 -0
- package/lighthouserc.json +37 -0
- package/package.json +84 -0
- package/prettier.config.js +9 -0
- package/public/apps.svg +492 -0
- package/public/locales/en/translations.json +3 -0
- package/public/locales/fr/translations.json +3 -0
- package/src/app/App.tsx +175 -0
- package/src/assets/images/library.jpg +0 -0
- package/src/assets/images/react.svg +1 -0
- package/src/assets/images/vite.svg +1 -0
- package/src/components/AppHeader.tsx +12 -0
- package/src/components/FakeCard.tsx +47 -0
- package/src/contexts/ExplorerContext.tsx +100 -0
- package/src/contexts/OdeContext.tsx +115 -0
- package/src/hooks/adapters/explorer/ResourceCardWrapper.tsx +27 -0
- package/src/hooks/adapters/explorer/TreeNodeFolderWrapper.tsx +24 -0
- package/src/hooks/adapters/explorer/types.tsx +13 -0
- package/src/hooks/adapters/explorer/useExplorerAdapter.tsx +63 -0
- package/src/hooks/useI18n.tsx +9 -0
- package/src/hooks/useOdeBackend.tsx +64 -0
- package/src/i18n.ts +31 -0
- package/src/index.css +129 -0
- package/src/main.tsx +34 -0
- package/src/pages/Blog.tsx +3 -0
- package/src/pages/Home.tsx +20 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +28 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +73 -0
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
"plugin:react/recommended",
|
|
8
|
+
"airbnb",
|
|
9
|
+
"airbnb-typescript",
|
|
10
|
+
"plugin:import/typescript",
|
|
11
|
+
"plugin:prettier/recommended",
|
|
12
|
+
],
|
|
13
|
+
parser: "@typescript-eslint/parser",
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaFeatures: {
|
|
16
|
+
jsx: false,
|
|
17
|
+
},
|
|
18
|
+
ecmaVersion: "latest",
|
|
19
|
+
sourceType: "module",
|
|
20
|
+
project: "./tsconfig.json",
|
|
21
|
+
tsconfigRootDir: __dirname,
|
|
22
|
+
},
|
|
23
|
+
plugins: ["react", "@typescript-eslint", "prettier"],
|
|
24
|
+
rules: {
|
|
25
|
+
"arrow-parens": "off",
|
|
26
|
+
"react/react-in-jsx-scope": "off",
|
|
27
|
+
"react/jsx-uses-react": ["off"],
|
|
28
|
+
"react/jsx-props-no-spreading": ["warn"],
|
|
29
|
+
"react/no-unescaped-entities": ["off"],
|
|
30
|
+
"react/jsx-one-expression-per-line": "off",
|
|
31
|
+
"@typescript-eslint/quotes": "off",
|
|
32
|
+
"no-console": "off",
|
|
33
|
+
"import/order": [
|
|
34
|
+
"error",
|
|
35
|
+
{
|
|
36
|
+
groups: ["builtin", "external", "internal"],
|
|
37
|
+
pathGroups: [
|
|
38
|
+
{
|
|
39
|
+
pattern: "react",
|
|
40
|
+
group: "external",
|
|
41
|
+
position: "before",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
pathGroupsExcludedImportTypes: ["react"],
|
|
45
|
+
"newlines-between": "always",
|
|
46
|
+
alphabetize: {
|
|
47
|
+
order: "asc",
|
|
48
|
+
caseInsensitive: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
ignorePatterns: [
|
|
54
|
+
"prettier.config.js",
|
|
55
|
+
"node_modules",
|
|
56
|
+
"public",
|
|
57
|
+
"dist",
|
|
58
|
+
"vite.config.ts",
|
|
59
|
+
".eslintrc.cjs",
|
|
60
|
+
],
|
|
61
|
+
};
|
package/.prettierignore
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Open Digital Education Explorer
|
|
2
|
+
|
|
3
|
+
This is a [ReactJS](https://reactjs.org) + [Vite](https://vitejs.dev) app.
|
|
4
|
+
|
|
5
|
+
## What is inside?
|
|
6
|
+
|
|
7
|
+
Many tools are already configured like:
|
|
8
|
+
|
|
9
|
+
- [ReactJS](https://reactjs.org)
|
|
10
|
+
- [Vite](https://vitejs.dev)
|
|
11
|
+
- [TypeScript](https://www.typescriptlang.org)
|
|
12
|
+
- [...](./TOOLS.md)
|
|
13
|
+
|
|
14
|
+
[See all tools](./TOOLS.md)
|
|
15
|
+
|
|
16
|
+
## Getting Started
|
|
17
|
+
|
|
18
|
+
### Install
|
|
19
|
+
|
|
20
|
+
Install all dependencies.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Dev
|
|
27
|
+
|
|
28
|
+
### Start project
|
|
29
|
+
|
|
30
|
+
Open your project with Vite Server + HMR at <http://localhost:3000>.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### [Server Options](https://vitejs.dev/config/server-options.html)
|
|
37
|
+
|
|
38
|
+
You can change Vite Server by editing `vite.config.ts`
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
server: {
|
|
42
|
+
host: "0.0.0.0",
|
|
43
|
+
port: 3000,
|
|
44
|
+
open: true // open the page on <http://localhost:3000> when dev server starts.
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Absolute Imports
|
|
49
|
+
|
|
50
|
+
You should use absolute imports in your app
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
Replace ../components/* by components/*
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Edit `vite.config.ts` and add an `alias`
|
|
57
|
+
|
|
58
|
+
> Telling Vite how to build import path:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
alias: [
|
|
62
|
+
{ find: "~", replacement: path.resolve(__dirname, "src") },
|
|
63
|
+
{
|
|
64
|
+
find: "components",
|
|
65
|
+
replacement: path.resolve(__dirname, "./src/components"),
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Add your new path to `tsconfig.json`:
|
|
71
|
+
|
|
72
|
+
> Telling TypeScript how to resolve import path:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
"baseUrl": "./src",
|
|
76
|
+
"paths": {
|
|
77
|
+
"components/*": ["./components/*"],
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Lint
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
yarn lint
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Prettier
|
|
88
|
+
|
|
89
|
+
Prettier write and check separately
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
yarn format:write
|
|
93
|
+
yarn format:check
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Prettier everything once
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
yarn format
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Lighthouse
|
|
103
|
+
|
|
104
|
+
> LHCI will check if your app respect at least 90% of these categories: performance, a11y, Best practices and seo
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
yarn lighthouse
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Pre-commit
|
|
111
|
+
|
|
112
|
+
When committing your work, `pre-commit` will start `yarn lint-staged`:
|
|
113
|
+
|
|
114
|
+
> lint-staged starts lint + prettier
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
yarn pre-commit
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Build
|
|
121
|
+
|
|
122
|
+
TypeScript check + Vite Build
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
yarn build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Preview
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
yarn preview
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
This project is licensed under the AGPL-3.0 license.
|
package/TOOLS.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Tools
|
|
2
|
+
|
|
3
|
+
## React
|
|
4
|
+
|
|
5
|
+
- [ReactJS](https://reactjs.org)
|
|
6
|
+
- [React Router](https://reactrouter.com/en/main)
|
|
7
|
+
- [React i18next](https://react.i18next.com/)
|
|
8
|
+
- [React Error Boundary](https://github.com/bvaughn/react-error-boundary#readme)
|
|
9
|
+
|
|
10
|
+
## Vite
|
|
11
|
+
|
|
12
|
+
- [Vite](https://vitejs.dev)
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
- [TypeScript](https://www.typescriptlang.org)
|
|
17
|
+
- [Eslint](https://eslint.org)
|
|
18
|
+
- [Prettier](https://prettier.io)
|
|
19
|
+
- [Husky](https://github.com/typicode/husky)
|
|
20
|
+
|
|
21
|
+
## Hooks
|
|
22
|
+
|
|
23
|
+
- [SWR](https://swr.vercel.app/)
|
|
24
|
+
|
|
25
|
+
## Utilities
|
|
26
|
+
|
|
27
|
+
- [CLSX](https://github.com/lukeed/clsx#readme)
|
|
28
|
+
|
|
29
|
+
## Lighthouse
|
|
30
|
+
|
|
31
|
+
- [Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci)
|
package/index.html
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Blog</title>
|
|
8
|
+
<link
|
|
9
|
+
id="theme"
|
|
10
|
+
rel="stylesheet"
|
|
11
|
+
href="/assets/themes/ode-bootstrap-neo/skins/default/theme.css"
|
|
12
|
+
/>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<!-- blog, collaborativeeditor, collaborativewall, exercizer, mindmap, pages, timelinegenerator, wiki, scrapbook -->
|
|
16
|
+
<div data-ode-app='{"app":"blog"}'></div>
|
|
17
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ci": {
|
|
3
|
+
"collect": {
|
|
4
|
+
"url": ["http://localhost:5173/"],
|
|
5
|
+
"startServerCommand": "rails server -e production",
|
|
6
|
+
"staticDistDir": "./dist",
|
|
7
|
+
"settings": {
|
|
8
|
+
"onlyCategories": [
|
|
9
|
+
"performance",
|
|
10
|
+
"accessibility",
|
|
11
|
+
"best-practices",
|
|
12
|
+
"seo"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"assert": {
|
|
17
|
+
"assertions": {
|
|
18
|
+
"categories:performance": [
|
|
19
|
+
"error",
|
|
20
|
+
{ "minScore": 0.9, "aggregationMethod": "median-run" }
|
|
21
|
+
],
|
|
22
|
+
"categories:accessibility": [
|
|
23
|
+
"error",
|
|
24
|
+
{ "minScore": 0.9, "aggregationMethod": "pessimistic" }
|
|
25
|
+
],
|
|
26
|
+
"categories:best-practices": [
|
|
27
|
+
"error",
|
|
28
|
+
{ "minScore": 0.9, "aggregationMethod": "pessimistic" }
|
|
29
|
+
],
|
|
30
|
+
"categories:seo": [
|
|
31
|
+
"error",
|
|
32
|
+
{ "minScore": 0.9, "aggregationMethod": "pessimistic" }
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ode-explorer",
|
|
3
|
+
"version": "1.0.0-explorer",
|
|
4
|
+
"description": "Open Digital Education Explorer",
|
|
5
|
+
"homepage": "https://github.com/opendigitaleducation/explorer#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/opendigitaleducation/explorer/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/opendigitaleducation/explorer.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "GPL-3.0",
|
|
14
|
+
"author": "Open Digital Education",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc && vite build",
|
|
17
|
+
"clean": "concurrently \"yarn:clean:*\"",
|
|
18
|
+
"clean:dist": "rm -rf dist",
|
|
19
|
+
"clean:lighthouse": "rm -rf .lighthouseci",
|
|
20
|
+
"clean:modules": "rm -rf node_modules",
|
|
21
|
+
"clean:package": "rm -rf yarn.lock",
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"fix": "eslint --fix .",
|
|
24
|
+
"format": "concurrently \"yarn:format:*\"",
|
|
25
|
+
"format:check": "yarn prettier --check .",
|
|
26
|
+
"format:write": "yarn prettier --write .",
|
|
27
|
+
"lighthouse": "yarn clean:lighthouse && lhci autorun",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"pre-commit": "lint-staged",
|
|
30
|
+
"prepare": "cd .. && husky install frontend/.husky",
|
|
31
|
+
"preview": "vite preview"
|
|
32
|
+
},
|
|
33
|
+
"husky": {
|
|
34
|
+
"hooks": {
|
|
35
|
+
"pre-commit": "lint-staged"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"lint-staged": {
|
|
39
|
+
"gitDir": "../",
|
|
40
|
+
"**/*.{js,jsx,ts,tsx}": [
|
|
41
|
+
"yarn format:write",
|
|
42
|
+
"yarn fix"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@ode-react-ui/core": "dev",
|
|
47
|
+
"@ode-react-ui/hooks": "dev",
|
|
48
|
+
"@ode-react-ui/icons": "dev",
|
|
49
|
+
"clsx": "1.2.1",
|
|
50
|
+
"i18next": "21.9.2",
|
|
51
|
+
"i18next-browser-languagedetector": "6.1.5",
|
|
52
|
+
"i18next-http-backend": "1.4.4",
|
|
53
|
+
"ode-ts-client": "feat-explorer",
|
|
54
|
+
"react": "18.2.0",
|
|
55
|
+
"react-dom": "18.2.0",
|
|
56
|
+
"react-error-boundary": "3.1.4",
|
|
57
|
+
"react-i18next": "11.18.6",
|
|
58
|
+
"react-router-dom": "6.4.1",
|
|
59
|
+
"swr": "1.3.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "18.7.23",
|
|
63
|
+
"@types/react": "18.0.21",
|
|
64
|
+
"@types/react-dom": "18.0.6",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "5.38.1",
|
|
66
|
+
"@typescript-eslint/parser": "5.38.1",
|
|
67
|
+
"@vitejs/plugin-react": "2.1.0",
|
|
68
|
+
"concurrently": "7.4.0",
|
|
69
|
+
"eslint": "8.24.0",
|
|
70
|
+
"eslint-config-airbnb": "19.0.4",
|
|
71
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
72
|
+
"eslint-config-prettier": "8.5.0",
|
|
73
|
+
"eslint-plugin-import": "2.26.0",
|
|
74
|
+
"eslint-plugin-jsx-a11y": "6.6.1",
|
|
75
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
76
|
+
"eslint-plugin-react": "7.31.8",
|
|
77
|
+
"eslint-plugin-react-hooks": "4.6.0",
|
|
78
|
+
"husky": "8.0.1",
|
|
79
|
+
"lint-staged": "13.0.3",
|
|
80
|
+
"prettier": "2.7.1",
|
|
81
|
+
"typescript": "4.8.3",
|
|
82
|
+
"vite": "3.1.3"
|
|
83
|
+
}
|
|
84
|
+
}
|