Skip to content
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

Add a feature to link calendar events to their details page #55

Open
ATechAdventurer opened this issue May 9, 2023 · 0 comments
Open
Assignees

Comments

@ATechAdventurer
Copy link
Member

In this ticket, we will update the Index component to add a url property to each calendar event. This will allow users to click on a calendar event and navigate to its corresponding details page. The url property will be set as /events/{calEvent.id} where {calEvent.id} is the unique identifier of the event.

Index Component:

  1. Locate the getServerSideProps function in the index.tsx file.

  2. Modify the fullCalEvent object within the map function to include the url property. Set the url property to /events/{calEvent.id}:

export const getServerSideProps: GetServerSideProps = async () => {
  const events = await prisma.event.findMany({});
  const conformedEvents = events.map((calEvent) => {
    const fullCalEvent: EventInput = {
      title: calEvent.title,
      start: calEvent.startTime.toISOString(),
      end: calEvent.endTime.toISOString(),
      url: `/events/${calEvent.id}`,
    };
    return fullCalEvent;
  });
  return {
    props: {
      events: conformedEvents,
    },
  };
};

By adding the url property to each fullCalEvent object, clicking on a calendar event will now navigate the user to the corresponding event details page with the URL format /events/{calEvent.id}.

@alessioharo alessioharo self-assigned this May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants