forked from motis-project/motis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement new backend, itinerary overview, also styling (#46)
* chore: enforce standards and improve ease of use * feat: implement new frontend to the logic Co-authored-by: MoPhliFra <[email protected]> Co-authored-by: Dominik Kuckeburg <[email protected]> * chore: delete old frontend * feat: PlanEntry with itinerary match attribute; style change - added attribute to itinerary class - changed comparePlans.ts to use match attribute instead of cssClass when match / mismatch - changed PlanEntry style for match / mismatch * fix: revert match to cssClass * chore: change layout * feat: implement itinerary overview sketch * feat: styling of itinerary overview --------- Co-authored-by: MoPhliFra <[email protected]> Co-authored-by: Dominik Kuckeburg <[email protected]> Co-authored-by: nicosvv <[email protected]> Co-authored-by: MoPhliFra <[email protected]>
- Loading branch information
1 parent
08289b8
commit cd31589
Showing
27 changed files
with
1,635 additions
and
1,511 deletions.
There are no files selected for viewing
This file contains 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
1,158 changes: 579 additions & 579 deletions
1,158
...ssing/assets/default-plan-mismatched.json → ...ugger/assets/default-plan-mismatched.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,158 changes: 579 additions & 579 deletions
1,158
.../data-processing/assets/default-plan.json → visual-debugger/assets/default-plan.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,61 @@ | ||
import { | ||
activeQueryStore, currentDefaultItineraryStore, | ||
currentDefaultPlanStore, currentItineraryStore, | ||
currentPlanStore, | ||
defaultPlanDatasetStore, | ||
planDatasetStore | ||
} from "sveltestore"; | ||
import {Itinerary, type Plan} from "@data/type-declarations/planTypes.ts"; | ||
|
||
// attributes for switching of current plan | ||
let plans: Plan[]; | ||
let defaultPlans: Plan[]; | ||
|
||
/** | ||
* Changes the currently displayed plan to the one given in the index | ||
*/ | ||
export function changePlan(queryIndex: number) { | ||
// get current plan data | ||
planDatasetStore.subscribe((data) => { | ||
plans = data | ||
} | ||
) | ||
// load plan of the clicked query into svelte store | ||
currentPlanStore.set(plans[queryIndex - 1]) | ||
|
||
// get current plan data | ||
defaultPlanDatasetStore.subscribe((data) => { | ||
defaultPlans = data | ||
} | ||
) | ||
// load plan of the clicked query into svelte store | ||
currentDefaultPlanStore.set(defaultPlans[queryIndex - 1]) | ||
|
||
// set the number of the new active query | ||
activeQueryStore.set(queryIndex) | ||
} | ||
|
||
let itinerary: Itinerary; | ||
let defaultItinerary: Itinerary; | ||
|
||
/** | ||
* Changes the currently displayed plan to the one given in the index | ||
*/ | ||
export function changeItinerary(itineraryIndex: number) { | ||
// get current plan data | ||
currentPlanStore.subscribe((data) => { | ||
itinerary = data.itineraries[itineraryIndex] | ||
} | ||
) | ||
// load plan of the clicked query into svelte store | ||
currentItineraryStore.set(itinerary) | ||
|
||
// get current plan data | ||
currentDefaultPlanStore.subscribe((data) => { | ||
defaultItinerary = data.itineraries[itineraryIndex] | ||
} | ||
) | ||
// load plan of the clicked query into svelte store | ||
currentDefaultItineraryStore.set(defaultItinerary) | ||
|
||
} |
This file contains 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 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,36 @@ | ||
import {changeItinerary, changePlan} from "@data/changeElements.ts"; | ||
import {computePlan, downloadPlans} from "@data/planParsing.ts"; | ||
|
||
/** | ||
* This division between the svelte components and the functions they're calling is sole to simplify unit testing said functions | ||
*/ | ||
|
||
/** | ||
* Interface method for changing the active plans | ||
* @param planIndex the index of the plan to change to | ||
*/ | ||
export function changePlanInterface(planIndex: number) { | ||
changePlan(planIndex) | ||
} | ||
|
||
/** | ||
* Interface method for getting the routing results for the queries from motis | ||
*/ | ||
export function computePlansInterface() { | ||
computePlan() | ||
} | ||
|
||
/** | ||
* Interface method for downloading the computed plans for later use | ||
*/ | ||
export function downloadPlanInterface() { | ||
downloadPlans() | ||
|
||
} | ||
|
||
/** | ||
* Interface method for getting the routing results for the queries from motis | ||
*/ | ||
export function changeItineraryInterface(itineraryIndex: number) { | ||
changeItinerary(itineraryIndex) | ||
} |
10 changes: 0 additions & 10 deletions
10
visual-debugger/src/data-processing/parsing-types/cssClasses.ts
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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,10 @@ | ||
/** | ||
* Enum that holds all css classes for dynamic UI elements | ||
*/ | ||
export enum cssClasses{ | ||
planEntryValid = 'border-green-600 bg-green-400', | ||
|
||
planEntryInvalid = 'border-red-600 bg-red-400', | ||
|
||
planEntryDefault = "border-black-500 bg-white-200" | ||
} |
This file contains 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
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
visual-debugger/src/lib/components/ui/DefaultItineraryOverview.svelte
This file contains 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,38 @@ | ||
<script lang="ts"> | ||
import {Itinerary, Leg} from "@data/type-declarations/planTypes.ts"; | ||
import {currentDefaultItineraryStore} from "sveltestore"; | ||
import {Separator} from "@/components/ui/separator"; | ||
import LegEntry from "@/components/ui/subcomponents/LegEntry.svelte"; | ||
let itinerary: Itinerary | ||
let legs: Leg[] | ||
// let queries be up-to-date with the store | ||
currentDefaultItineraryStore.subscribe((data) => { | ||
if (data == undefined) { | ||
itinerary = new Itinerary() | ||
} else { | ||
itinerary = data | ||
legs = data.legs | ||
} | ||
} | ||
) | ||
</script> | ||
|
||
<div> | ||
{#if itinerary == undefined} | ||
<label> No itinerary currently selected</label> | ||
{:else} | ||
<div class="text-xl"> | ||
<span class="">Itinerary-Index: {itinerary.index}</span> | ||
</div> | ||
<Separator class="my-2"/> | ||
{#each legs as leg} | ||
<LegEntry leg={leg} /> | ||
<Separator class="my-2"/> | ||
{/each} | ||
{/if} | ||
|
||
</div> |
This file contains 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
38 changes: 38 additions & 0 deletions
38
visual-debugger/src/lib/components/ui/ItineraryOverview.svelte
This file contains 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,38 @@ | ||
<script lang="ts"> | ||
import {Itinerary, Leg} from "@data/type-declarations/planTypes.ts"; | ||
import {currentItineraryStore} from "sveltestore"; | ||
import {Separator} from "@/components/ui/separator"; | ||
import LegEntry from "@/components/ui/subcomponents/LegEntry.svelte"; | ||
let itinerary: Itinerary | ||
let legs: Leg[] | ||
// let queries be up-to-date with the store | ||
currentItineraryStore.subscribe((data) => { | ||
if (data == undefined) { | ||
itinerary = new Itinerary() | ||
} else { | ||
itinerary = data | ||
legs = data.legs | ||
} | ||
} | ||
) | ||
</script> | ||
|
||
<div> | ||
{#if itinerary == undefined} | ||
<label> No itinerary currently selected</label> | ||
{:else} | ||
<div class="text-xl"> | ||
<span class="">Itinerary-Index: {itinerary.index}</span> | ||
</div> | ||
<Separator class="my-2"/> | ||
{#each legs as leg} | ||
<LegEntry leg={leg} /> | ||
<Separator class="my-2"/> | ||
{/each} | ||
{/if} | ||
|
||
</div> |
This file contains 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.