Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frontend/src/components/ui/ActionButtonsPost.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useAuth } from '../../providers/AuthProviders';

export default function ActionButtonsPost({
classDefault,
classFocus,
Expand All @@ -9,9 +11,16 @@ export default function ActionButtonsPost({
onOpenComments,
}) {
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
const { currentUser } = useAuth();
const handleClick = (label) => {
if (label === 'comment') {
if (onOpenComments) {onOpenComments();}
if (onOpenComments) {
onOpenComments();
}
} else if (label === 'like') {
if (currentUser) {
setAction((prev) => !prev);
}
} else {
setAction((prev) => !prev);
}
Expand Down
Loading