Skip to content

Commit

Permalink
Review code
Browse files Browse the repository at this point in the history
* remove sentry
* format readme
* remove unneccessary settings app property
  • Loading branch information
madil4 committed Sep 25, 2023
1 parent 7eb07e6 commit a002a91
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Netlify Status](https://api.netlify.com/api/v1/badges/bbd7a065-cc1a-4f34-b0b7-cd45a48cb76a/deploy-status)](https://app.netlify.com/sites/awatif-app/deploys)

## What is Awatif?
Awatif is the first online parametric structural engineering software:

Awatif is the first online parametric structural engineering software

- 🚀 Battle-tested FEM solver for only $10 per month
- 🌐 Design and simulate from any browser
- 🏓 Interactive realtime simulations
Expand All @@ -12,16 +14,21 @@ Awatif is the first online parametric structural engineering software:
Wanna dig deeper? Read the article [The Benefits of Parametric Modeling in Structural Engineering](https://www.linkedin.com/pulse/benefits-parametric-modeling-structural-engineering-mohamed-adil)

## Getting started

You can either use the hosted version at https://app.awatif.co or run it locally by following these steps:
1. Make sure you have downloaded and installed [Node.js](https://nodejs.org/en) and [Git](https://git-scm.com/)
2. Run the following commands in the terminal:

1. Make sure you have downloaded and installed [Node.js](https://nodejs.org/en) and [Git](https://git-scm.com/)
2. Run the following commands in the terminal:

```terminal
git clone https://github.com/madil4/awatif.git
cd awatif
npm install
npm run dev
```
The local development server will start, and the app will open in the browser. Make sure you read the documentation at https://awatif.co/docs to understand the app.

The local development server will start, and the app will open in the browser. Make sure you read the documentation at [https://awatif.co/docs](https://mohamedadil.notion.site/Getting-Started-a8565ccbdea641b7b4793a6f42d983af) to understand the app.

## Want to contribute?

I have a long list of features with different levels of complexity. If you are brand new and want to learn, don't hesitate to join. I'm more approachable through LinkedIn at https://www.linkedin.com/in/madil4/.
4 changes: 0 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script
src="https://js.sentry-cdn.com/a9eb44a767ef4a3eb83e32437398c02d.min.js"
crossorigin="anonymous"
></script>
<script
defer
data-domain="app.awatif.co"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "awatif",
"version": "0.2.0",
"version": "0.3.0",
"description": "The First Online Parametric Structural Engineering Software",
"scripts": {
"dev": "vite dev --open",
Expand Down
19 changes: 7 additions & 12 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const staging = localStorage.getItem("staging") ? true : false;

type AppProps = {
script?: string;
settings?: Partial<SettingsType>;
};

export function App(props: AppProps) {
Expand Down Expand Up @@ -79,12 +78,11 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;
deformedShape: true,
elementResults: "none",
nodeResults: "none",
...props.settings,
};
const [currentScript, setCurrentScript] = createSignal("");
const settings = createMutable<SettingsType>(defaultSettings);
const [script, setScript] = createSignal("");
const [currentScript, setCurrentScript] = createSignal("");
const [showSave, setShowSave] = createSignal(false);
const settings = createMutable<SettingsType>(defaultSettings);
const [undeformedNodes, setUndeformedNodes] = createSignal([]);
const [deformedNodes, setDeformedNodes] = createSignal<any>([]);
const [elements, setElements] = createSignal([]);
Expand All @@ -99,14 +97,15 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;
const [userPlan, setUserPlan] = createSignal("");

onMount(async () => {
// set User plan and Awatif key
// set user plan
const urlParams = new URL(window.location.href).searchParams;
setUserPlan(
(await supabase.auth.getSession()).data.session?.user?.phone
? "pro"
: "free"
);

// set Awatif key
if (
userPlan() === "pro" ||
(urlParams.get("user_id") === "1e9e6f54-bc8d-4dd7-8554-ffa7124f8d81" &&
Expand All @@ -122,7 +121,7 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;
// set script
let scriptFromURL = "";
if (urlParams.get("user_id") && urlParams.get("slug")) {
const { data, error } = await supabase
const { data } = await supabase
.from("projects")
.select("script,id")
.eq("user_id", urlParams.get("user_id"))
Expand All @@ -134,6 +133,7 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;
const script = props.script || scriptFromURL || defaultScript;
setScript(script);
setCurrentScript(script);

solveModel({ script: script });

// add save shortcut
Expand Down Expand Up @@ -201,11 +201,6 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;
})
);

// on parameter change: solve model by running onParameterChange function
function onParameterChange(e: any) {
solveModel({ key: e.presetKey, value: e.value });
}

// on save: solve model from the script, then sync the script
async function onSave() {
solveModel({ script: currentScript() });
Expand Down Expand Up @@ -383,7 +378,7 @@ export const analysisResults = analyzing(nodes, elements, assignments);`;

<Parameters
parameters={parameters()}
onChange={(e) => onParameterChange(e)}
onChange={(e) => solveModel({ key: e.presetKey || "", value: e.value })}
/>
</Layouter>
);
Expand Down

0 comments on commit a002a91

Please sign in to comment.