diff --git a/## GitHub Copilot Chat.md b/## GitHub Copilot Chat.md new file mode 100644 index 00000000..abc1cd42 --- /dev/null +++ b/## GitHub Copilot Chat.md @@ -0,0 +1,36 @@ +## GitHub Copilot Chat + +- Extension Version: 0.23.2 (prod) +- VS Code: vscode/1.96.4 +- OS: Linux + +## Network + +User Settings: +```json + "github.copilot.advanced.debug.useElectronFetcher": true, + "github.copilot.advanced.debug.useNodeFetcher": false, + "github.copilot.advanced.debug.useNodeFetchFetcher": true +``` + +Connecting to https://api.github.com: +- DNS ipv4 Lookup: timed out after 10 seconds +- DNS ipv6 Lookup: Error (8 ms): getaddrinfo ENOTFOUND api.github.com +- Proxy URL: None (2 ms) +- Electron fetch (configured): timed out after 10 seconds +- Node.js https: timed out after 10 seconds +- Node.js fetch: timed out after 10 seconds +- Helix fetch: timed out after 10 seconds + +Connecting to https://api.individual.githubcopilot.com/_ping: +- DNS ipv4 Lookup: timed out after 10 seconds +- DNS ipv6 Lookup: timed out after 10 seconds +- Proxy URL: None (16 ms) +- Electron fetch (configured): timed out after 10 seconds +- Node.js https: timed out after 10 seconds +- Node.js fetch: timed out after 10 seconds +- Helix fetch: timed out after 10 seconds + +## Documentation + +In corporate networks: [Troubleshooting firewall settings for GitHub Copilot](https://docs.github.com/en/copilot/troubleshooting-github-copilot/troubleshooting-firewall-settings-for-github-copilot). \ No newline at end of file diff --git a/.codesandbox/tasks.json b/.codesandbox/tasks.json new file mode 100644 index 00000000..9a67839b --- /dev/null +++ b/.codesandbox/tasks.json @@ -0,0 +1,23 @@ +{ + // These tasks will run in order when initializing your CodeSandbox project. + "setupTasks": [ + { + "command": "pnpm install", + "name": "Installing Dependencies" + } + ], + + // These tasks can be run from CodeSandbox. Running one will open a log in the app. + "tasks": { + "start": { + "name": "start", + "command": "pnpm start", + "runAtStart": false + }, + "dev": { + "name": "dev", + "command": "pnpm dev", + "runAtStart": true + } + } +} diff --git a/.env b/.env new file mode 100644 index 00000000..452ec59d --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +API_="my secret api key from.env" +DATABASE_SE="super secret" \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f1ff414e..00000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -node_modules -.DS_Store -.env -.env.local -.env.development.local -.env.test.local -.env.production.local -package-lock.json \ No newline at end of file diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 00000000..959c5bd2 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,55 @@ +# To learn more about how to use Nix to configure your environment +# see: https://firebase.google.com/docs/studio/customize-workspace +{ ... }: { + # Which nixpkgs channel to use. + channel = "stable-24.05"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + # pkgs.go + # pkgs.python311 + # pkgs.python311Packages.pip + # pkgs.nodejs_20 + # pkgs.nodePackages.nodemon + ]; + + # Sets environment variables in the workspace + env = {}; + idx = { + # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" + extensions = [ + # "vscodevim.vim" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + # web = { + # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, + # # and show it in IDX's web preview panel + # command = ["npm" "run" "dev"]; + # manager = "web"; + # env = { + # # Environment variables to set for your server + # PORT = "$PORT"; + # }; + # }; + }; + }; + + # Workspace lifecycle hooks + workspace = { + # Runs when a workspace is first created + onCreate = { + # Example: install JS dependencies from NPM + # npm-install = "npm install"; + }; + # Runs when the workspace is (re)started + onStart = { + # Example: start a background task to watch and re-build backend code + # watch-backend = "npm run watch-backend"; + }; + }; + }; +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..fa18a53d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "start" + ], + "cwd": "${workspaceFolder}", + "internalConsoleOptions": "neverOpen" + }, + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..8277e5a8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "IDX.aI.enableInlineCompletion": true, + "IDX.aI.enableCodebaseIndexing": true, + "python-envs.defaultEnvManager": "ms-python.python:system", + "python-envs.pythonProjects": [] +} \ No newline at end of file diff --git a/1-multiplication.spec.js b/1-multiplication.spec.js new file mode 100644 index 00000000..ce7ef15d --- /dev/null +++ b/1-multiplication.spec.js @@ -0,0 +1,7 @@ +import { multiply } from './1-multiplication'; + +describe('multiplication', () => { + it('should multiply two numbers correctly', () => { + expect(multiply(2, 3)).toBe(6); + }); +}); \ No newline at end of file diff --git a/2-first-last.js b/2-first-last.js new file mode 100644 index 00000000..403a87dd --- /dev/null +++ b/2-first-last.js @@ -0,0 +1,4 @@ +export const firstLast = (items) => { + return 'First: ${items[0]}, Last: ${items[items[1]}' + +} \ No newline at end of file diff --git a/App.css b/App.css new file mode 100644 index 00000000..8d13b123 --- /dev/null +++ b/App.css @@ -0,0 +1,91 @@ +#root { + margin: 0 auto; + } +} +.App { + font-family: sans-serif; + text-align: center; +} +.input-container { + position: relative; +} +input { + border: 1px solid #e4e4e7; + padding: 0.5rem 0.5rem; + width: 320 - 1600px; +} +.error { + position: absolute; + top: 1.5rem; + left: 0; + color: red; +} + + body { + margin: 0; + font-family: "Montserrat"; + } + + h1, section, header { + padding: 2rem; + } + + .light { + background: aquamarine; + color: rgb(0, 24, 164); + } + + .dark { + background: rgb(0, 24, 164); + color: aquamarine; + } + + button { + padding: 18px; + border-radius: 30px; + border: 0; + background: hotpink; + color: white; + font-size: 16px; + font-weight: bold; + font-family: "Montserrat"; + margin-right: 0.5rem; + } + + select { + border: none; + border-radius: 4px; + color: rgb(0, 24, 164); + font-size: 16px; + font-weight: 600; + height: 40px; + font-family: 'Montserrat'; + padding: 0 20px; + cursor: pointer; + + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + } + + main { + padding: 2rem; + } + + .thought { + border: 2px solid blue; + padding: 1rem; + margin-bottom: 1rem; + } + + form { + display: flex; + flex-direction: column; + width: 200px; + padding-bottom: 2rem; + } + + textarea { + height: 100px; + margin-bottom: 1rem; + } \ No newline at end of file diff --git a/App.jsx b/App.jsx new file mode 100644 index 00000000..033b3f85 --- /dev/null +++ b/App.jsx @@ -0,0 +1,81 @@ +import { useState } from "react" +import { useEffect } from "react" +import { StrictMode } from 'react' + +import { Container, Typography } from "@mui/material"; + +import { createRoot } from 'react-dom/client' +import { Header } from "./Header" +import { ThoughtForm } from "./ThoughtForm" +import { ThoughtList } from "./ThoughtList" +import { ColorFilter } from "./ColorFilter" +import { ThoughtGrid } from "./ThoughtGrid" +import { LoadingSpinner } from "./LoadingSpinner"; +import { LoginForm } from "./LoginForm"; +import { SignupForm } from "./SignupForm"; +import { EditButton } from "./EditButton" +import { Form } from "./Form"; +import { Card } from "./Card"; +import { Index } from "./Index"; +import { Css } from "./Css"; +import { Animation } from "./Animation"; + + +// Removed duplicate declaration of App component +export const App = () => { + const [count, setCount] = useState(0); + + useEffect(() => { + const handleScroll = () => { + console.log('scrolled!'); + }; + + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + useEffect(() => { + const controller = new AbortController(); + + fetch('https://happy-thoughts-ux7hkzgmwa-uc.a.run.app/thoughts', { signal: controller.signal }) + .then(response => response.json()) + .then(data => console.log(data)); + + const intervalId = setInterval(() => { + fetch('https://happy-thoughts-ux7hkzgmwa-uc.a.run.app/thoughts', { signal: controller.signal }) + .then(response => response.json()) + .then(data => console.log(data)); + + console.log('This runs every second'); + }, 1000); + + return () => { + clearInterval(intervalId); + controller.abort(); + }; + }, []); + return ( +
+ + + + + +

Count: {count}

+ {count > 140 &&

You hit 140!

} +
+ ); + }; + \ No newline at end of file diff --git a/App.tsx b/App.tsx new file mode 100644 index 00000000..213743f7 --- /dev/null +++ b/App.tsx @@ -0,0 +1,126 @@ +import React, { useState } from 'react'; +import { useEffect } from 'react'; +import Card from './Card.tsx'; +import './index.css' +import './components/Card.css' +import './components/Card.tsx' +import './components/Card.jsx' +import './components/form.jsx' +import './components/index.json' +import './components/main.tsx' +import './components/App.css' +import './components/App.js' +import './components/App.jsx' +import './components/index.css' +import './components/index.js' +import './components/tests.ts' +import './components/index.html' +import './components/tests.tsx' +import './form.css'; +// import { Form } from './form' // Removed as 'Form' is not exported from './form' +import './App.css'; +import './index.css'; +import { main } from './main.jsx'; +import Main from './main.tsx'; + +fetch ("https://happy-thoughts-ux7hkzgmwa-uc.a.run.app/thoughts") +fetch ("https://happy-thoughts-ux7hkzgmwa-uc.a.run.app/thoughts/THOUGHT_ID/like") +const [thoughts, setThoughts] = useState<{ message: string }[]>([]) +const handleFormSubmit = (event) => { + event.preventDefault() + fetch("", { + method: "POST", + body: JSON.stringify({ + message: "Hello world", + }), + headers: { "Content-Type": "application/json" }, + }) + .then((res) => res.json()) + .then((newThought) => { + setThoughts((previousThoughts) => [newThought, ...previousThoughts]) + }) +} + + +// if creating a Review as an object +interface Review { + id: number; + text: string; + dessert: string; +} + +const App = () => { + const [selectedCard, setSelectedCard] = useState(''); + const [reviews, setReviews] = useState([]); // if implementing an array of reviews + const [review, setReview] = useState(''); // if implementing one review only, as string. + const [reviewText, setReviewText] = useState(''); + + const handleCardSelect = (title: string) => { + setSelectedCard(title); + }; + + // setting a signle review as a text, then clearing the text area + const handleReviewSubmit = (e: React.FormEvent) => { + e.preventDefault(); // stop from doing its default re render here. + setReview(reviewText); + setReviewText(''); + }; + + return ( +
+
+ handleCardSelect("Message App")} + /> +
+ + +
+

Write a message

+
+