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

DBC22-1814: Delay list rework #326

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/backend/apps/event/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class EVENT_DIRECTION:
EVENT_DIRECTION.EAST: "Eastbound",
EVENT_DIRECTION.SOUTH: "Southbound",
EVENT_DIRECTION.WEST: "Westbound",
EVENT_DIRECTION.BOTH: "Both",
EVENT_DIRECTION.NONE: "Both"
EVENT_DIRECTION.BOTH: "Both directions",
EVENT_DIRECTION.NONE: "Both directions"
}

EVENT_DIFF_FIELDS = [
Expand Down
11 changes: 7 additions & 4 deletions src/backend/apps/event/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ class Meta:
)

def to_representation(self, instance):
representation = super().to_representation(instance)
representation = super().to_representation(instance)

schedule = instance.schedule.get('intervals', [])
start, end = schedule[0].split('/')
representation['start'] = start
representation['end'] = end
if len(schedule):
start, end = schedule[0].split('/')
representation['start'] = start
representation['end'] = end

return representation

def get_direction_display(self, obj):
Expand Down
8 changes: 5 additions & 3 deletions src/frontend/src/Components/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ export default function Filters(props) {
onClick={() => {
open ? setOpen(false) : setOpen(true) }
}>
<FontAwesomeIcon icon={faFilter} />
Filters

<FontAwesomeIcon icon={faFilter} />
</Button>

{ open &&
Expand Down Expand Up @@ -153,6 +154,7 @@ export default function Filters(props) {
</span>
Closures
</label>

<OverlayTrigger placement="top" overlay={tooltipClosures}>
<span className="tooltip-info">?</span>
</OverlayTrigger>
Expand Down Expand Up @@ -319,8 +321,8 @@ export default function Filters(props) {
</OverlayTrigger>
</div>
*/}
{/*

{/*
<div className={'filter-item filter-item--weather'}>
<span className="filter-item__icon">
<FontAwesomeIcon icon={faCloudSun} alt="weather" />
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/Components/Filters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

button.btn.open-filters {
svg {
margin-right: 8px;
margin-left: 8px;
}

&.open {
background: $Type-Link;
color: #FFFFFF;
}

// &:focus {
// border-color: #8099b3;
// outline: 0;
Expand Down Expand Up @@ -79,7 +79,7 @@ button.btn.open-filters {
& + .filter-item {
margin-top: 8px;
}

&--closures {
svg {
font-size: 1.25rem;
Expand Down
11 changes: 6 additions & 5 deletions src/frontend/src/Components/events/EventCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Skeleton from 'react-loading-skeleton'
import 'react-loading-skeleton/dist/skeleton.css'

// Internal imports
import { getTypeDisplay } from './functions';
import FriendlyTime from '../FriendlyTime';

// External assets
Expand All @@ -23,21 +24,21 @@ export default function EventCard(props) {
return (
<div className={'event-card ' + (event ? event.severity.toLowerCase() : '')}>
<div className="event-card__title">
<div className="route">{ showLoader ? <Skeleton width={200} /> : event.route_display }</div>
<div className="direction">{ showLoader ? <Skeleton width={30} /> : event.direction }</div>
<div className="route">{ showLoader ? <Skeleton width={150} /> : event.route_at }</div>
<div className="direction">{ showLoader ? <Skeleton width={100} /> : event.direction_display }</div>
</div>

<div className="event-card__details">
<div className="type">
<div className="header">{ showLoader ? <Skeleton /> : 'Type' }</div>
<div className="content">
{ showLoader ? <Skeleton width={75} /> : <div>{icon} {event.severity.toLowerCase()}</div> }
{ showLoader ? <Skeleton width={75} /> : <div>{icon} {getTypeDisplay(event)}</div> }
</div>
</div>

<div className="location">
<div className="header">{ showLoader ? <Skeleton /> : 'Location' }</div>
<div className="content">{ showLoader ? <Skeleton width={200} /> : event.location_description }</div>
<div className="content">{ showLoader ? <Skeleton count={2} width={200} /> : event.location_description }</div>
</div>

<div className="closest-landmark">
Expand All @@ -49,7 +50,7 @@ export default function EventCard(props) {

<div className="description">
<div className="header">{ showLoader ? <Skeleton /> : 'Description' }</div>
<div className="content">{ showLoader ? <Skeleton count={7} /> : event.description }</div>
<div className="content">{ showLoader ? <Skeleton count={5} /> : event.optimized_description }</div>
</div>

<div className="last-update">
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/Components/events/EventCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

.event-card {
margin-bottom: 40px;

&__title {
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 40px;
background-color: $BC-Blue;
color: $White;
padding: 8px;
Expand Down
Loading
Loading