-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Changed some UI in the post pages and cleaned up account page
- Loading branch information
Showing
20 changed files
with
814 additions
and
963 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import React from "react"; | ||
|
||
const Footer = () => { | ||
return ( | ||
<footer className="bg-gray-100 p-6 border-gray-300 border-t-2"> | ||
<div className="main"> | ||
<h3>© Daniel Medina 2021</h3> | ||
<p>Made with ❤️ and <a href="https://nextjs.org" className="text-blue-700">Next.js</a></p> | ||
</div> | ||
</footer> | ||
); | ||
return ( | ||
<footer className="bg-gray-100 p-6 border-gray-300 border-t-2"> | ||
<div className="main"> | ||
<h3>© Daniel Medina 2021</h3> | ||
<p> | ||
Made with ❤️ and{" "} | ||
<a href="https://nextjs.org" className="text-blue-700"> | ||
Next.js | ||
</a> | ||
</p> | ||
</div> | ||
</footer> | ||
); | ||
}; | ||
|
||
export default Footer; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,73 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import Link from "next/link"; | ||
import TimeAgo from 'react-timeago' | ||
import ReactTooltip from 'react-tooltip' | ||
import TimeAgo from "react-timeago"; | ||
import ReactTooltip from "react-tooltip"; | ||
|
||
const Users = () => { | ||
const [users, setUsers] = useState<Array<any>>([]); | ||
const [users, setUsers] = useState<Array<any>>([]); | ||
|
||
useEffect(() => { | ||
const get = async () => { | ||
const response = await fetch("/api/users"); | ||
const users = await response.json(); | ||
setUsers(users); | ||
}; | ||
get(); | ||
}, []); | ||
useEffect(() => { | ||
const get = async () => { | ||
const response = await fetch("/api/users"); | ||
const users = await response.json(); | ||
setUsers(users); | ||
}; | ||
get(); | ||
}, []); | ||
|
||
return ( | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 py-6"> | ||
{users.map((i) => { | ||
return ( | ||
<div | ||
className="user-container p-4 shadow-sm rounded-md border-gray-200 border-2 hover:bg-gray-100 flex justify-between items-center" | ||
key={i._id} | ||
> | ||
<Link href={`/users/${i.content}`}> | ||
<a> | ||
<div className="name cursor-pointer"> | ||
<h1 className="text-xl sm:text-2xl font-bold tracking-tighter hover:underline"> | ||
{i.content} | ||
</h1> | ||
<h2 className="text-sm sm:text-md" data-tip data-for={i._id}> | ||
Joined{" "} | ||
<TimeAgo date={i.date}></TimeAgo> | ||
</h2> | ||
<ReactTooltip getContent={() => new Date(i.date).toDateString()} id={i._id} type="info" /> | ||
</div> | ||
</a> | ||
</Link> | ||
<a href={`https://instagram.com/${i.content}`} rel="noreferrer" target="_blank"> | ||
<div className="link bg-blue-500 p-4 rounded-lg text-white"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
className="h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth={2} | ||
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" | ||
/> | ||
</svg> | ||
</div> | ||
<span className="hidden">{i.content}</span> | ||
</a> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
return ( | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 py-6"> | ||
{users.map((i) => { | ||
return ( | ||
<div | ||
className="user-container p-4 shadow-sm rounded-md border-gray-200 border-2 hover:bg-gray-100 flex justify-between items-center" | ||
key={i._id} | ||
> | ||
<Link href={`/users/${i.content}`}> | ||
<a> | ||
<div className="name cursor-pointer"> | ||
<h1 className="text-xl sm:text-2xl font-bold tracking-tighter hover:underline"> | ||
{i.content} | ||
</h1> | ||
<h2 className="text-sm sm:text-md" data-tip data-for={i._id}> | ||
Joined <TimeAgo date={i.date}></TimeAgo> | ||
</h2> | ||
<ReactToolip | ||
getContent={() => new Date(i.date).toDateString()} | ||
id={i._id} | ||
type="info" | ||
/> | ||
</div> | ||
</a> | ||
</Link> | ||
<a | ||
href={`https://instagram.com/${i.content}`} | ||
rel="noreferrer" | ||
target="_blank" | ||
> | ||
<div className="link bg-blue-500 p-4 rounded-lg text-white"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
className="h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth={2} | ||
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" | ||
/> | ||
</svg> | ||
</div> | ||
<span className="hidden">{i.content}</span> | ||
</a> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Users; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
// This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb | ||
import { MongoClient } from "mongodb" | ||
import { MongoClient } from "mongodb"; | ||
|
||
const uri = process.env.MONGODB_URI | ||
const uri = process.env.MONGODB_URI; | ||
const options = { | ||
useUnifiedTopology: true, | ||
useNewUrlParser: true, | ||
} | ||
}; | ||
|
||
let client | ||
let clientPromise | ||
let client; | ||
let clientPromise; | ||
|
||
if (!process.env.MONGODB_URI) { | ||
throw new Error("Please add your Mongo URI to .env.local") | ||
throw new Error("Please add your Mongo URI to .env.local"); | ||
} | ||
|
||
if (process.env.NODE_ENV === "development") { | ||
// In development mode, use a global variable so that the value | ||
// is preserved across module reloads caused by HMR (Hot Module Replacement). | ||
if (!global._mongoClientPromise) { | ||
client = new MongoClient(uri, options) | ||
global._mongoClientPromise = client.connect() | ||
client = new MongoClient(uri, options); | ||
global._mongoClientPromise = client.connect(); | ||
} | ||
clientPromise = global._mongoClientPromise | ||
clientPromise = global._mongoClientPromise; | ||
} else { | ||
// In production mode, it's best to not use a global variable. | ||
client = new MongoClient(uri, options) | ||
clientPromise = client.connect() | ||
client = new MongoClient(uri, options); | ||
clientPromise = client.connect(); | ||
} | ||
|
||
// Export a module-scoped MongoClient promise. By doing this in a | ||
// separate module, the client can be shared across functions. | ||
export default clientPromise | ||
export default clientPromise; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import nextConnect from 'next-connect' | ||
import multiparty from 'multiparty' | ||
import nextConnect from "next-connect"; | ||
import multiparty from "multiparty"; | ||
|
||
const middleware = nextConnect() | ||
const middleware = nextConnect(); | ||
|
||
middleware.use(async (req: any, res:any, next: any) => { | ||
const form = new multiparty.Form() | ||
middleware.use(async (req: any, res: any, next: any) => { | ||
const form = new multiparty.Form(); | ||
|
||
await form.parse(req, function (err: any, fields: any, files: any) { | ||
req.body = fields | ||
req.files = files | ||
next() | ||
}) | ||
}) | ||
req.body = fields; | ||
req.files = files; | ||
next(); | ||
}); | ||
}); | ||
|
||
export default middleware | ||
export default middleware; |
Oops, something went wrong.