Feature/posts#1
Conversation
cjdeleon62
left a comment
There was a problem hiding this comment.
Great first PR! A lot of changes so I'm sorry if I missed anything. Left some questions but feel free to leave any questions you have in any threads or just reach out on discord
| const { title, authors, media, publishedOn, text, slug, className } = props; | ||
|
|
||
| return ( | ||
| <article |
There was a problem hiding this comment.
good use of semantic html 👍
| }; | ||
|
|
||
| export const BlogCard: React.FC<Props> = (props) => { | ||
| const { title, authors, media, publishedOn, text, slug, className } = props; |
There was a problem hiding this comment.
one small nit:
we can destructure this in the function definition:
export const BlogCard: React.FC<Props> = ({ title, authors, media, publishedOn, text, slug, className }) => {
| </Link> | ||
| <div className="flex flex-col gap-2"> | ||
| <div className="flex flex-wrap gap-4"> | ||
| {authors.map(({ id, name, photo }) => ( |
There was a problem hiding this comment.
wondering if we can make this its own component to keep files relatively small?
| @@ -1,5 +1,5 @@ | |||
| .richText { | |||
| text-align: center; // hack but whatever | |||
| // text-align: center; // hack but whatever | |||
There was a problem hiding this comment.
just wondering if this is something we want to do here? If possible, could we leave it and just override with tailwind css styling?
| @@ -0,0 +1,97 @@ | |||
| import { Fragment } from "react"; | |||
There was a problem hiding this comment.
nit: a cool updated React thing is that we can use <></> instead of <Fragment></Fragment>
| import Link from "next/link"; | ||
|
|
||
| import "./app.scss"; | ||
| // import "./app.scss"; |
There was a problem hiding this comment.
if we don't need this we can def delete it
| if (doc?.authors) { | ||
| const authorDocs = await Promise.all( | ||
| doc.authors.map( | ||
| async (author) => |
There was a problem hiding this comment.
is there any issues where the author can be something other than an object? Wondering if there's a way we can ensure that it's always an object
| import { checkRole } from "../collections/Users/checkRole"; | ||
|
|
||
| export const adminsAndPublished: Access = ({ req: { user } }) => { | ||
| if (user && checkRole(["admin"], user)) { |
There was a problem hiding this comment.
would we be able to reuse the isAdmin function here?
|
|
||
| export const adminsAndSelf: Access = ({ req: { user } }) => { | ||
| if (user) { | ||
| if (checkRole(["admin"], user)) { |
There was a problem hiding this comment.
same question about this using isAdmin
| ): boolean => { | ||
| if (user) { | ||
| if ( | ||
| allRoles.some((role) => { |
There was a problem hiding this comment.
nit:
what do you think about using Array.prototype.every() here?
const matchesAllRoles = allRoles.every((role) => user?.roles?.includes(role));
return matchesAllRoles;
| @@ -0,0 +1,14 @@ | |||
| export const formatDateTime = (timestamp: string): string => { | |||
| const now = new Date(); | |||
| let date = now; | |||
There was a problem hiding this comment.
do we need the const now = new Date()?
could we just do let date = new Date();
No description provided.