This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
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.
Merge pull request #214 from Catatomik/dev
✨💄⚡ Display schedules & destinations
- Loading branch information
Showing
10 changed files
with
446 additions
and
330 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
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
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
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 |
---|---|---|
@@ -1,34 +1,81 @@ | ||
<script setup lang="ts"> | ||
import type { OperatingRoute } from "@/store/TBM"; | ||
import { ref, type Ref } from "vue"; | ||
export interface RouteHeader { | ||
route: OperatingRoute; | ||
destSelect?: boolean; | ||
} | ||
const props = defineProps<RouteHeader>(); | ||
const props = withDefaults(defineProps<RouteHeader>(), { | ||
destSelect: false, | ||
}); | ||
export type Checked = Record< | ||
OperatingRoute["stopPointDetails"]["schedules"]["destinations"][number], | ||
boolean | ||
>; | ||
const checked: Ref<Checked> = ref( | ||
props.route.stopPointDetails.schedules.destinations.reduce((acc, v) => ({ ...acc, [v]: true }), {}), | ||
); | ||
const emit = defineEmits<{ | ||
(e: "update:checked", checked: Checked): void; | ||
}>(); | ||
emit("update:checked", checked.value); | ||
</script> | ||
|
||
<template> | ||
<img | ||
v-if="'id' in props.route.lineDetails" | ||
width="25" | ||
class="inline align-middle" | ||
:src="props.route.lineDetails.picto" | ||
/> | ||
<p class="mx-1 inline align-middle"> | ||
{{ | ||
props.route.stopPointDetails.route.line.type === "Bus" || | ||
props.route.stopPointDetails.route.line.type === "Autocar" || | ||
props.route.stopPointDetails.route.line.type === "Bus Scolaire" | ||
? "🚌" | ||
: props.route.stopPointDetails.route.line.type === "Tramway" | ||
? "🚋" | ||
: props.route.stopPointDetails.route.line.type === "Train régional / TER" | ||
? "🚆" | ||
: "" | ||
}} | ||
</p> | ||
<h4 class="font-bold text-base py-1 inline align-middle"> | ||
{{ props.route.line.name }} | ||
</h4> | ||
<p class="inline align-middle ml-1">➜ {{ props.route.name }}</p> | ||
<div> | ||
<img | ||
v-if="'id' in route.lineDetails" | ||
width="25" | ||
class="inline align-middle" | ||
:src="route.lineDetails.picto" | ||
/> | ||
<p class="mx-1 inline align-middle"> | ||
{{ | ||
route.stopPointDetails.route.line.type === "Bus" || | ||
route.stopPointDetails.route.line.type === "Autocar" || | ||
route.stopPointDetails.route.line.type === "Bus Scolaire" | ||
? "🚌" | ||
: route.stopPointDetails.route.line.type === "Tramway" | ||
? "🚋" | ||
: route.stopPointDetails.route.line.type === "Train régional / TER" | ||
? "🚆" | ||
: "" | ||
}} | ||
</p> | ||
<h4 class="font-bold text-base py-1 inline align-middle"> | ||
{{ route.line.name }} | ||
</h4> | ||
</div> | ||
<div v-if="destSelect" class="mt-1"> | ||
<div | ||
v-for="destination in route.stopPointDetails.schedules.destinations" | ||
:key="destination" | ||
class="mt-1 w-fit" | ||
> | ||
<span | ||
class="flex items-center dest rounded px-1" | ||
:class="[ | ||
route.stopPointDetails.schedules.destinations.length > 1 | ||
? `dest-${route.stopPointDetails.schedules.destinations.indexOf(destination).toLocaleString()}` | ||
: 'border-transparent', | ||
]" | ||
> | ||
<input | ||
v-if="route.stopPointDetails.schedules.destinations.length > 1" | ||
v-model="checked[destination]" | ||
type="checkbox" | ||
@input="emit('update:checked', checked)" | ||
/> | ||
<p v-else class="inline">➜</p> | ||
<p class="inline ml-2"> | ||
{{ destination }} | ||
</p> | ||
</span> | ||
</div> | ||
</div> | ||
</template> |
Oops, something went wrong.