Skip to content

Commit

Permalink
Merge branch 'main' into AddTests
Browse files Browse the repository at this point in the history
  • Loading branch information
SydZero committed Nov 20, 2024
2 parents d133bb0 + 9f44301 commit 1949825
Show file tree
Hide file tree
Showing 52 changed files with 2,571 additions and 2,257 deletions.
2 changes: 1 addition & 1 deletion TestResults/coverage.cobertura.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0" branch-rate="0" version="1.9" timestamp="1732126283" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0">
<coverage line-rate="0" branch-rate="0" version="1.9" timestamp="1731811811" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0">
<sources />
<packages />
</coverage>
2 changes: 1 addition & 1 deletion frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_REACT_APP_OAUTH_CLIENT_ID="257697450661-a69l9bv939uuso551n6pcf1gngpv9ql0.apps.googleusercontent.com"
VITE_BASE_URL=https://cafe-deux-devel.acom.ucar.edu/api/api
VITE_BASE_URL=https://cafe-deux.acom.ucar.edu/api/api
41 changes: 21 additions & 20 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ ChemistryCafe is a web application built with React, Vite, and TypeScript. The a
- `node_modules/`: Folder for dependencies.
- `public/`: Folder for static assets (images, fonts, etc.).
- `src/`: Source code folder, organized as follows:
- `API/`: Functions for API interaction.
- `assets/`: Static assets.
- `components/`: Reusable components
- `pages/`: Pages:
- `styles/`: Style sheets:
- `index.css`: Global CSS styles.
- `main.tsx`: Entry point for the application.
- `vite-env.d.ts`: Vite environment TypeScript declarations.
- `API/`: Functions for API interaction.
- `assets/`: Static assets.
- `components/`: Reusable components
- `pages/`: Pages:
- `styles/`: Style sheets:
- `index.css`: Global CSS styles.
- `main.tsx`: Entry point for the application.
- `vite-env.d.ts`: Vite environment TypeScript declarations.
- `test/`: Folder for test files.
- `.eslintrc.cjs`: ESLint configuration file.
- `.gitignore`: Git ignore file.
Expand Down Expand Up @@ -62,20 +62,23 @@ ChemistryCafe is a web application built with React, Vite, and TypeScript. The a
## Setup

1. **Clone the repository**:
```shell
git clone https://github.com/NCAR/chemistrycafe.git
cd chemistrycafe
```

```shell
git clone https://github.com/NCAR/chemistrycafe.git
cd chemistrycafe
```

2. **Install dependencies**:
```shell
npm install
```

```shell
npm install
```

3. **Start the development server**:
```shell
npm run dev
```

```shell
npm run dev
```

4. The app will run on [http://localhost:5173](http://localhost:5173). You can view it in your browser.

Expand Down Expand Up @@ -103,5 +106,3 @@ To generate a coverage report, use the following command:
```shell
npm run test:coverage
```


40 changes: 24 additions & 16 deletions frontend/eslint-report.html

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: globals.browser }},
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
];
];
11 changes: 7 additions & 4 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
<link rel="icon" type="image/png" href="/ncar-generaluse.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chemistry Cafe</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lora&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Lora&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<!-- Accessibility plugin script -->
<script src="https://website-widgets.pages.dev/dist/sienna.min.js"></script>
<!-- Sienna -->
<!-- Sienna -->
</body>
</html>
88 changes: 34 additions & 54 deletions frontend/src/API/API_CreateMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ import { BASE_URL } from "./API_config";
export async function createFamily(familyData: Family) {
try {
console.log("Family data: ", familyData);
const response = await axios.post(
`${BASE_URL}/families`,
familyData,
{
headers: {
"Content-Type": "application/json",
},
}
);
const response = await axios.post(`${BASE_URL}/families`, familyData, {
headers: {
"Content-Type": "application/json",
},
});
return response.data as Family;
} catch (error) {
console.error(error);
Expand All @@ -34,15 +30,11 @@ export async function createFamily(familyData: Family) {

export async function createMechanism(mechanismData: Mechanism) {
try {
const response = await axios.post(
`${BASE_URL}/mechanism`,
mechanismData,
{
headers: {
"Content-Type": "application/json",
},
}
);
const response = await axios.post(`${BASE_URL}/mechanism`, mechanismData, {
headers: {
"Content-Type": "application/json",
},
});
return response.data as Mechanism;
} catch (error) {
console.error(error);
Expand All @@ -53,15 +45,11 @@ export async function createMechanism(mechanismData: Mechanism) {
export async function createReaction(reactionData: Reaction) {
try {
console.log("Reaction data: ", reactionData);
const response = await axios.post(
`${BASE_URL}/reactions`,
reactionData,
{
headers: {
"Content-Type": "application/json",
},
}
);
const response = await axios.post(`${BASE_URL}/reactions`, reactionData, {
headers: {
"Content-Type": "application/json",
},
});
return response.data as Reaction;
} catch (error) {
console.error(error);
Expand All @@ -71,15 +59,11 @@ export async function createReaction(reactionData: Reaction) {

export async function createSpecies(speciesData: Species) {
try {
const response = await axios.post(
`${BASE_URL}/species`,
speciesData,
{
headers: {
"Content-Type": "application/json",
},
}
);
const response = await axios.post(`${BASE_URL}/species`, speciesData, {
headers: {
"Content-Type": "application/json",
},
});
return response.data as Species;
} catch (error) {
console.error(error);
Expand All @@ -88,7 +72,7 @@ export async function createSpecies(speciesData: Species) {
}

export async function addSpeciesToReaction(
reactionSpeciesData: ReactionSpecies
reactionSpeciesData: ReactionSpecies,
) {
try {
const response = await axios.post(
Expand All @@ -98,7 +82,7 @@ export async function addSpeciesToReaction(
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.data as ReactionSpecies;
} catch (error) {
Expand All @@ -108,7 +92,7 @@ export async function addSpeciesToReaction(
}

export async function addReactionToMechanism(
mechanismReactionData: MechanismReaction
mechanismReactionData: MechanismReaction,
) {
try {
const response = await axios.post(
Expand All @@ -118,7 +102,7 @@ export async function addReactionToMechanism(
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.data as MechanismReaction;
} catch (error) {
Expand All @@ -128,7 +112,7 @@ export async function addReactionToMechanism(
}

export async function addSpeciesToMechanism(
mechanismSpeciesData: MechanismSpecies
mechanismSpeciesData: MechanismSpecies,
) {
try {
const response = await axios.post(
Expand All @@ -138,7 +122,7 @@ export async function addSpeciesToMechanism(
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.data as MechanismSpecies;
} catch (error) {
Expand All @@ -149,15 +133,11 @@ export async function addSpeciesToMechanism(

export async function createUser(userData: User) {
try {
const response = await axios.post(
`${BASE_URL}/users`,
userData,
{
headers: {
"Content-Type": "application/json",
},
}
);
const response = await axios.post(`${BASE_URL}/users`, userData, {
headers: {
"Content-Type": "application/json",
},
});
return response.data as User;
} catch (error) {
console.error(error);
Expand All @@ -174,7 +154,7 @@ export async function addUserToMechanism(userMechanismData: UserMechanism) {
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.data as UserMechanism;
} catch (error) {
Expand All @@ -186,13 +166,13 @@ export async function addUserToMechanism(userMechanismData: UserMechanism) {
export async function createProperty(propertyData: Property) {
try {
const response = await axios.post(
`${BASE_URL}/properties`, // Adjust the URL to match your properties API endpoint
`${BASE_URL}/properties`, // Adjust the URL to match your properties API endpoint
propertyData,
{
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.data as Property;
} catch (error) {
Expand Down
Loading

0 comments on commit 1949825

Please sign in to comment.