This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/App.tsx | |
import React from "react"; | |
import { Box, CssBaseline, ThemeProvider } from "@mui/material"; | |
import { createTheme } from "@mui/material/styles"; | |
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; | |
import { routes as appRoutes } from "./routes"; | |
import Navbar from "./components/Navbar"; | |
import Footer from "./components/Footer"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const aws = require("aws-sdk"); | |
const sharp = require("sharp"); | |
const s3 = new aws.S3(); | |
exports.handler = async function (event, context) { | |
console.log("Received S3 event:", JSON.stringify(event, null, 2)); | |
if (event.Records[0].eventName === "ObjectRemoved:Delete") { | |
return; | |
} | |
const bucket = event.Records[0].s3.bucket.name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Auth, Amplify } from "aws-amplify"; | |
//configure amplify | |
import awsconfig from './aws-exports'; | |
Auth.configure(awsconfig); | |
Amplify.configure(awsconfig); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import analytics | |
import { Analytics } from "aws-amplify"; | |
// record searched word in Analytics | |
const recordWordInAnalytics = (searchWord: string) => { | |
if (searchWord !== "") { | |
const lowerCaseWord = searchWord?.toLowerCase(); | |
console.log("recordWordInAnalytics: ", lowerCaseWord); | |
try { | |
Analytics.record({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const searchDefinitions = async () => { | |
... | |
recordWordInAnalytics(searchInput); // call the function to record search event | |
const response = await fetch( | |
`https://api.dictionaryapi.dev/api/v2/entries/en/${searchInput}`, | |
{ | |
method: "GET", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { Auth, Hub } from "aws-amplify"; | |
import LoadingSpinner from "../components/LoadingSpinner"; | |
export interface IAuthContextType { | |
user: any; | |
isAuthenticated: boolean; | |
isAuthenticating: boolean; | |
unverifiedAccount: { email: string; password: string }; | |
signIn: (p: { email: string; password: string }) => Promise<any>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useContext} from "react"; | |
import {AuthContext, IAuthContextType} from "../contexts/AuthContext"; | |
const useAuth = () => useContext(AuthContext) as IAuthContextType; | |
export default useAuth; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import aws amplify | |
import { Amplify } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
// configure amplify | |
Amplify.configure(awsExports); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { createRoot } from "react-dom/client"; | |
import CssBaseline from "@mui/material/CssBaseline"; | |
import { ThemeProvider } from "@mui/material/styles"; | |
import App from "./App"; | |
import theme from "./theme"; | |
// import aws amplify | |
import { Amplify } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
import AuthProvider from "./contexts/AuthContext"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
. | |
import { useNavigate } from "react-router-dom"; | |
import useAuth from "../hooks/useAuth"; | |
import { useEffect } from "react"; | |
import LoadingSpinner from "../components/LoadingSpinner"; | |
export default function SignUp() { | |
. | |
. |