ps99-api 2.3.0 → 2.3.2
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/.github/workflows/release-on-main.yml +1 -0
- package/README.md +0 -1
- package/example-web/react2/package.json +1 -0
- package/example-web/react2/public/index.html +16 -14
- package/example-web/react2/src/App.tsx +3 -9
- package/example-web/react2/src/components/Footer.tsx +28 -48
- package/example-web/react2/src/components/GenericFetchComponent.tsx +1 -1
- package/example-web/react2/src/components/Header.tsx +54 -14
- package/example-web/react2/src/components/HomePage.tsx +14 -2
- package/example-web/react2/webpack.config.js +19 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
[](https://badge.fury.io/js/ps99-api)
|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
Pet Simulator Public API wrapper written in Typescript.
|
|
8
7
|
|
|
9
8
|
## Installation
|
|
@@ -4,26 +4,28 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Pet Simulator 99 API</title>
|
|
7
|
-
<link rel="manifest" href="/manifest.json" />
|
|
8
|
-
<link rel="icon" href="/icons/icon-192x192.png" />
|
|
7
|
+
<link rel="manifest" href="/node-ps99-api/manifest.json" />
|
|
8
|
+
<link rel="icon" href="/node-ps99-api/icons/icon-192x192.png" />
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
12
|
-
<script src="/bundle.js"></script>
|
|
12
|
+
<script src="/node-ps99-api/bundle.js"></script>
|
|
13
13
|
<script>
|
|
14
14
|
if ("serviceWorker" in navigator) {
|
|
15
15
|
window.addEventListener("load", function () {
|
|
16
|
-
navigator.serviceWorker
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
navigator.serviceWorker
|
|
17
|
+
.register("/node-ps99-api/service-worker.js")
|
|
18
|
+
.then(
|
|
19
|
+
function (registration) {
|
|
20
|
+
console.log(
|
|
21
|
+
"ServiceWorker registration successful with scope: ",
|
|
22
|
+
registration.scope,
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
function (error) {
|
|
26
|
+
console.log("ServiceWorker registration failed: ", error);
|
|
27
|
+
},
|
|
28
|
+
);
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { HashRouter as Router, Routes, Route } from "react-router-dom";
|
|
3
3
|
import HomePage from "./components/HomePage";
|
|
4
4
|
import Header from "./components/Header";
|
|
5
5
|
import CollectionsIndex from "./components/CollectionsIndex";
|
|
@@ -14,14 +14,8 @@ const App: React.FC = () => {
|
|
|
14
14
|
<Routes>
|
|
15
15
|
<Route path="/" element={<HomePage />} />
|
|
16
16
|
<Route path="/collections" element={<CollectionsIndex />} />
|
|
17
|
-
<Route
|
|
18
|
-
|
|
19
|
-
element={<CollectionConfigIndex />}
|
|
20
|
-
/>
|
|
21
|
-
<Route
|
|
22
|
-
path="/collections/:collectionName/:configName"
|
|
23
|
-
element={<DynamicCollectionConfigData />}
|
|
24
|
-
/>
|
|
17
|
+
<Route path="/collections/:collectionName" element={<CollectionConfigIndex />} />
|
|
18
|
+
<Route path="/collections/:collectionName/:configName" element={<DynamicCollectionConfigData />} />
|
|
25
19
|
</Routes>
|
|
26
20
|
<Footer />
|
|
27
21
|
</Router>
|
|
@@ -1,58 +1,38 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useOnlineStatus } from "../hooks/useOnlineStatus";
|
|
1
|
+
import React from "react";
|
|
3
2
|
|
|
4
3
|
const Footer: React.FC = () => {
|
|
5
|
-
const isOnline = useOnlineStatus();
|
|
6
|
-
const [lastUpdate, setLastUpdate] = useState<string | null>(null);
|
|
7
|
-
const [loading, setLoading] = useState(false);
|
|
8
|
-
|
|
9
|
-
const updateLastUpdate = () => {
|
|
10
|
-
setLastUpdate(new Date().toLocaleString());
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const fetchData = async () => {
|
|
15
|
-
setLoading(true);
|
|
16
|
-
// Simulate a fetch call to update lastUpdate time
|
|
17
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
-
updateLastUpdate();
|
|
19
|
-
setLoading(false);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
fetchData();
|
|
23
|
-
|
|
24
|
-
window.addEventListener("online", updateLastUpdate);
|
|
25
|
-
window.addEventListener("offline", updateLastUpdate);
|
|
26
|
-
|
|
27
|
-
return () => {
|
|
28
|
-
window.removeEventListener("online", updateLastUpdate);
|
|
29
|
-
window.removeEventListener("offline", updateLastUpdate);
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
4
|
return (
|
|
34
5
|
<footer
|
|
35
|
-
style={{
|
|
36
|
-
display: "flex",
|
|
37
|
-
justifyContent: "space-between",
|
|
38
|
-
padding: "1em",
|
|
39
|
-
borderTop: "1px solid #ccc",
|
|
40
|
-
}}
|
|
6
|
+
style={{ textAlign: "center", padding: "1em", background: "#f8f9fa" }}
|
|
41
7
|
>
|
|
42
8
|
<div>
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
9
|
+
<a href="https://badge.fury.io/js/ps99-api">
|
|
10
|
+
<img
|
|
11
|
+
src="https://badge.fury.io/js/ps99-api.svg"
|
|
12
|
+
alt="npm version"
|
|
13
|
+
height="18"
|
|
14
|
+
/>
|
|
15
|
+
</a>
|
|
16
|
+
|
|
17
|
+
<a href="https://github.com/joekiller/node-ps99-api">
|
|
18
|
+
<img
|
|
19
|
+
src="https://img.shields.io/badge/source-github-blue?logo=github"
|
|
20
|
+
alt="GitHub source"
|
|
21
|
+
height="18"
|
|
22
|
+
/>
|
|
23
|
+
</a>
|
|
55
24
|
</div>
|
|
25
|
+
<p>
|
|
26
|
+
© {new Date().getFullYear()} Joseph "
|
|
27
|
+
<a
|
|
28
|
+
href="https://joekiller.com"
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noopener noreferrer"
|
|
31
|
+
>
|
|
32
|
+
joekiller
|
|
33
|
+
</a>
|
|
34
|
+
" Lawson. All rights reserved.
|
|
35
|
+
</p>
|
|
56
36
|
</footer>
|
|
57
37
|
);
|
|
58
38
|
};
|
|
@@ -6,20 +6,60 @@ const Header: React.FC = () => {
|
|
|
6
6
|
const pathnames = location.pathname.split("/").filter((x) => x);
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
|
-
<nav
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
<nav
|
|
10
|
+
style={{
|
|
11
|
+
padding: "1em",
|
|
12
|
+
background: "#f8f9fa",
|
|
13
|
+
borderBottom: "1px solid #e7e7e7",
|
|
14
|
+
display: "flex",
|
|
15
|
+
justifyContent: "space-between",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<div style={{ display: "flex", alignItems: "center" }}>
|
|
20
|
+
<Link
|
|
21
|
+
to="/"
|
|
22
|
+
style={{
|
|
23
|
+
textDecoration: "none",
|
|
24
|
+
color: "#007bff",
|
|
25
|
+
display: "flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<img
|
|
30
|
+
src="/node-ps99-api/icons/icon-192x192.png"
|
|
31
|
+
alt="Home"
|
|
32
|
+
style={{ width: "40px", height: "40px", marginRight: "0.5em" }}
|
|
33
|
+
/>
|
|
34
|
+
</Link>
|
|
35
|
+
<ol
|
|
36
|
+
style={{ display: "flex", listStyle: "none", padding: 0, margin: 0 }}
|
|
37
|
+
>
|
|
38
|
+
<li style={{ margin: "0 0.5em" }}>
|
|
39
|
+
<Link to="/" style={{ textDecoration: "none", color: "#007bff" }}>
|
|
40
|
+
Home
|
|
41
|
+
</Link>
|
|
42
|
+
</li>
|
|
43
|
+
{pathnames.map((value, index) => {
|
|
44
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
45
|
+
return (
|
|
46
|
+
<li key={to} style={{ margin: "0 0.5em" }}>
|
|
47
|
+
<Link
|
|
48
|
+
to={to}
|
|
49
|
+
style={{ textDecoration: "none", color: "#007bff" }}
|
|
50
|
+
>
|
|
51
|
+
{decodeURIComponent(value)}
|
|
52
|
+
</Link>
|
|
53
|
+
</li>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</ol>
|
|
57
|
+
</div>
|
|
58
|
+
<h1 style={{ margin: 0 }}>
|
|
59
|
+
<Link to="/" style={{ textDecoration: "none", color: "#007bff" }}>
|
|
60
|
+
Pet Simulator 99 API
|
|
61
|
+
</Link>
|
|
62
|
+
</h1>
|
|
23
63
|
</nav>
|
|
24
64
|
);
|
|
25
65
|
};
|
|
@@ -3,10 +3,22 @@ import { Link } from "react-router-dom";
|
|
|
3
3
|
|
|
4
4
|
const HomePage: React.FC = () => {
|
|
5
5
|
return (
|
|
6
|
-
<div>
|
|
6
|
+
<div style={{ textAlign: "center", padding: "2em" }}>
|
|
7
7
|
<h1>Welcome to Pet Simulator 99 API</h1>
|
|
8
|
+
<p>Your one-stop solution for accessing all Pet Simulator 99 data.</p>
|
|
8
9
|
<p>Select a collection to get started:</p>
|
|
9
|
-
<Link
|
|
10
|
+
<Link
|
|
11
|
+
to="/collections"
|
|
12
|
+
style={{
|
|
13
|
+
padding: "0.5em 1em",
|
|
14
|
+
background: "#007bff",
|
|
15
|
+
color: "#fff",
|
|
16
|
+
textDecoration: "none",
|
|
17
|
+
borderRadius: "4px",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
View Collections
|
|
21
|
+
</Link>
|
|
10
22
|
</div>
|
|
11
23
|
);
|
|
12
24
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
3
|
+
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
5
6
|
entry: "./src/index.tsx",
|
|
@@ -13,7 +14,7 @@ module.exports = {
|
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
test: /\.css$/i,
|
|
16
|
-
use: ["css-loader"],
|
|
17
|
+
use: ["style-loader", "css-loader"], // Add style-loader here to properly handle CSS
|
|
17
18
|
},
|
|
18
19
|
],
|
|
19
20
|
},
|
|
@@ -26,11 +27,23 @@ module.exports = {
|
|
|
26
27
|
output: {
|
|
27
28
|
filename: "bundle.js",
|
|
28
29
|
path: path.resolve(__dirname, "dist"),
|
|
29
|
-
publicPath: "/",
|
|
30
|
+
publicPath: "/node-ps99-api/",
|
|
30
31
|
},
|
|
31
32
|
plugins: [
|
|
33
|
+
new HtmlWebpackPlugin({
|
|
34
|
+
template: path.join(__dirname, "public", "index.html"),
|
|
35
|
+
publicPath: "/node-ps99-api/",
|
|
36
|
+
}),
|
|
32
37
|
new CopyWebpackPlugin({
|
|
33
|
-
patterns: [
|
|
38
|
+
patterns: [
|
|
39
|
+
{
|
|
40
|
+
from: path.resolve(__dirname, "public"),
|
|
41
|
+
to: path.resolve(__dirname, "dist"),
|
|
42
|
+
globOptions: {
|
|
43
|
+
ignore: ["**/index.html"], // Ignore index.html to avoid conflict
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
34
47
|
}),
|
|
35
48
|
],
|
|
36
49
|
devServer: {
|
|
@@ -39,6 +52,8 @@ module.exports = {
|
|
|
39
52
|
},
|
|
40
53
|
compress: true,
|
|
41
54
|
port: 9000,
|
|
42
|
-
historyApiFallback:
|
|
55
|
+
historyApiFallback: {
|
|
56
|
+
index: "/node-ps99-api/index.html",
|
|
57
|
+
},
|
|
43
58
|
},
|
|
44
59
|
};
|