Spaces:
Running
Running
Upload 7 files
Browse files- README.md +9 -77
- index.html +52 -0
- index.tsx +13 -0
- metadata.json +6 -0
- package.json +13 -32
- tsconfig.json +30 -0
- vite.config.ts +17 -0
README.md
CHANGED
|
@@ -1,82 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
title: Week 5 Module 1
|
| 3 |
-
emoji: 🐠
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: red
|
| 6 |
-
sdk: static
|
| 7 |
-
pinned: false
|
| 8 |
-
app_build_command: npm run build
|
| 9 |
-
app_file: build/index.html
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
In the project directory, you can run:
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
The page will reload when you make changes.\
|
| 27 |
-
You may also see any lint errors in the console.
|
| 28 |
-
|
| 29 |
-
### `npm test`
|
| 30 |
-
|
| 31 |
-
Launches the test runner in the interactive watch mode.\
|
| 32 |
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
| 33 |
-
|
| 34 |
-
### `npm run build`
|
| 35 |
-
|
| 36 |
-
Builds the app for production to the `build` folder.\
|
| 37 |
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
| 38 |
-
|
| 39 |
-
The build is minified and the filenames include the hashes.\
|
| 40 |
-
Your app is ready to be deployed!
|
| 41 |
-
|
| 42 |
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
| 43 |
-
|
| 44 |
-
### `npm run eject`
|
| 45 |
-
|
| 46 |
-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
| 47 |
-
|
| 48 |
-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
| 49 |
-
|
| 50 |
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
| 51 |
-
|
| 52 |
-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
| 53 |
-
|
| 54 |
-
## Learn More
|
| 55 |
-
|
| 56 |
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
| 57 |
-
|
| 58 |
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
| 59 |
-
|
| 60 |
-
### Code Splitting
|
| 61 |
-
|
| 62 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
| 63 |
-
|
| 64 |
-
### Analyzing the Bundle Size
|
| 65 |
-
|
| 66 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
| 67 |
-
|
| 68 |
-
### Making a Progressive Web App
|
| 69 |
-
|
| 70 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
| 71 |
-
|
| 72 |
-
### Advanced Configuration
|
| 73 |
-
|
| 74 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
| 75 |
-
|
| 76 |
-
### Deployment
|
| 77 |
-
|
| 78 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
| 79 |
-
|
| 80 |
-
### `npm run build` fails to minify
|
| 81 |
-
|
| 82 |
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
|
|
| 1 |
+
# Run and deploy your AI Studio app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
This contains everything you need to run your app locally.
|
| 4 |
|
| 5 |
+
## Run Locally
|
| 6 |
|
| 7 |
+
**Prerequisites:** Node.js
|
| 8 |
|
|
|
|
| 9 |
|
| 10 |
+
1. Install dependencies:
|
| 11 |
+
`npm install`
|
| 12 |
+
2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key
|
| 13 |
+
3. Run the app:
|
| 14 |
+
`npm run dev`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Statistical Methods: Difference of Two Proportions</title>
|
| 7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
|
| 10 |
+
|
| 11 |
+
<style>
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Lato', sans-serif;
|
| 14 |
+
background-color: #f0f4f8;
|
| 15 |
+
color: #2c3e50;
|
| 16 |
+
margin: 0;
|
| 17 |
+
display: flex;
|
| 18 |
+
justify-content: center;
|
| 19 |
+
align-items: flex-start;
|
| 20 |
+
min-height: 100vh;
|
| 21 |
+
padding: 20px;
|
| 22 |
+
-webkit-font-smoothing: antialiased;
|
| 23 |
+
-moz-osx-font-smoothing: grayscale;
|
| 24 |
+
}
|
| 25 |
+
h1, h2, h3, h4 {
|
| 26 |
+
font-family: 'Merriweather', serif;
|
| 27 |
+
color: #003366;
|
| 28 |
+
}
|
| 29 |
+
#root {
|
| 30 |
+
width: 100%;
|
| 31 |
+
max-width: 800px;
|
| 32 |
+
}
|
| 33 |
+
/* Let React handle the component styling */
|
| 34 |
+
</style>
|
| 35 |
+
<script type="importmap">
|
| 36 |
+
{
|
| 37 |
+
"imports": {
|
| 38 |
+
"react": "https://esm.sh/react@^19.1.0",
|
| 39 |
+
"react-dom": "https://esm.sh/react-dom@^19.1.0",
|
| 40 |
+
"react/": "https://esm.sh/react@^19.1.0/",
|
| 41 |
+
"react-dom/": "https://esm.sh/react-dom@^19.1.0/"
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
</script>
|
| 45 |
+
<link rel="stylesheet" href="/index.css">
|
| 46 |
+
</head>
|
| 47 |
+
<body>
|
| 48 |
+
<div id="root"></div>
|
| 49 |
+
<script type="module" src="index.tsx"></script>
|
| 50 |
+
<script type="module" src="/index.tsx"></script>
|
| 51 |
+
</body>
|
| 52 |
+
</html>
|
index.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { createRoot } from 'react-dom/client';
|
| 3 |
+
import App from './src/App';
|
| 4 |
+
|
| 5 |
+
const container = document.getElementById('root');
|
| 6 |
+
if (container) {
|
| 7 |
+
const root = createRoot(container);
|
| 8 |
+
root.render(
|
| 9 |
+
<React.StrictMode>
|
| 10 |
+
<App />
|
| 11 |
+
</React.StrictMode>
|
| 12 |
+
);
|
| 13 |
+
}
|
metadata.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"description": "An interactive learning module for political and social scientists on self contained statistical Inference modules. Built with React, it features explanations, a hands-on worksheet, and a quiz with immediate feedback, all based on the provided academic slides.",
|
| 3 |
+
"prompt": "",
|
| 4 |
+
"requestFramePermissions": [],
|
| 5 |
+
"name": "Learning-App"
|
| 6 |
+
}
|
package.json
CHANGED
|
@@ -1,39 +1,20 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
-
"version": "0.1.0",
|
| 4 |
"private": true,
|
| 5 |
-
"
|
| 6 |
-
|
| 7 |
-
"@testing-library/jest-dom": "^6.6.3",
|
| 8 |
-
"@testing-library/react": "^16.3.0",
|
| 9 |
-
"@testing-library/user-event": "^13.5.0",
|
| 10 |
-
"react": "^19.1.0",
|
| 11 |
-
"react-dom": "^19.1.0",
|
| 12 |
-
"react-scripts": "5.0.1",
|
| 13 |
-
"web-vitals": "^2.1.4"
|
| 14 |
-
},
|
| 15 |
"scripts": {
|
| 16 |
-
"
|
| 17 |
-
"build": "
|
| 18 |
-
"
|
| 19 |
-
"eject": "react-scripts eject"
|
| 20 |
},
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
|
| 24 |
-
"react-app/jest"
|
| 25 |
-
]
|
| 26 |
},
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
"not op_mini all"
|
| 32 |
-
],
|
| 33 |
-
"development": [
|
| 34 |
-
"last 1 chrome version",
|
| 35 |
-
"last 1 firefox version",
|
| 36 |
-
"last 1 safari version"
|
| 37 |
-
]
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "learning-app",
|
|
|
|
| 3 |
"private": true,
|
| 4 |
+
"version": "0.0.0",
|
| 5 |
+
"type": "module",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"scripts": {
|
| 7 |
+
"dev": "vite",
|
| 8 |
+
"build": "vite build",
|
| 9 |
+
"preview": "vite preview"
|
|
|
|
| 10 |
},
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"react": "^19.1.0",
|
| 13 |
+
"react-dom": "^19.1.0"
|
|
|
|
|
|
|
| 14 |
},
|
| 15 |
+
"devDependencies": {
|
| 16 |
+
"@types/node": "^22.14.0",
|
| 17 |
+
"typescript": "~5.7.2",
|
| 18 |
+
"vite": "^6.2.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
}
|
tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"target": "ES2020",
|
| 4 |
+
"experimentalDecorators": true,
|
| 5 |
+
"useDefineForClassFields": false,
|
| 6 |
+
"module": "ESNext",
|
| 7 |
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
| 8 |
+
"skipLibCheck": true,
|
| 9 |
+
|
| 10 |
+
/* Bundler mode */
|
| 11 |
+
"moduleResolution": "bundler",
|
| 12 |
+
"allowImportingTsExtensions": true,
|
| 13 |
+
"isolatedModules": true,
|
| 14 |
+
"moduleDetection": "force",
|
| 15 |
+
"noEmit": true,
|
| 16 |
+
"allowJs": true,
|
| 17 |
+
"jsx": "react-jsx",
|
| 18 |
+
|
| 19 |
+
/* Linting */
|
| 20 |
+
"strict": true,
|
| 21 |
+
"noUnusedLocals": true,
|
| 22 |
+
"noUnusedParameters": true,
|
| 23 |
+
"noFallthroughCasesInSwitch": true,
|
| 24 |
+
"noUncheckedSideEffectImports": true,
|
| 25 |
+
|
| 26 |
+
"paths": {
|
| 27 |
+
"@/*" : ["./*"]
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
vite.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'path';
|
| 2 |
+
import { defineConfig, loadEnv } from 'vite';
|
| 3 |
+
|
| 4 |
+
export default defineConfig(({ mode }) => {
|
| 5 |
+
const env = loadEnv(mode, '.', '');
|
| 6 |
+
return {
|
| 7 |
+
define: {
|
| 8 |
+
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
| 9 |
+
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
|
| 10 |
+
},
|
| 11 |
+
resolve: {
|
| 12 |
+
alias: {
|
| 13 |
+
'@': path.resolve(__dirname, '.'),
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
};
|
| 17 |
+
});
|