Skip to content

Commit

Permalink
Bugfix events
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-petrov1 committed Apr 21, 2024
1 parent 1c62af8 commit 7e38cc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions client/src/pages/events-details/EventsDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IEvent } from '../../types/interfaces/events/IEvent';

function EventsDetails() {
const { id } = useParams();
const { user } = useAuthContext();
const { user, isAuthenticated, hasFinishedOAuth2 } = useAuthContext();
const [participatingUsers, setParticipatingUsers] = useState<IUser[]>([]);

const eventId = Number(id || -1);
Expand Down Expand Up @@ -102,7 +102,7 @@ function EventsDetails() {
</span>
<span className="text-truncate me-0">
<i className="fas fa-user text-primary me-2" />
People Going: {participatingUsers.length}
People Participating: {participatingUsers.length}
</span>
</div>
</div>
Expand All @@ -113,7 +113,11 @@ function EventsDetails() {
<button
className="btn btn-primary w-100"
disabled={
loadingEvent || loadingStatuses || participating
loadingEvent ||
loadingStatuses ||
participating ||
!isAuthenticated ||
!hasFinishedOAuth2
}
onClick={handleParticipation}>
{!participating
Expand All @@ -134,7 +138,7 @@ function EventsDetails() {
<div>
<div className="card-body">
<h5 className="d-flex align-items-center mb-3">
People Participating
People Participating: {participatingUsers.length}
</h5>
<div>
<div className="card d-flex row">
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/events/events-item/EventsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IEvent } from '../../../types/interfaces/events/IEvent';
export interface EventsItemProps extends IEvent {}

function EventsItem(props: EventsItemProps) {
const { isAuthenticated, user } = useAuthContext();
const { isAuthenticated, user, hasFinishedOAuth2 } = useAuthContext();

const [hasLiked, setHasLiked] = useState(
props.liked_users.some((x) => x.id === user.id)
Expand Down Expand Up @@ -65,7 +65,7 @@ function EventsItem(props: EventsItemProps) {
</div>
<div className="col-sm-12 col-md-4 d-flex flex-column align-items-start align-items-md-end justify-content-center">
<div className="d-flex mb-3">
{isAuthenticated && (
{isAuthenticated && hasFinishedOAuth2 && (
<a
className="btn btn-light btn-square me-3"
onClick={likeHandler}>
Expand Down

0 comments on commit 7e38cc3

Please sign in to comment.