@saltnburnem
#MWTC | #DeveloperCommunity
🛸
🛸
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
REDACTED
REDACTED
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
The React Framework for the Web
Built-in Optimizations
Dynamic HTML Streaming
React Server Components
Route Handlers
Server Actions
npx create-next-app@latest#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
The world's most popular document database
Document Model
Flexible Schema
Distributed and Resilient
Â
Horizontally Scale
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
All-in-one platform to build, deploy, manage, and extend modern web apps
Preview URLs for sharing work in progress
Security Tools
Monitoring for performance, visitor traffic, and behavior.
Custom Serverless Forms
Netlify MCP Server
#MWTC | #DeveloperCommunity
So Much More!
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
👽
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
npx create-next-app --example with-mongodb close-encounters#MWTC | #DeveloperCommunity
@saltnburnem
npx create-next-app --example with-mongodb close-encounterscd close-encounters
npm install
npm run dev#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
Components
EncounterCard
Header
EncounterCard.tsx
Header.tsx
#MWTC | #DeveloperCommunity
@saltnburnem
import Head from "next/head";
import clientPromise from "../lib/mongodb";
import type { InferGetServerSidePropsType, GetServerSideProps } from "next";
import Container from '@mui/material/Container';
import Box from '@mui/material/Box';
import Header from '../components/Header/Header';
import EncounterCard from '../components/EncounterCard/EncounterCard';
import TextField from '@mui/material/TextField';
import { useState } from "react";
import Typography from "@mui/material/Typography";#MWTC | #DeveloperCommunity
@saltnburnem
type Encounter = {
_id: string;
name: string;
location: string;
close_encounter_level: string;
extraterrestrial_type: string;
image: string;
url: string;
};#MWTC | #DeveloperCommunity
@saltnburnem
type IndexProps = {
isConnected: boolean;
encounters: Encounter[];
};#MWTC | #DeveloperCommunity
@saltnburnem
export const getServerSideProps: GetServerSideProps<
IndexProps
> = async () => {
try {
await clientPromise;
const client = await clientPromise;
const db = client.db("ufos");
const encounters = await db
.collection("sightings-encounters")
.find({})
.limit(30)
.toArray();
return {
props: { isConnected: true, encounters: JSON.parse(JSON.stringify(encounters)) }
};
} catch (e) {
console.error(e);
return {
props: { isConnected: false, encounters: [] },
};
}
};#MWTC | #DeveloperCommunity
@saltnburnem
export default function Home({
encounters
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
const [search, setSearch] = useState("");
console.log(search);
const filterEncounters = (encounter: Encounter) => {
return encounter.name.toLowerCase().includes(search.toLowerCase()) || encounter.location.toLowerCase().includes(search.toLowerCase());
}
const filteredEncounters = encounters.filter(filterEncounters);
return (
<>
<Head>
<title>UFO Encounters and Sightings</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<Header />
<Container maxWidth="lg">
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', paddingTop: '5rem' }}
component="form"
sx={{
'& > :not(style)': { m: 1, width: '50ch', fontWeight: 'bold' },
}}
noValidate
autoComplete="off"
>
<TextField onChange={(e) => setSearch(e.target.value)} id="outlined-basic" label="Search for UFO Sightings" variant="outlined" />
<Typography variant="body2" color="text.secondary">
*This is a list of some sample data of UFO/UAPUSO abductions and sightings in the United States. Search for an encounter by name or location.
</Typography>
</Box >
<main>
<Box display="grid" gridTemplateColumns="repeat(3, 1fr)" gap={4}>
<EncounterCard encounters={filteredEncounters} />
</Box>
</main>
</Container >
<footer>
<a
href="https://www.digitalocean.com/"
target="_blank"
rel="noopener noreferrer"
>
Powered by{" "}
<img src="/do-blue-h-logo.png" alt="DigitalOcean Logo" className="logo" />
</a>
</footer>
</>
);
}#MWTC | #DeveloperCommunity
@saltnburnem
import * as React from 'react';
import AppBar from '@mui/material/AppBar';
import Box from '@mui/material/Box';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';#MWTC | #DeveloperCommunity
@saltnburnem
import * as React from 'react';
import AppBar from '@mui/material/AppBar';
import Box from '@mui/material/Box';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';const Header = () => {
return (
<Box sx={{ flexGrow: 1 }}>
<AppBar position="static" sx={{ backgroundColor: '#00ff60' }}>
<Toolbar variant="dense">
<Typography variant="h6" component="div" sx={{ flexGrow: 1, color: 'black' }}>
UFO Encounters & Abductions
</Typography>
</Toolbar>
</AppBar>
</Box>
);
}
export default Header;#MWTC | #DeveloperCommunity
@saltnburnem
const Header = () => {
return (
<Box sx={{ flexGrow: 1 }}>
<AppBar position="static" sx={{ backgroundColor: '#00ff60' }}>
<Toolbar variant="dense">
<Typography variant="h6" component="div" sx={{ flexGrow: 1, color: 'black' }}>
UFO Encounters & Abductions
</Typography>
</Toolbar>
</AppBar>
</Box>
);
}
export default Header;#MWTC | #DeveloperCommunity
@saltnburnem
import * as React from 'react';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Typography from '@mui/material/Typography';
import Link from '@mui/material/Link';#MWTC | #DeveloperCommunity
@saltnburnem
import * as React from 'react';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Typography from '@mui/material/Typography';
import Link from '@mui/material/Link';type Encounter = {
_id: string;
name: string;
location: string;
close_encounter_level: string;
extraterrestrial_type: string;
image: string;
url: string;
};
interface EncounterProps {
encounters: Encounter[];
}#MWTC | #DeveloperCommunity
@saltnburnem
type Encounter = {
_id: string;
name: string;
location: string;
close_encounter_level: string;
extraterrestrial_type: string;
image: string;
url: string;
};
interface EncounterProps {
encounters: Encounter[];
}#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity
@saltnburnem
🛸
#MWTC | #DeveloperCommunity
@saltnburnem
#MWTC | #DeveloperCommunity