Skip to content

Commit 7f40c98

Browse files
authored
Merge pull request #2 from TheCodeRaccoons/te-taking-project
re taking project
2 parents 76d0032 + f3ff4d1 commit 7f40c98

45 files changed

Lines changed: 7525 additions & 19126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>SV Tracker</title>
7+
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/index.tsx"></script>
12+
</body>
13+
</html>

package-lock.json

Lines changed: 5407 additions & 17559 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
{
22
"name": "svProgressTracker",
33
"version": "0.1.0",
4+
"type": "module",
45
"private": true,
56
"homepage": "https://thecoderaccoons.github.io/svprogresstracker",
67
"dependencies": {
7-
"@testing-library/jest-dom": "^4.2.4",
8-
"@testing-library/react": "^9.5.0",
9-
"@testing-library/user-event": "^7.2.1",
10-
"react": "^16.13.1",
8+
"@testing-library/jest-dom": "^6.8.0",
9+
"@testing-library/react": "^16.3.0",
10+
"@testing-library/user-event": "^14.6.1",
11+
"fast-xml-parser": "^5.2.5",
12+
"polyfills": "^2.1.1",
13+
"react": "^19.1.1",
1114
"react-adsense": "^0.1.0",
12-
"react-dom": "^16.13.1",
13-
"react-router-dom": "^5.2.0",
14-
"react-scripts": "^4.0.3",
15-
"react-tabs": "^3.1.0",
15+
"react-dom": "^19.1.1",
16+
"react-router-dom": "^7.8.2",
17+
"react-tabs": "^6.1.0",
1618
"xml-js": "^1.6.11"
1719
},
1820
"scripts": {
19-
"start": "react-scripts start",
20-
"build": "react-scripts build",
21-
"test": "react-scripts test",
22-
"eject": "react-scripts eject",
21+
"dev": "vite",
22+
"build": "vite build",
23+
"preview": "vite preview",
2324
"predeploy": "npm run build",
2425
"deploy": "npm run build && gh-pages -d build"
2526
},
@@ -39,6 +40,12 @@
3940
]
4041
},
4142
"devDependencies": {
42-
"gh-pages": "^3.1.0"
43+
"@types/react": "^19.1.12",
44+
"@types/react-dom": "^19.1.9",
45+
"@types/react-router-dom": "^5.3.3",
46+
"@vitejs/plugin-react": "^4.7.0",
47+
"gh-pages": "^6.1.1",
48+
"typescript": "^5.9.2",
49+
"vite": "^6.3.5"
4350
}
4451
}

src/App.js renamed to src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import React from 'react';
22
import Main from './Components/Main/Main'
33
import './App.css'
44
import './Components/tabs-css/tabs.css'
5-
import {Route} from "react-router-dom";
5+
import { Route, Routes } from "react-router-dom";
66

77
function App() {
88
return (
99
<div className="App">
10-
<Route exact path={`/`} render={ () => < Main />} />
10+
<Routes>
11+
<Route path="/" element={<Main />} />
12+
</Routes>
1113
</div>
1214
);
1315
}

src/Components/AchieveTabs/Collection.js

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import React, { useState, useEffect } from 'react'
2+
3+
interface CollectionProps {
4+
museumCollection: {
5+
artifacts: Array<{
6+
found: boolean;
7+
inMuseum: boolean;
8+
image: string;
9+
name: string;
10+
}>;
11+
minerals: Array<{
12+
found: boolean;
13+
inMuseum: boolean;
14+
image: string;
15+
name: string;
16+
}>;
17+
};
18+
}
19+
20+
const Collection: React.FC<CollectionProps> = ({ museumCollection }) => {
21+
const [totalFound, setTotalFound] = useState(0);
22+
const [totalDelivered, setTotalDelivered] = useState(0);
23+
const [total, setTotal] = useState(0);
24+
25+
const getTotalFound = () => {
26+
const artifacts = museumCollection.artifacts;
27+
const minerals = museumCollection.minerals;
28+
29+
const totalArtFound = artifacts.reduce((accum, item) => (item.found) ? accum + 1 : accum, 0);
30+
const totalMinFound = minerals.reduce((accum, item) => (item.found) ? accum + 1 : accum, 0);
31+
const totalArtD = artifacts.reduce((accum, item) => (item.inMuseum) ? accum + 1 : accum, 0);
32+
const totalMinD = minerals.reduce((accum, item) => (item.inMuseum) ? accum + 1 : accum, 0);
33+
34+
setTotalFound(totalArtFound + totalMinFound);
35+
setTotalDelivered(totalArtD + totalMinD);
36+
setTotal(artifacts.length + minerals.length);
37+
};
38+
39+
useEffect(() => {
40+
getTotalFound();
41+
}, [museumCollection]);
42+
43+
return (
44+
<div className="progress-container">
45+
<span className="a-title"><h1>{`You've found ${totalFound} objects and delivered ${totalDelivered} / ${total} to the museum`}</h1></span>
46+
<br />
47+
<br />
48+
<h2>Museum Achievements</h2>
49+
<ul className="a-List">
50+
<li>A Complete Collection: {(total === totalDelivered) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to deliver {total - totalDelivered} more items to get this achievement.</span> } </li>
51+
</ul>
52+
<span className="a-title"><h1>Artifacts</h1></span>
53+
{museumCollection.artifacts.map((item, i) => <a href={`https://stardewvalleywiki.com/${item.image}`} target="blank" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Artifacts/${item.image}.png`} alt={item.name} className={ (item.found) ? item.inMuseum ? "done" : "known": "" } title={(item.found) ? (item.inMuseum) ? `You have delivered ${item.name} to the museum` : `You haven't delivered ${item.name} to the museum` : `You haven't found ${item.name} yet`} ></img></a>)}
54+
55+
<span className="a-title"><h1>Minerals</h1></span>
56+
{museumCollection.minerals.map((item, i) => <a href={`https://stardewvalleywiki.com/${item.image}`} target="blank" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Minerals/${item.image}.png`} alt={item.name} className={ (item.found) ? item.inMuseum ? "done" : "known" : "" } title={(item.found) ? (item.inMuseum) ? `You have delivered ${item.name} to the museum` : `You haven't delivered ${item.name} to the museum` : `You haven't found ${item.name} yet`} ></img></a>)}
57+
</div>
58+
);
59+
};
60+
61+
export default Collection;

src/Components/AchieveTabs/Crafting.js

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React, { useState, useEffect } from 'react'
2+
3+
interface CraftingItem {
4+
times?: number;
5+
name: string;
6+
image: string;
7+
}
8+
9+
interface CraftingProps {
10+
itemsCrafted: CraftingItem[];
11+
}
12+
13+
const Crafting: React.FC<CraftingProps> = ({ itemsCrafted }) => {
14+
const [totalCrafted, setTotalCrafted] = useState(0);
15+
16+
const getCraftedItems = (items: CraftingItem[]) => {
17+
return items.map((num) => (num.times !== undefined && num.times > 0 && num.name !== "Wedding Ring") ? 1 : 0).reduce((n: number, next: number) => next + n, 0);
18+
};
19+
20+
useEffect(() => {
21+
setTotalCrafted(getCraftedItems(itemsCrafted));
22+
}, [itemsCrafted]);
23+
24+
const craftedCount = itemsCrafted.map((num) => (num.times !== undefined && num.times > 0) ? 1 : 0).reduce((n: number, next: number) => next + n, 0);
25+
const knownCount = itemsCrafted.map((num) => (num.times !== undefined && num.times >= 0) ? 1 : 0).reduce((n: number, next: number) => next + n, 0);
26+
27+
return (
28+
<div className="progress-container">
29+
<span className="a-title"><h1>has crafted {craftedCount} and knows {knownCount} of {itemsCrafted.length} recipes.</h1></span>
30+
<br />
31+
<h2>Crafting Achievements</h2>
32+
<ul className="a-List">
33+
<li>D.I.Y.: {(totalCrafted >= 15) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to craft {15 - totalCrafted} more items to get this</span> } </li>
34+
<li>Artisan: {(totalCrafted >= 30) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to craft {30 - totalCrafted} more items to get this </span>}</li>
35+
<li>Craft Master: {(totalCrafted >= 104) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to craft {104 - totalCrafted} more items to get this </span>}</li>
36+
</ul>
37+
<br />
38+
{itemsCrafted.map((item, i) => (
39+
<a href={`https://stardewvalleywiki.com/${item.image}`} target="blank" key={i}>
40+
<img
41+
key={i}
42+
src={`https://stardew-tracker.s3.amazonaws.com/Crafting/${item.image}.png`}
43+
alt={item.name}
44+
className={(item.times !== undefined) ? ((item.times > 0) ? "done" : "known") : "" }
45+
title={(item.times !== undefined) ? ((item.times > 0) ? `You have crafted "${item.name}" ${item.times} Times` : `You haven't crafted any ${item.name} yet`) : `You don't know how to craft ${item.name} yet`}>
46+
</img>
47+
</a>))}
48+
</div>
49+
);
50+
};
51+
52+
export default Crafting;

src/Components/AchieveTabs/Crops.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)