Skip to content

Commit e5a4c36

Browse files
Alessandro100qcdyx
andauthored
feat: is official badge + feed detail enhance (#870)
* is official + feed detail enhance * official_updated_at added --------- Co-authored-by: Jingsi Lu <[email protected]>
1 parent d91489e commit e5a4c36

File tree

21 files changed

+545
-322
lines changed

21 files changed

+545
-322
lines changed

api/src/feeds/impl/models/basic_feed_impl.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ class Config:
2323
def from_orm(cls, feed: Feed | None, _=None) -> BasicFeed | None:
2424
if not feed:
2525
return None
26-
latest_official_status = None
27-
if len(feed.officialstatushistories) > 0:
28-
latest_official_status = max(feed.officialstatushistories, key=lambda x: x.timestamp).is_official
2926
return cls(
3027
id=feed.stable_id,
3128
data_type=feed.data_type,
3229
status=feed.status,
33-
official=latest_official_status,
30+
official=feed.official,
31+
official_updated_at=feed.official_updated_at,
3432
created_at=feed.created_at,
3533
external_ids=sorted(
3634
[ExternalIdImpl.from_orm(item) for item in feed.externalids], key=lambda x: x.external_id

docs/DatabaseCatalogAPI.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ components:
362362
Official feeds are provided by the transit agency or a trusted source.
363363
type: boolean
364364
example: true
365+
official_updated_at:
366+
description: >
367+
The date and time the official status was last updated, in ISO 8601 date-time format.
368+
type: string
369+
example: 2023-07-10T22:06:00Z
370+
format: date-time
365371
external_ids:
366372
$ref: "#/components/schemas/ExternalIds"
367373
provider:

liquibase/changelog.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@
3333
<include file="changes/feat_741.sql" relativeToChangelogFile="true"/>
3434
<include file="changes/feat_794.sql" relativeToChangelogFile="true"/>
3535
<include file="changes/feat_794_2.sql" relativeToChangelogFile="true"/>
36+
<include file="changes/feat_871.sql" relativeToChangelogFile="true"/>
3637
</databaseChangeLog>

liquibase/changes/feat_871.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE Feed ADD COLUMN official_updated_at TIMESTAMP DEFAULT NULL;

liquibase/changes/official_tag_update.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
-- Query to update official tag for feeds with contact email in the feed table where the source is mdb
22

33
UPDATE public.feed f
4-
SET official = TRUE
4+
SET
5+
official = TRUE,
6+
official_updated_at = NOW()
57
FROM public.externalid e
68
WHERE f.id = e.feed_id
79
AND f.feed_contact_email LIKE '%@%'

web-app/cypress/e2e/feeds.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Feed page', () => {
2525
});
2626

2727
it('should render the last updated date', () => {
28-
cy.get('[data-testid="last-updated"]').should('contain', 'Last updated on');
28+
cy.get('[data-testid="last-updated"]').should('contain', 'Quality report updated');
2929
});
3030

3131
it('should render download button', () => {

web-app/public/locales/en/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,12 @@
3636
"country": "Country",
3737
"chooseCountry": "Choose a country",
3838
"region": "Region",
39-
"municipality": "Municipality"
39+
"municipality": "Municipality",
40+
"feedback": {
41+
"errors": "errors",
42+
"noErrors": "No errors",
43+
"noWarnings": "No warnings",
44+
"warnings": "warnings",
45+
"infoNotices": "info notices"
46+
}
4047
}

web-app/public/locales/en/feeds.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"errorAndContact": "Please check your internet connection and try again. If the problem persists <1>contact us</1> for for further assistance.",
2020
"errorLoadingFeed": "There was an error loading the feed.",
21+
"errorLoadingQualityReport": "Unable to generate data quality report.",
2122
"form": {
2223
"addOrUpdateFeed": "Add or Update a Feed",
2324
"signUp": "Sign up for a Mobility Database account or login to add or update a GTFS feed.",
@@ -86,5 +87,12 @@
8687
"relatedGtfsScheduleFeed": "Link to related GTFS Schedule feed",
8788
"isAuthRequired": "Is authentication required for the feed?",
8889
"isAuthRequiredDetails": " Select \"Yes\" if a user has to login or provide credentials to download the feed",
89-
"detailPageDescription": "Explore the {{formattedName}} {{dataTypeVerbose}} feed details with access to a quality data insights"
90+
"detailPageDescription": "Explore the {{formattedName}} {{dataTypeVerbose}} feed details with access to a quality data insights",
91+
"officialFeed": "Official Feed",
92+
"officialFeedTooltip": "The transit provider has confirmed this feed should be shared with riders. This has been confirmed either by the transit provider providing the feed on their website or from personalized confirmation with the Mobility Database team.",
93+
"officialFeedTooltipShort": "Verified feed: Confirmed by the transit provider or the Mobility Database team for rider use.",
94+
"seeDetailPageProviders": "See detail page to view {providersCount} others",
95+
"openFullQualityReport": "Open Full Quality Report",
96+
"qualityReportUpdated": "Quality report updated",
97+
"officialFeedUpdated": "Official verification updated"
9098
}
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Box, Grid, type SxProps } from '@mui/material';
2+
import { Box, Typography, type SxProps } from '@mui/material';
33

44
export interface ContentBoxProps {
55
title: string;
@@ -17,7 +17,6 @@ export const ContentBox = (
1717
<Box
1818
width={props.width}
1919
sx={{
20-
...props.sx,
2120
background: '#FFFFFF',
2221
borderRadius: '6px',
2322
border: `2px solid ${props.outlineColor}`,
@@ -26,19 +25,15 @@ export const ContentBox = (
2625
fontSize: '18px',
2726
fontWeight: 700,
2827
mr: 0,
28+
...props.sx,
2929
}}
3030
>
31-
<Grid
32-
container
33-
sx={{
34-
width: '100%',
35-
}}
36-
>
37-
<Grid item xs={12} fontSize={24}>
31+
{props.title.trim() !== '' && (
32+
<Typography variant='h5' sx={{ flexShrink: 0, mb: 1 }}>
3833
{props.title}
39-
</Grid>
40-
{props.children}
41-
</Grid>
34+
</Typography>
35+
)}
36+
{props.children}
4237
</Box>
4338
);
4439
};

web-app/src/app/components/Header.style.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import { type SxProps, type Theme } from '@mui/material';
1+
import { type Theme } from '@mui/material';
2+
import { type SystemStyleObject } from '@mui/system';
23
import { fontFamily } from '../Theme';
34

4-
export const mobileNavElementStyle: SxProps<Theme> = (theme) => ({
5+
export const mobileNavElementStyle = (
6+
theme: Theme,
7+
): SystemStyleObject<Theme> => ({
58
width: '100%',
69
justifyContent: 'flex-start',
710
pl: 3,
811
color: theme.palette.text.primary,
912
});
1013

11-
export const animatedButtonStyling: SxProps<Theme> = (theme) => ({
14+
export const animatedButtonStyling = (
15+
theme: Theme,
16+
): SystemStyleObject<Theme> => ({
1217
minWidth: 'fit-content',
1318
px: 0,
1419
mx: {

0 commit comments

Comments
 (0)