Share an event with a link #26
Labels
No labels
bug
chore
data
feature
frontend
good first issue
intermediate
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/cal#26
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Students want to send an event to a friend. Add a "Copy link" button to the event popover, and a new
/events/[id]page that shows that event when the link is opened.What you'll learn
Next.js dynamic routes, fetching from our API, and the browser clipboard API.
Resources
Where to start
web/src/app/components/EventPopover.tsxandModalEvent.tsx: add the button next to "Add". The event id iseventDetails.id.web/src/app/events/[id]/page.tsx: new page. Read the id withuseParams()fromnext/navigationin a client component.api/app/api/events.py,get_specific_events:GET /api/events/<int:event_id>already exists and is@public. It returns every event column plusorg(host name),user_saved, anduser_is_admin.ModalEvent.tsxshows how to call it.GET /api/events/<id>/tagsreturns the tags.Done when
${window.location.origin}/events/<id>withnavigator.clipboard.writeTextand shows a brief "Copied!" state/events/<id>shows title, time, location, host, description, tags, and the Add/Remove buttonNotes
web/src/app/layout.tsxshows the sign-in page for every route when signed out, andWelcome.tsxhardcodessignInUrl("/"). Pass the current path instead. The link points at the event series, not a single occurrence.