-
Notifications
You must be signed in to change notification settings - Fork 5
Added links for different events #17
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
Open
BigSpaceships
wants to merge
13
commits into
ComputerScienceHouse:master
Choose a base branch
from
BigSpaceships:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+758
−541
Open
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6765c12
vue history for individual events (doesn't work in history mode)
BigSpaceships c227812
vue history works for events in the past
BigSpaceships 1f0dbf9
Merge branch 'ComputerScienceHouse:master' into master
BigSpaceships ffc43a4
added /event/id route to function as permalinks
BigSpaceships c9eb496
Added button to copy permalink to url
BigSpaceships 8cb26a7
fix formatting
BigSpaceships d1fcda9
fixed dependency errors
BigSpaceships 123f138
resolved changes for pr
BigSpaceships 452c04a
fixed spacing for button on mobile
BigSpaceships 1a70815
fixed frontend formatting
BigSpaceships 0794a3d
fixed 404 error when directly navigating to site
BigSpaceships baf954c
removed prop for history and used provider
BigSpaceships 9699f27
/{id} and /history/{id} redirect to the correct place
BigSpaceships File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p>Select an Event to see details</p> | ||
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<button type="button" class="btn btn-primary mx-2 mb-2" @click="copyLink"> | ||
Copy Link to Event | ||
</button> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { PopupType } from '@/models'; | ||
import { usePopupStore } from '@/stores/popup'; | ||
import { defineComponent } from 'vue'; | ||
|
||
export default defineComponent({ | ||
props: { | ||
eventId: Number | ||
}, | ||
methods: { | ||
copyLink() { | ||
const popupStore = usePopupStore(); | ||
const baseUrl = window.location.host; | ||
|
||
const urlToCopy = baseUrl + '/event/' + this.eventId; | ||
|
||
try { | ||
navigator.clipboard.writeText(urlToCopy); | ||
|
||
popupStore.addPopup(PopupType.Success, 'Copied url for event to clipboard!'); | ||
} catch (_err) { | ||
popupStore.addPopup(PopupType.Danger, `Failed to copy url ${urlToCopy} to clipboard`); | ||
} | ||
} | ||
} | ||
}); | ||
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,17 @@ function sortByStartDate(a: Event, b: Event) { | |
export const useEventStore = defineStore('events', { | ||
state: () => ({ | ||
events: [] as Event[], | ||
selectedEvent: null as Event | null | ||
id: -1 as number | ||
BigSpaceships marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}), | ||
getters: { | ||
selectedEventCars: (state) => state.selectedEvent?.cars | ||
selectedEvent(state) { | ||
return state.events.find((event) => { | ||
return event.id == state.id; | ||
}); | ||
}, | ||
Comment on lines
+14
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One could argue it's more efficient to store events as a dict of ID to event, but it doesn't really matter |
||
selectedEventCars(): Car[] | undefined { | ||
return this.selectedEvent?.cars; | ||
} | ||
}, | ||
actions: { | ||
addEvent(event: Event) { | ||
|
@@ -20,29 +27,32 @@ export const useEventStore = defineStore('events', { | |
setEvents(events: Event[]) { | ||
this.events = events; | ||
}, | ||
setEventId(id: number) { | ||
this.id = id; | ||
}, | ||
sortEvents(past: Boolean) { | ||
this.events.sort(sortByStartDate); | ||
|
||
if (past) { | ||
this.events.reverse(); | ||
this.events.reverse(); | ||
} | ||
}, | ||
removeEvent(event: Event | null) { | ||
if (event == null) { | ||
removeEvent(id: number | null) { | ||
if (id == null) { | ||
return; | ||
} | ||
const index = this.events.indexOf(event); | ||
const index = this.events.findIndex((event) => event.id == id); | ||
if (index > -1) { | ||
this.events.splice(index, 1); | ||
} | ||
}, | ||
selectEvent(event: Event) { | ||
if (this.selectedEvent == event) { | ||
return; | ||
} | ||
this.selectedEvent = event; | ||
this.selectedEvent.cars = []; | ||
}, | ||
// selectEvent(event: Event) { | ||
// if (this.selectedEvent == event) { | ||
// return; | ||
// } | ||
// this.selectedEvent = event; | ||
// this.selectedEvent.cars = []; | ||
// }, | ||
BigSpaceships marked this conversation as resolved.
Show resolved
Hide resolved
|
||
addCar(car: Car) { | ||
this.selectedEvent?.cars?.push(car); | ||
}, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.