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

"Back to calendar" link in event page when opened in new tab/window #306

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/client/calendar/events/event-details/EventDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import GoogleStaticMap from './GoogleStaticMap.jsx'
import AddressLink from './AddressLink.jsx'
import Icon from 'atoms/Icon.jsx'
import { getEventColor } from 'client/calendar/utils/event-colors.js'
import getCalendarSlug from 'client/calendar/utils/get-calendar-slug.js'
import { locationToAddressStr } from 'client/calendar/utils/location.js'
import { Statuses, EventTypes } from 'client/calendar/events/types.js'
import classnames from 'classnames'
Expand Down Expand Up @@ -314,7 +315,7 @@ class EventDetails extends Component {
: (
// eslint-disable-next-line
<div className='EventDetails-container'>
<Link className="back-to-calendar" to={`/calendars/${calendar.slug}?past=visible`}>Back to {calendar.name}</Link>
<Link className="back-to-calendar" to={`/calendars/${getCalendarSlug(calendar)}?past=visible`}>Back to {calendar.name}</Link>
{eventDetailsComponent}
</div>
)
Expand Down
3 changes: 3 additions & 0 deletions src/client/calendar/utils/get-calendar-slug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const getCalendarSlug = calendar => calendar.id.replace('cal-', '')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graymur this function doesn't require entire calendar then, since it only uses id

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this changes in the future? I think it's quite possible.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think so? But if it does we will refactor.


export default getCalendarSlug