Resolve "Door2Door/ Flyer: Feedback of which streets are started"
see #10
Let's go through the changes indicated by the diff for EventAreaOverview.vue:
1. Imports
import {
ionCheckmarkCircle,
ionCheckmarkCircleOutline,
- ionChevronForward
+ ionChevronForward,
+ ionPlayCircle
} from '@quasar/extras/ionicons-v5'
-
Added
ionPlayCircle: This import statement addsionPlayCirclefrom@quasar/extras/ionicons-v5, indicating a new icon resource imported into the component.
2. Function Addition
+/**
+ * Check if the street has been started by checking if any of the addresses
+ * have been completed.
+ *
+ * @param street The street to check
+ */
+function streetStarted(street: StreetDetails) {
+ return street.addresses.some(({ osm_id }) =>
+ completedTargetIds.value.includes(osm_id.toString())
+ )
+}
-
streetStartedfunction: This new function checks if any address in a givenstreethas been completed by comparing itsosm_idwith entries incompletedTargetIds.value.
3. Code Comment Update
// FIXME(peter) Logicalwise the osm_id and completedTargetIds should have
- // the same time, it seems that the BE is communicating the wrong type
+ // the same type, it seems that the BE is communicating the wrong type
// for one of them.
-
Comment change: The comment now correctly mentions the type issue from the backend regarding
osm_idandcompletedTargetIds.
4. Template Changes
<QIcon
v-if="streetCompleted(street)"
- class="col finished-icon item-icon"
+ class="col finished-icon item-icon progress-icon"
:name="ionCheckmarkCircle"
/>
+ <QIcon
+ v-else-if="streetStarted(street)"
+ class="col started-icon item-icon progress-icon"
+ :name="ionPlayCircle"
+ />
-
Conditional rendering: An additional
<QIcon>component is added withv-else-ifconditionally renderingionPlayCircleicon whenstreetStarted(street)is true. It uses specific classes (started-icon,item-icon,progress-icon) for styling.
5. Styling Changes
.progress-icon {
margin-right: 1rem;
}
.finished-icon {
color: #4caf50;
}
+.started-icon {
+ color: #ff9800;
+}
-
CSS Classes: New styles (
progress-icon,started-icon) are added.progress-iconsets a margin, whilestarted-iconspecifies a color (#ff9800) for the started street indicator.
Summary
These changes enhance EventAreaOverview.vue by:
- Importing a new icon (
ionPlayCircle). - Adding logic to check if a street is started (
streetStartedfunction). - Adjusting comments for clarity on backend communication.
- Updating the template to display different icons based on street status.
- Adding and adjusting CSS classes for visual styling of icons.
These modifications likely improve the user interface to better indicate the status of streets within the event area overview.
Edited by control.alt.coop eG (Peter)