Skip to content
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
56 changes: 43 additions & 13 deletions external_types/DatabaseCatalogAPI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ paths:
description: Get GBFS feeds from the Mobility Database.
tags:
- "feeds"
- "beta"
operationId: getGbfsFeeds
Comment thread
Alessandro100 marked this conversation as resolved.
parameters:
- $ref: "#/components/parameters/limit_query_param_gbfs_feeds_endpoint"
Expand Down Expand Up @@ -175,7 +174,6 @@ paths:
description: Get the specified GTFS feed from the Mobility Database. Once a week, we check if the latest dataset has been updated and, if so, we update it in our system accordingly.
tags:
- "feeds"
- "beta"
operationId: getGtfsFeed

security:
Expand Down Expand Up @@ -338,7 +336,9 @@ paths:
- $ref: "#/components/parameters/version_query_param"
- $ref: "#/components/parameters/search_text_query_param"
- $ref: "#/components/parameters/feature"
- $ref: "#/components/parameters/license_ids_query_param"
- $ref: "#/components/parameters/license_ids"
- $ref: "#/components/parameters/license_is_spdx"
- $ref: "#/components/parameters/license_tags"
security:
- Authentication: []
responses:
Expand Down Expand Up @@ -1087,6 +1087,14 @@ components:
description: Notes concerning the relation between the feed and the license.
type: string
example: Detected locale/jurisdiction port 'nl'. SPDX does not list ported CC licenses; using canonical ID.
license_tags:
description: List of taxonomy tags associated with the feed's license.
type: array
items:
type: string
example:
- "family:ODC"
- "license:open-data-commons"

Locations:
type: array
Expand Down Expand Up @@ -1344,6 +1352,14 @@ components:
type: string
example: 2023-07-10T22:06:00Z
format: date-time
license_tags:
description: List of taxonomy tags associated with the license.
type: array
items:
type: string
example:
- "family:ODC"
- "license:open-data-commons"

LicenseWithRules:
allOf:
Expand Down Expand Up @@ -1486,6 +1502,29 @@ components:
type: array
items:
type: string
license_ids:
name: license_ids
in: query
description: Comma separated list of license IDs to filter feeds by their license.
required: false
schema:
type: string
example: CC-BY-4.0,ODbL-1.0
license_is_spdx:
name: license_is_spdx
in: query
description: Filter feeds by whether their license is an SPDX license.
required: false
schema:
type: boolean
license_tags:
name: license_tags
in: query
description: Comma separated list of tags to filter feeds by their license tags.
required: false
schema:
type: string
example: family:ODC,license:open-data-commons
provider:
name: provider
in: query
Expand Down Expand Up @@ -1794,18 +1833,9 @@ components:
type: string
example: 2.3

license_ids_query_param:
name: license_ids
in: query
description: Comma separated list of license IDs to filter by.
required: False
schema:
type: string
example: CC-BY-4.0,CC0-1.0

securitySchemes:
Authentication:
$ref: "./BearerTokenSchema.yaml#/components/securitySchemes/Authentication"

security:
- Authentication: []
- Authentication: []
3 changes: 2 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"showLess": "Show less",
"showMore": "Show {count} more",
"moreInfo": "More Info",
"license": "License"
"license": "License",
"tags": "Tags"
},
"feeds": {
"feeds": "Feeds",
Expand Down
3 changes: 2 additions & 1 deletion messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"showLess": "Show less",
"showMore": "Show {count} more",
"moreInfo": "More Info",
"license": "License"
"license": "License",
"tags": "Tags"
},
"feeds": {
"feeds": "Feeds",
Expand Down
4 changes: 0 additions & 4 deletions src/app/screens/Feed/FeedSummary.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@ export const GroupHeader = styled(Typography)<{ component?: ElementType }>(
export const FeedLinkElement = styled(Box)(({ theme }) => ({
width: 'calc(100% - 16px)',
marginLeft: '16px',
marginBottom: '16px',
'&:last-of-type': {
marginBottom: 0,
},
}));
6 changes: 5 additions & 1 deletion src/app/screens/Feed/components/CopyLinkElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
Snackbar,
Tooltip,
Typography,
type SxProps,
type Theme,
} from '@mui/material';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import DownloadIcon from '@mui/icons-material/Download';
Expand All @@ -22,6 +24,7 @@ export interface CopyLinkElementProps {
linkType?: 'download' | 'external' | 'email' | 'internal' | 'label';
titleInfo?: string;
internalClickAction?: () => void;
sx?: SxProps<Theme>;
}

export default function CopyLinkElement({
Expand All @@ -30,6 +33,7 @@ export default function CopyLinkElement({
linkType,
titleInfo,
internalClickAction,
sx,
}: CopyLinkElementProps): ReactElement {
const [snackbarOpen, setSnackbarOpen] = useState(false);

Expand All @@ -52,7 +56,7 @@ export default function CopyLinkElement({
const formattedUrl = linkType === 'email' ? `mailto:${url}` : url;

return (
<FeedLinkElement>
<FeedLinkElement sx={sx}>
{title != null && (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{linkType === 'label' ? (
Expand Down
85 changes: 72 additions & 13 deletions src/app/screens/Feed/components/FeedSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default function FeedSummary({
const [openProvidersDetails, setOpenProvidersDetails] = useState(false);
const [openLicenseDetails, setOpenLicenseDetails] = useState(false);
const [showAllFeatures, setShowAllFeatures] = useState(false);
const [showAllLicenseTags, setShowAllLicenseTags] = useState(false);

const fullScreen = useMediaQuery(theme.breakpoints.down('md'));

Expand Down Expand Up @@ -220,8 +221,7 @@ export default function FeedSummary({
feed?.locations?.length === 1 && (
<Typography
variant='h6'
Comment thread
Alessandro100 marked this conversation as resolved.
component='p'
sx={{ whiteSpace: 'nowrap', fontWeight: 700, mr: 1, mb: 0 }}
sx={{ fontWeight: 700, mr: 1, mb: 0 }}
>
{getLocationName(feed?.locations)}
</Typography>
Expand Down Expand Up @@ -638,7 +638,7 @@ export default function FeedSummary({
: allFeatures.slice(0, 6);
return (
<>
<Grid container spacing={1} mt={1}>
<Grid container spacing={1} mt={1} ml={2}>
{visible.map((feature, index) => {
const featureDecorators =
getFeatureComponentDecorators(feature);
Expand Down Expand Up @@ -678,7 +678,6 @@ export default function FeedSummary({
onClick={() => {
setShowAllFeatures((v) => !v);
}}
sx={{ ml: 1 }}
>
{showAllFeatures
? tCommon('showLess')
Expand Down Expand Up @@ -756,6 +755,63 @@ export default function FeedSummary({
{feed?.source_info?.license_url}
</MuiLink>
)}
{feed.source_info.license_tags != undefined &&
feed.source_info.license_tags.length > 0 && (
<>
<Typography
variant='subtitle2'
component='h4'
sx={{
fontWeight: 700,
color: 'text.secondary',
ml: 2,
mt: 1,
}}
>
{tCommon('tags')}
</Typography>
<Box
sx={{
mt: 1,
ml: 2,
gap: 1,
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
}}
>
{(showAllLicenseTags
? feed.source_info.license_tags
: feed.source_info.license_tags.slice(0, 3)
).map((tag, index) => (
<Chip
key={index}
label={tag}
size='small'
color='info'
variant='outlined'
sx={{ opacity: 0.8 }}
/>
))}
{feed.source_info.license_tags.length > 3 && (
<Button
variant='text'
color='secondary'
size='small'
onClick={() => {
setShowAllLicenseTags((v) => !v);
}}
>
{showAllLicenseTags
? tCommon('showLess')
: tCommon('showMore', {
count: feed.source_info.license_tags.length - 3,
})}
</Button>
)}
</Box>
</>
)}
</GroupCard>
)}

Expand All @@ -766,15 +822,18 @@ export default function FeedSummary({
{t('relatedLinks')}
</GroupHeader>

{(feed as GTFSFeedType)?.related_links?.map((link, index) => (
<CopyLinkElement
key={index}
title={link.code ?? ''}
url={link.url ?? ''}
linkType='download'
titleInfo={link.description ?? undefined}
/>
))}
{(feed as GTFSFeedType)?.related_links?.map(
(link, index, allLinks) => (
<CopyLinkElement
key={index}
title={link.code ?? ''}
url={link.url ?? ''}
linkType='download'
titleInfo={link.description ?? undefined}
sx={{ mb: index === allLinks.length - 1 ? 0 : 2 }}
/>
),
)}
</GroupCard>
)}

Expand Down
32 changes: 28 additions & 4 deletions src/app/services/feeds/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,14 @@ export interface components {
* @example Detected locale/jurisdiction port 'nl'. SPDX does not list ported CC licenses; using canonical ID.
*/
license_notes?: string;
/**
* @description List of taxonomy tags associated with the feed's license.
* @example [
* "family:ODC",
* "license:open-data-commons"
* ]
*/
license_tags?: string[];
};
Locations: Array<components['schemas']['Location']>;
Location: {
Expand Down Expand Up @@ -1017,6 +1025,14 @@ export interface components {
* @example 2023-07-10T22:06:00Z
*/
updated_at?: string;
/**
* @description List of taxonomy tags associated with the license.
* @example [
* "family:ODC",
* "license:open-data-commons"
* ]
*/
license_tags?: string[];
};
LicenseWithRules: components['schemas']['LicenseBase'] & {
license_rules?: Array<components['schemas']['LicenseRule']>;
Expand Down Expand Up @@ -1119,6 +1135,12 @@ export interface components {
>;
/** @description Filter feeds by their GTFS features. [GTFS features definitions defined here](https://gtfs.org/getting-started/features/overview) */
feature: string[];
/** @description Comma separated list of license IDs to filter feeds by their license. */
license_ids: string;
/** @description Filter feeds by whether their license is an SPDX license. */
license_is_spdx: boolean;
/** @description Comma separated list of tags to filter feeds by their license tags. */
license_tags: string;
/** @description List only feeds with the specified value. Can be a partial match. Case insensitive. */
provider: string;
/** @description List only feeds with the specified value. Can be a partial match. Case insensitive. */
Expand Down Expand Up @@ -1194,8 +1216,6 @@ export interface components {
system_id_param: string;
/** @description Filter feeds by their supported GBFS version. This is a string that follows the semantic versioning format. */
version_param: string;
/** @description Comma separated list of license IDs to filter by. */
license_ids_query_param: string;
};
requestBodies: never;
headers: never;
Expand Down Expand Up @@ -1556,8 +1576,12 @@ export interface operations {
search_query?: components['parameters']['search_text_query_param'];
/** @description Filter feeds by their GTFS features. [GTFS features definitions defined here](https://gtfs.org/getting-started/features/overview) */
feature?: components['parameters']['feature'];
/** @description Comma separated list of license IDs to filter by. */
license_ids?: components['parameters']['license_ids_query_param'];
/** @description Comma separated list of license IDs to filter feeds by their license. */
license_ids?: components['parameters']['license_ids'];
/** @description Filter feeds by whether their license is an SPDX license. */
license_is_spdx?: components['parameters']['license_is_spdx'];
/** @description Comma separated list of tags to filter feeds by their license tags. */
license_tags?: components['parameters']['license_tags'];
};
header?: never;
path?: never;
Expand Down
Loading