Skip to content

refactor Event Schedule UI for new design + add personal schedule #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 74 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
ce1979d
add arrow to messagebox
igachmovmelon Mar 29, 2021
05887d2
Schedule for demo
igachmovmelon Apr 2, 2021
b3636b7
Chatbox from staging
igachmovmelon Apr 2, 2021
6b6c57b
sticky rooms
igachmovmelon Apr 2, 2021
5717560
showing time
igachmovmelon Apr 2, 2021
545575b
merge
igachmovmelon Apr 2, 2021
a6cd04b
Remove unused/old schedule components
sunny-viktoryia May 4, 2021
020e7e5
Base Schedule functionality
sunny-viktoryia May 4, 2021
d97a828
Save events to the database; refactor the code
sunny-viktoryia May 5, 2021
b578f71
Use z-index helper
sunny-viktoryia May 5, 2021
cc504ba
Return EventDisplay to its staging state
sunny-viktoryia May 5, 2021
32efd49
Remove unused utils/time functions
sunny-viktoryia May 6, 2021
4620ee6
Improve utils/time functions
sunny-viktoryia May 6, 2021
6c79ed9
Refactor SchedulePageModal component
sunny-viktoryia May 6, 2021
a15ab35
Remove unused utils/time functions
sunny-viktoryia May 6, 2021
c711c1d
Use isEventLive function from utils/event instead of creating a dupli…
sunny-viktoryia May 6, 2021
9fce282
Simplify SchedulePageModal logic
sunny-viktoryia May 6, 2021
bd69d2a
Use unixTime functions instead of manual operations with ONE_SECOND_I…
sunny-viktoryia May 7, 2021
5461bb1
Filter rooms building day schedule
sunny-viktoryia May 7, 2021
b5f6424
Rename day -> dayStart in the SchedulePageModal#schedule
sunny-viktoryia May 7, 2021
23f9399
Merge branch 'staging' into feature/schedule
mike-lvov May 7, 2021
06620c6
Refactor styles
sunny-viktoryia May 7, 2021
97450fe
Create types/schedule
sunny-viktoryia May 7, 2021
eedc4ab
Rename function that updates saved personalized events
sunny-viktoryia May 12, 2021
4b5062d
Fix ScheduleEvent stylings
sunny-viktoryia May 12, 2021
3773b54
Refactor personalized schedule
sunny-viktoryia May 12, 2021
ad87fa8
Renew style variables usage
sunny-viktoryia May 12, 2021
6872d59
Configure venue driven schedule
sunny-viktoryia May 13, 2021
7bccbd0
Remove isBookmarked useState
sunny-viktoryia May 13, 2021
f9a5a03
Make MyPersonalizedSchedule interface Partial<T>
sunny-viktoryia May 13, 2021
e8e72ac
Document deprecated EventDisplay component
sunny-viktoryia May 13, 2021
e5721d0
Move schedule constants to settings
sunny-viktoryia May 13, 2021
ec6f178
Use memo where requested
sunny-viktoryia May 13, 2021
90fcd9d
Use eachOfInterval to show schedule hour labels
sunny-viktoryia May 13, 2021
f746cd4
Separate adding and removing events (personalized schedule)
sunny-viktoryia May 13, 2021
9f5cb16
Rename old class name ScheduledEvents -> Schedule
sunny-viktoryia May 13, 2021
23f86ae
Move no-events message to Schedule component
sunny-viktoryia May 13, 2021
28b4cc2
Refactor Schedule components
sunny-viktoryia May 13, 2021
f92a651
Keep event objects immutable
sunny-viktoryia May 14, 2021
a04cf8f
Replace inlined style object by useCss hook
sunny-viktoryia May 14, 2021
e926cc4
Merge bookmarkEvent functions
sunny-viktoryia May 14, 2021
f347b80
Renamve ScheduleRoomEvents container class name
sunny-viktoryia May 14, 2021
1b5374a
Remove the code that is related to extending room approach
sunny-viktoryia May 14, 2021
2e96d5d
Refactor utils/time and utils/event
sunny-viktoryia May 14, 2021
3f5f7e7
Put venueId as props to ScheduleVenueDescription
sunny-viktoryia May 14, 2021
69f74f3
Refactor VenueEventDetails
sunny-viktoryia May 14, 2021
e380317
Remove RoomWithEvents type
sunny-viktoryia May 14, 2021
c43d2e6
Use default venue image
sunny-viktoryia May 14, 2021
78137c7
Rename SchedulePageModal -> NavBarSchedule
sunny-viktoryia May 14, 2021
d55f4a8
Move isEventLaterThisDay to utils/event
sunny-viktoryia May 14, 2021
a4704be
Fix undefined room titles
sunny-viktoryia May 14, 2021
d58d806
Close schedule modal only on click outside schedule area
sunny-viktoryia May 17, 2021
84c633a
Fixes in the Schedule
sunny-viktoryia May 17, 2021
f6812cf
Introduce line-clamp @mixin
sunny-viktoryia May 17, 2021
749fd0a
Rename moreThanHourLeftBeforeEventStarts -> isEventStartingSoon
sunny-viktoryia May 17, 2021
665b77b
Mark all utils/time constants as deprecated and add @dept comments to…
sunny-viktoryia May 17, 2021
0b6bf11
Add default venue name constant to settings
sunny-viktoryia May 17, 2021
81778da
Remove stopPropagation events in clickable Schedule areas
sunny-viktoryia May 17, 2021
8b3d927
Refactor getTimeBeforeParty
sunny-viktoryia May 17, 2021
799902a
Refactor isEventWithinDate()
sunny-viktoryia May 17, 2021
6d26a6f
Remove weekday property from ScheduleDay
sunny-viktoryia May 17, 2021
03d7830
Add a few comments
sunny-viktoryia May 18, 2021
367c7e8
Leave NavBarSchedule in NavBar only
sunny-viktoryia May 18, 2021
41bfff8
Move DEFAULT_VENUE_NAME to ScheduleVenueDescription
sunny-viktoryia May 18, 2021
ca1b2af
Reverse isEventStartingSoon logic
sunny-viktoryia May 18, 2021
1bc21ee
Add comment about NavBarSchedule class name
sunny-viktoryia May 18, 2021
bbb1862
Fix typo isPersonalizedEvent
sunny-viktoryia May 18, 2021
61c8d31
Refactor Schedule related components
sunny-viktoryia May 18, 2021
eaea734
Rename default label to ScheduleVenueDescription
sunny-viktoryia May 18, 2021
a37241a
Created NavBarSchedule container to distinguish in/out clicks
sunny-viktoryia May 18, 2021
aa7ef18
Create NavBarScheduleClassName const
sunny-viktoryia May 18, 2021
8a48aea
Merge branch 'staging' into feature/schedule
sunny-viktoryia May 18, 2021
959ba68
Use new hooks that fetch related venues
sunny-viktoryia May 18, 2021
df146ea
Add Loading component; fix the calculation for current time line posi…
sunny-viktoryia May 18, 2021
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
49 changes: 49 additions & 0 deletions src/api/profile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Bugsnag from "@bugsnag/js";
import firebase from "firebase/app";

import { VenueEvent } from "types/venues";

import { WithVenueId } from "utils/id";

export interface MakeUpdateUserGridLocationProps {
venueId: string;
userUid: string;
Expand Down Expand Up @@ -48,3 +52,48 @@ export const makeUpdateUserGridLocation = ({
firestore.doc(doc).set(newData);
});
};

export interface UpdatePersonalizedScheduleProps {
event: WithVenueId<VenueEvent>;
userId: string;
removeMode?: boolean;
}

export const addEventToPersonalizedSchedule = ({
event,
userId,
}: Omit<UpdatePersonalizedScheduleProps, "removeMode">): Promise<void> =>
updatePersonalizedSchedule({ event, userId });

export const removeEventFromPersonalizedSchedule = ({
event,
userId,
}: Omit<UpdatePersonalizedScheduleProps, "removeMode">): Promise<void> =>
updatePersonalizedSchedule({ event, userId, removeMode: true });

export const updatePersonalizedSchedule = async ({
event,
userId,
removeMode = false,
}: UpdatePersonalizedScheduleProps): Promise<void> => {
const userProfileRef = firebase.firestore().collection("users").doc(userId);

const modify = removeMode
? firebase.firestore.FieldValue.arrayRemove
: firebase.firestore.FieldValue.arrayUnion;

const newSavedEvents = {
[`myPersonalizedSchedule.${event.venueId}`]: modify(event.id),
};

return userProfileRef.update(newSavedEvents).catch((err) => {
Bugsnag.notify(err, (event) => {
event.addMetadata("context", {
location: "api/profile::saveEventToProfile",
userId,
event,
removeMode,
});
});
});
};
7 changes: 7 additions & 0 deletions src/components/molecules/EventDisplay/EventDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export interface EventDisplayProps {
venue?: WithId<AnyVenue>;
}

/**
* @dept the componnet is used in the OnlineStats and VenuePreview (Playa) which are to be removed as part of the Playa cleanup work.
*
* @see https://github.com/sparkletown/sparkle/pull/833
*
* @deprecated since https://github.com/sparkletown/sparkle/pull/1302 is merged; the component is replaced by ScheduleEvent
*/
export const EventDisplay: React.FC<EventDisplayProps> = ({ event, venue }) => {
const eventRoomTitle = event.room;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import React from "react";
import "firebase/functions";
import { Link } from "react-router-dom";

import { VenueEvent } from "types/venues";

import "./EventPaymentButton.scss";
import useConnectUserPurchaseHistory from "hooks/useConnectUserPurchaseHistory";
import { Link } from "react-router-dom";
import { hasUserBoughtTicketForEvent } from "utils/hasUserBoughtTicket";
import { isUserAMember } from "utils/isUserAMember";
import { canUserJoinTheEvent } from "utils/time";
import { useUser } from "hooks/useUser";
import { useSelector } from "hooks/useSelector";
import { isEventStartingSoon } from "utils/event";
import { WithId } from "utils/id";
import { venueEntranceUrl } from "utils/url";
import {
currentVenueSelectorData,
userPurchaseHistorySelector,
} from "utils/selectors";

import { useUser } from "hooks/useUser";
import { useSelector } from "hooks/useSelector";
import useConnectUserPurchaseHistory from "hooks/useConnectUserPurchaseHistory";

import "./EventPaymentButton.scss";

interface PropsType {
event: WithId<VenueEvent>;
venueId: string;
Expand Down Expand Up @@ -57,7 +59,7 @@ const EventPaymentButton: React.FunctionComponent<PropsType> = ({
<button
role="link"
className="btn btn-primary buy-tickets-button"
disabled={!canUserJoinTheEvent(event)}
disabled={!isEventStartingSoon(event)}
>
Join the event
</button>
Expand Down
51 changes: 0 additions & 51 deletions src/components/molecules/LiveSchedule/LiveSchedule.scss

This file was deleted.

65 changes: 0 additions & 65 deletions src/components/molecules/LiveSchedule/LiveSchedule.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/molecules/LiveSchedule/index.ts

This file was deleted.

Loading