diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 31d12f2..bb102d2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,6 +4,7 @@ on: push: branches: - '*' + jobs: build: runs-on: ubuntu-latest @@ -15,14 +16,14 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '16' # Use Node.js 16.x + node-version: '20' # Use Node.js v20.x.x - name: Install pnpm run: npm install -g pnpm - name: Changing Directory - run: cd nepalingo-web - + run: cd nepalingo-web + - name: Install dependencies run: pnpm install @@ -30,4 +31,4 @@ jobs: run: pnpm run lint - name: Test Build - run: pnpm run build \ No newline at end of file + run: pnpm run build diff --git a/nepalingo-web/index.html b/nepalingo-web/index.html index e4b78ea..c7df76b 100644 --- a/nepalingo-web/index.html +++ b/nepalingo-web/index.html @@ -4,7 +4,8 @@ - Vite + React + TS + Nepalingo +
diff --git a/nepalingo-web/package.json b/nepalingo-web/package.json index 6d6ec09..baaead0 100644 --- a/nepalingo-web/package.json +++ b/nepalingo-web/package.json @@ -10,8 +10,12 @@ "preview": "vite preview" }, "dependencies": { + "@fortawesome/free-solid-svg-icons": "^6.5.2", + "@fortawesome/react-fontawesome": "^0.2.2", + "@supabase/supabase-js": "^2.44.2", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-router-dom": "^6.24.1" }, "devDependencies": { "@types/node": "^20.14.9", diff --git a/nepalingo-web/pnpm-lock.yaml b/nepalingo-web/pnpm-lock.yaml index 07631b4..522b935 100644 --- a/nepalingo-web/pnpm-lock.yaml +++ b/nepalingo-web/pnpm-lock.yaml @@ -8,12 +8,24 @@ importers: .: dependencies: + '@fortawesome/free-solid-svg-icons': + specifier: ^6.5.2 + version: 6.5.2 + '@fortawesome/react-fontawesome': + specifier: ^0.2.2 + version: 0.2.2(@fortawesome/fontawesome-svg-core@6.5.2)(react@18.3.1) + '@supabase/supabase-js': + specifier: ^2.44.2 + version: 2.44.2 react: specifier: ^18.3.1 version: 18.3.1 react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) + react-router-dom: + specifier: ^6.24.1 + version: 6.24.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) devDependencies: '@types/node': specifier: ^20.14.9 @@ -343,6 +355,24 @@ packages: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@fortawesome/fontawesome-common-types@6.5.2': + resolution: {integrity: sha512-gBxPg3aVO6J0kpfHNILc+NMhXnqHumFxOmjYCFfOiLZfwhnnfhtsdA2hfJlDnj+8PjAs6kKQPenOTKj3Rf7zHw==} + engines: {node: '>=6'} + + '@fortawesome/fontawesome-svg-core@6.5.2': + resolution: {integrity: sha512-5CdaCBGl8Rh9ohNdxeeTMxIj8oc3KNBgIeLMvJosBMdslK/UnEB8rzyDRrbKdL1kDweqBPo4GT9wvnakHWucZw==} + engines: {node: '>=6'} + + '@fortawesome/free-solid-svg-icons@6.5.2': + resolution: {integrity: sha512-QWFZYXFE7O1Gr1dTIp+D6UcFUF0qElOnZptpi7PBUMylJh+vFmIedVe1Ir6RM1t2tEQLLSV1k7bR4o92M+uqlw==} + engines: {node: '>=6'} + + '@fortawesome/react-fontawesome@0.2.2': + resolution: {integrity: sha512-EnkrprPNqI6SXJl//m29hpaNzOp1bruISWaOiRtkMi/xSvHJlzc2j2JAYS7egxt/EbjSNV/k6Xy0AQI6vB2+1g==} + peerDependencies: + '@fortawesome/fontawesome-svg-core': ~1 || ~6 + react: '>=16.3' + '@humanwhocodes/config-array@0.11.14': resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} @@ -397,6 +427,10 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@remix-run/router@1.17.1': + resolution: {integrity: sha512-mCOMec4BKd6BRGBZeSnGiIgwsbLGp3yhVqAD8H+PxiRNEHgDpZb8J1TnrSDlg97t0ySKMQJTHCWBCmBpSmkF6Q==} + engines: {node: '>=14.0.0'} + '@rollup/rollup-android-arm-eabi@4.18.0': resolution: {integrity: sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==} cpu: [arm] @@ -477,6 +511,28 @@ packages: cpu: [x64] os: [win32] + '@supabase/auth-js@2.64.2': + resolution: {integrity: sha512-s+lkHEdGiczDrzXJ1YWt2y3bxRi+qIUnXcgkpLSrId7yjBeaXBFygNjTaoZLG02KNcYwbuZ9qkEIqmj2hF7svw==} + + '@supabase/functions-js@2.4.1': + resolution: {integrity: sha512-8sZ2ibwHlf+WkHDUZJUXqqmPvWQ3UHN0W30behOJngVh/qHHekhJLCFbh0AjkE9/FqqXtf9eoVvmYgfCLk5tNA==} + + '@supabase/node-fetch@2.6.15': + resolution: {integrity: sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==} + engines: {node: 4.x || >=6.0.0} + + '@supabase/postgrest-js@1.15.7': + resolution: {integrity: sha512-TJztay5lcnnKuXjIO/X/aaajOsP8qNeW0k3MqIFoOtRolj5MEAIy8rixNakRk3o23eVCdsuP3iMLYPvOOruH6Q==} + + '@supabase/realtime-js@2.10.2': + resolution: {integrity: sha512-qyCQaNg90HmJstsvr2aJNxK2zgoKh9ZZA8oqb7UT2LCh3mj9zpa3Iwu167AuyNxsxrUE8eEJ2yH6wLCij4EApA==} + + '@supabase/storage-js@2.6.0': + resolution: {integrity: sha512-REAxr7myf+3utMkI2oOmZ6sdplMZZ71/2NEIEMBZHL9Fkmm3/JnaOZVSRqvG4LStYj2v5WhCruCzuMn6oD/Drw==} + + '@supabase/supabase-js@2.44.2': + resolution: {integrity: sha512-fouCwL1OxqftOwLNgdDUPlNnFuCnt30nS4kLcnTpe6NYKn1PmjxRRBFmKscgHs6FjWyU+32ZG4uBJ29+/BWiDw==} + '@tsconfig/node10@1.0.11': resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} @@ -510,6 +566,9 @@ packages: '@types/node@20.14.9': resolution: {integrity: sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==} + '@types/phoenix@1.6.5': + resolution: {integrity: sha512-xegpDuR+z0UqG9fwHqNoy3rI7JDlvaPh2TY47Fl80oq6g+hXT+c/LEuE43X48clZ6lOfANl5WrPur9fYO1RJ/w==} + '@types/prop-types@15.7.12': resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} @@ -519,6 +578,9 @@ packages: '@types/react@18.3.3': resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==} + '@types/ws@8.5.10': + resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} + '@typescript-eslint/eslint-plugin@7.14.1': resolution: {integrity: sha512-aAJd6bIf2vvQRjUG3ZkNXkmBpN+J7Wd0mfQiiVCJMu9Z5GcZZdcc0j8XwN/BM97Fl7e3SkTXODSk4VehUv7CGw==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1569,6 +1631,19 @@ packages: resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} engines: {node: '>=0.10.0'} + react-router-dom@6.24.1: + resolution: {integrity: sha512-U19KtXqooqw967Vw0Qcn5cOvrX5Ejo9ORmOtJMzYWtCT4/WOfFLIZGGsVLxcd9UkBO0mSTZtXqhZBsWlHr7+Sg==} + engines: {node: '>=14.0.0'} + peerDependencies: + react: '>=16.8' + react-dom: '>=16.8' + + react-router@6.24.1: + resolution: {integrity: sha512-PTXFXGK2pyXpHzVo3rR9H7ip4lSPZZc0bHG5CARmj65fTT6qG7sTngmb6lcYu1gf3y/8KxORoy9yn59pGpCnpg==} + engines: {node: '>=14.0.0'} + peerDependencies: + react: '>=16.8' + react@18.3.1: resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} @@ -1748,6 +1823,9 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + ts-api-utils@1.3.0: resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} engines: {node: '>=16'} @@ -1870,6 +1948,12 @@ packages: terser: optional: true + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} @@ -1905,6 +1989,18 @@ packages: wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + ws@8.17.1: + resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -2171,6 +2267,22 @@ snapshots: '@eslint/js@8.57.0': {} + '@fortawesome/fontawesome-common-types@6.5.2': {} + + '@fortawesome/fontawesome-svg-core@6.5.2': + dependencies: + '@fortawesome/fontawesome-common-types': 6.5.2 + + '@fortawesome/free-solid-svg-icons@6.5.2': + dependencies: + '@fortawesome/fontawesome-common-types': 6.5.2 + + '@fortawesome/react-fontawesome@0.2.2(@fortawesome/fontawesome-svg-core@6.5.2)(react@18.3.1)': + dependencies: + '@fortawesome/fontawesome-svg-core': 6.5.2 + prop-types: 15.8.1 + react: 18.3.1 + '@humanwhocodes/config-array@0.11.14': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -2229,6 +2341,8 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true + '@remix-run/router@1.17.1': {} + '@rollup/rollup-android-arm-eabi@4.18.0': optional: true @@ -2277,6 +2391,48 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.18.0': optional: true + '@supabase/auth-js@2.64.2': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/functions-js@2.4.1': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/node-fetch@2.6.15': + dependencies: + whatwg-url: 5.0.0 + + '@supabase/postgrest-js@1.15.7': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/realtime-js@2.10.2': + dependencies: + '@supabase/node-fetch': 2.6.15 + '@types/phoenix': 1.6.5 + '@types/ws': 8.5.10 + ws: 8.17.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@supabase/storage-js@2.6.0': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/supabase-js@2.44.2': + dependencies: + '@supabase/auth-js': 2.64.2 + '@supabase/functions-js': 2.4.1 + '@supabase/node-fetch': 2.6.15 + '@supabase/postgrest-js': 1.15.7 + '@supabase/realtime-js': 2.10.2 + '@supabase/storage-js': 2.6.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + '@tsconfig/node10@1.0.11': {} '@tsconfig/node12@1.0.11': {} @@ -2314,6 +2470,8 @@ snapshots: dependencies: undici-types: 5.26.5 + '@types/phoenix@1.6.5': {} + '@types/prop-types@15.7.12': {} '@types/react-dom@18.3.0': @@ -2325,6 +2483,10 @@ snapshots: '@types/prop-types': 15.7.12 csstype: 3.1.3 + '@types/ws@8.5.10': + dependencies: + '@types/node': 20.14.9 + '@typescript-eslint/eslint-plugin@7.14.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.5.2))(eslint@8.57.0)(typescript@5.5.2)': dependencies: '@eslint-community/regexpp': 4.11.0 @@ -3528,6 +3690,18 @@ snapshots: react-refresh@0.14.2: {} + react-router-dom@6.24.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + dependencies: + '@remix-run/router': 1.17.1 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-router: 6.24.1(react@18.3.1) + + react-router@6.24.1(react@18.3.1): + dependencies: + '@remix-run/router': 1.17.1 + react: 18.3.1 + react@18.3.1: dependencies: loose-envify: 1.4.0 @@ -3780,6 +3954,8 @@ snapshots: dependencies: is-number: 7.0.0 + tr46@0.0.3: {} + ts-api-utils@1.3.0(typescript@5.5.2): dependencies: typescript: 5.5.2 @@ -3898,6 +4074,13 @@ snapshots: '@types/node': 20.14.9 fsevents: 2.3.3 + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + which-boxed-primitive@1.0.2: dependencies: is-bigint: 1.0.4 @@ -3956,6 +4139,8 @@ snapshots: wrappy@1.0.2: {} + ws@8.17.1: {} + yallist@3.1.1: {} yaml@2.4.5: {} diff --git a/nepalingo-web/postcss.config.js b/nepalingo-web/postcss.config.js index 827a827..af86863 100644 --- a/nepalingo-web/postcss.config.js +++ b/nepalingo-web/postcss.config.js @@ -1,9 +1,3 @@ -// Using cjs instead of this file because vite is still using postcss-load-config v4 which -// does not support esm with typescript -// https://github.com/postcss/postcss-load-config/issues/239 (fix added in v4) -// https://github.com/vitejs/vite/issues/15869#issuecomment-1939414914 -// https://github.com/vitejs/vite/pull/15235 - export const plugins = { tailwindcss: {}, autoprefixer: {}, diff --git a/nepalingo-web/src/App.tsx b/nepalingo-web/src/App.tsx index ff6a37a..8e7d677 100644 --- a/nepalingo-web/src/App.tsx +++ b/nepalingo-web/src/App.tsx @@ -1,12 +1,56 @@ -import React from "react"; +import React, { useState, useEffect } from "react"; +import { + BrowserRouter as Router, + Route, + Routes, + Navigate, +} from "react-router-dom"; +import User_auth from "./components/userAuth/UserAuth"; +import Home from "./pages/Home/Home"; import Header from "./components/Header"; +import supabase from "./components/userAuth/supabaseClient"; + +const App: React.FC = () => { + const [isAuthenticated, setIsAuthenticated] = useState(false); + + // useEffect to check the current session and subscribe to authentication state changes + useEffect(() => { + // Function to fetch the current session + const fetchSession = async () => { + const { + data: { session }, + } = await supabase.auth.getSession(); + setIsAuthenticated(!!session); // Update authentication state + }; + + fetchSession(); // Initial session fetch + + // Subscribe to authentication state changes + const { + data: { subscription }, + } = supabase.auth.onAuthStateChange((_event, session) => { + setIsAuthenticated(!!session); // Update authentication state on changes + }); + + // Cleanup subscription on component unmount + return () => subscription.unsubscribe(); + }, []); -function App() { return ( - <> -
- + + + } /> + } /> + {/* Protect the /home route, redirect to /login if not authenticated */} + : } + /> + {/* Default route redirects to /login */} + } /> + + ); -} +}; export default App; diff --git a/nepalingo-web/src/components/userAuth/UserAuth.tsx b/nepalingo-web/src/components/userAuth/UserAuth.tsx new file mode 100644 index 0000000..78820d1 --- /dev/null +++ b/nepalingo-web/src/components/userAuth/UserAuth.tsx @@ -0,0 +1,181 @@ +import React, { useState } from "react"; +import supabase from "./supabaseClient"; +import { useNavigate } from "react-router-dom"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faUser, + faEnvelope, + faLock, + faEye, + faEyeSlash, +} from "@fortawesome/free-solid-svg-icons"; + +const User_auth: React.FC = () => { + const [action, setAction] = useState<"Sign Up" | "Log In">("Sign Up"); + const [username, setUsername] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(null); + const [success, setSuccess] = useState(false); + const [showPassword, setShowPassword] = useState(false); + const navigate = useNavigate(); + + // Function to handle form submission + const handleSubmit = async () => { + setError(null); + setSuccess(false); + + if (username == "") { + setError("Please enter a username"); + return; + } + + if (action === "Sign Up" && username != "") { + // Attempt to sign up the user with the provided email and password + const { error } = await supabase.auth.signUp({ + email, + password, + options: { + data: { + // Store the username in the user metadata + username: username, + }, + }, + }); + + if (error) { + // If there is an error during sign up, set the error message + setError(error.message); + } else { + // If sign up is successful, set success to true + setSuccess(true); + } + } else { + // Attempt to log in the user with the provided email and password + const { data, error } = await supabase.auth.signInWithPassword({ + email, + password, + }); + + if (error) { + // If there is an error during log in, set the error message + setError(error.message); + } else { + const { user } = data; + if (user) { + const { user_metadata } = user; + // Navigate to home page with the username passed as state + navigate("/home", { state: { username: user_metadata.username } }); + } + } + } + }; + + // Function to handle changing between Sign Up and Log In actions + const handleActionChange = (newAction: "Sign Up" | "Log In") => { + setAction(newAction); + setError(null); + setSuccess(false); + }; + + return ( +
+
+ {/* Header */} +
+
{action}
+
+
+ + {/* Input fields */} +
+ {action === "Log In" ? null : ( +
+ + setUsername(e.target.value)} + className="w-full h-full bg-transparent border-none outline-none text-gray-800 placeholder-gray-500 p-2" + /> +
+ )} + +
+ + setEmail(e.target.value)} + className="w-full h-full bg-transparent border-none outline-none text-gray-800 placeholder-gray-500 p-2" + /> +
+ +
+ + setPassword(e.target.value)} + className="w-full h-full bg-transparent border-none outline-none text-gray-800 placeholder-gray-500 p-2" + /> + setShowPassword(!showPassword)} + /> +
+
+ + {action === "Log In" ? null : ( +
+ + Forgot Password? + +
+ )} + + {/* Action buttons */} +
+
{ + if (action === "Sign Up") handleSubmit(); + else handleActionChange("Sign Up"); + }} + > + Sign Up +
+
{ + if (action === "Log In") handleSubmit(); + else handleActionChange("Log In"); + }} + > + Log In +
+
+ {error &&

{error}

} + {success && action === "Sign Up" && ( +

+ Sign up successful! Please check your email to confirm. +

+ )} +
+
+ ); +}; + +export default User_auth; diff --git a/nepalingo-web/src/components/userAuth/supabaseClient.ts b/nepalingo-web/src/components/userAuth/supabaseClient.ts new file mode 100644 index 0000000..e5de814 --- /dev/null +++ b/nepalingo-web/src/components/userAuth/supabaseClient.ts @@ -0,0 +1,7 @@ +import { createClient } from '@supabase/supabase-js'; + +const supabaseUrl = 'https://iupkdpieqxplryytuerr.supabase.co'; +const supabaseKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Iml1cGtkcGllcXhwbHJ5eXR1ZXJyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTk1NDY4MTEsImV4cCI6MjAzNTEyMjgxMX0.FcvSaML1Z0KLzXWAfXI-xL4b9aGc179uI8Bo2Q_glPI'; +const supabase = createClient(supabaseUrl, supabaseKey); + +export default supabase; diff --git a/nepalingo-web/src/pages/Home/Home.tsx b/nepalingo-web/src/pages/Home/Home.tsx new file mode 100644 index 0000000..f9c0c28 --- /dev/null +++ b/nepalingo-web/src/pages/Home/Home.tsx @@ -0,0 +1,37 @@ +import React from "react"; +import { useLocation } from "react-router-dom"; + +const Home: React.FC = () => { + const location = useLocation(); + const username = location.state?.username; + + return ( +
+
+

+ Hello {username}, welcome to Nepalingo! +

+
+
+
+ Logo +
+
+

Nepalingo

+
+
+

+ Learn indigenous languages of Nepal for free +

+
+
+
+ + Coming soon! + +
+
+ ); +}; + +export default Home; diff --git a/nepalingo-web/src/pages/Home/home.ts b/nepalingo-web/src/pages/Home/home.ts deleted file mode 100644 index e69de29..0000000 diff --git a/nepalingo-web/vite.config.ts b/nepalingo-web/vite.config.ts index 60c4941..805af70 100644 --- a/nepalingo-web/vite.config.ts +++ b/nepalingo-web/vite.config.ts @@ -16,4 +16,4 @@ export default defineConfig({ "@": resolve(__dirname, "src"), }, }, -}); +}); \ No newline at end of file