Skip to content

Commit

Permalink
Merge pull request #312 from guardian/fronts-integration
Browse files Browse the repository at this point in the history
slick 5:4 and 4:5 crop sharing from composer to fronts tool
  • Loading branch information
twrichards authored Nov 25, 2024
2 parents 0d2d755 + d2c9e8d commit 7c1e5d8
Show file tree
Hide file tree
Showing 23 changed files with 1,088 additions and 168 deletions.
48 changes: 48 additions & 0 deletions bootstrapping-lambda/local/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<meta charset="UTF-8" />
<title>PinBoard</title>
<script src="https://pinboard.local.dev-gutools.co.uk/pinboard.loader.js"></script>
<style>
body {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100vh;
column-gap: 10px;
}
h3,
h4 {
margin-top: 10px;
margin-bottom: 5px;
}
</style>
</head>

<body>
Expand Down Expand Up @@ -56,6 +70,40 @@ <h3>Override unread notifications bubble</h3>
<button id="btn-unset-unread-notifications-bubble">Unset</button>
</div>

<h3>Fronts Integration</h3>

<h4>Composer Buttons etc. (under trail image in furniture)</h4>
<em>Requires preselected pinboard (like in composer)</em>
<div
style="background: #f6f6f6; padding-left: 420px; display: inline-block"
>
<div style="width: 195px">
<pinboard-suggest-alternate-crops
data-media-id="d6518ba44eb272830b779e4ed6356482007d4536"
></pinboard-suggest-alternate-crops>
</div>
</div>

<div style="max-width: 180px">
<h4>Fronts Clipboard Card:</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
></pinboard-article-button>
</div>
<h4>Fronts Article Cards [Collapsed]:</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
></pinboard-article-button>
<br />
<h4>Fronts Article Cards [Expanded]</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
data-with-draggable-thumbs-of-ratio="5:4"
></pinboard-article-button>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
data-with-draggable-thumbs-of-ratio="4:5"
></pinboard-article-button>
<h3><code>Add to 📌</code> button</h3>
<ul id="button_section">
<h4>present initially</h4>
Expand Down
72 changes: 49 additions & 23 deletions cdk/lib/__snapshots__/stack.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2449,7 +2449,7 @@ Object {
type Query {
# database-bridge-lambda queries
listItems(pinboardId: String!): [Item]
listItems(pinboardId: String!, maybeAspectRatioFilter: String): [Item]
listLastItemSeenByUsers(pinboardId: String!): [LastItemSeenByUser]
getMyUser: MyUser
searchMentionableUsers(prefix: String!): UsersAndGroups
Expand All @@ -2459,6 +2459,7 @@ type Query {
# workflow-bridge-lambda queries
listPinboards(searchText: String): [WorkflowStub]
getPinboardsByIds(ids: [String!]!): [WorkflowStub]
getPinboardsByPaths(paths: [String!]!): [WorkflowStub]
getPinboardByComposerId(composerId: String!): WorkflowStub
# grid-bridge-lambda queries
getGridSearchSummary(apiUrl: String!): GridSearchSummary
Expand Down Expand Up @@ -2563,6 +2564,7 @@ type WorkflowStub {
title: String
headline: String
composerId: String
path: String
status: String
trashed: Boolean
isNotFound: Boolean
Expand Down Expand Up @@ -2628,6 +2630,9 @@ type PinboardIdWithItemCounts {
pinboardId: String!
unreadCount: Int!
totalCount: Int!
totalCropCount: Int!
fiveByFourCount: Int!
fourByFiveCount: Int!
}
",
},
Expand Down Expand Up @@ -2675,7 +2680,7 @@ type PinboardIdWithItemCounts {
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "addManuallyOpenedPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2696,7 +2701,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "changeFeatureFlag",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2717,7 +2722,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "claimItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2738,7 +2743,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "createItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2759,7 +2764,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "deleteItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2780,7 +2785,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "editItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2801,7 +2806,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "removeManuallyOpenedPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2822,7 +2827,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "seenItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2843,7 +2848,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "setWebPushSubscriptionForUser",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2864,7 +2869,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "visitTourStep",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2885,7 +2890,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getGroupPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2906,7 +2911,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getItemCounts",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2927,7 +2932,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getMyUser",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2948,7 +2953,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2969,7 +2974,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "listItems",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2990,7 +2995,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "listLastItemSeenByUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3011,7 +3016,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "searchMentionableUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down Expand Up @@ -3140,7 +3145,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "grid_bridge_lambda_ds",
"FieldName": "asGridPayload",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3161,7 +3166,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "grid_bridge_lambda_ds",
"FieldName": "getGridSearchSummary",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down Expand Up @@ -3290,7 +3295,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardByComposerId",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3311,7 +3316,28 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardsByIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
},
"pinboardappsyncapiworkflowbridgelambdadsQuerygetPinboardsByPathsResolver98DFC3B6": Object {
"DependsOn": Array [
"pinboardappsyncapiSchema868D9F5B",
"pinboardappsyncapiworkflowbridgelambdadsD8193E3E",
],
"Properties": Object {
"ApiId": Object {
"Fn::GetAtt": Array [
"pinboardappsyncapi9D519400",
"ApiId",
],
},
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardsByPaths",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3332,7 +3358,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "listPinboards",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down
15 changes: 12 additions & 3 deletions client/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const pinboardReturnFields = `
headline
trashed
isNotFound
path
`;
export const gqlListPinboards = gql`
query MyQuery($searchText: String!) {
Expand All @@ -24,6 +25,11 @@ export const gqlGetPinboardsByIds = gql`
getPinboardsByIds(ids: $ids) { ${pinboardReturnFields} }
}
`;
export const gqlGetPinboardsByPaths = gql`
query MyQuery($paths: [String!]!) {
getPinboardsByPaths(paths: $paths) { ${pinboardReturnFields} }
}
`;
export const gqlGetGroupPinboardIds = gql`
query MyQuery {
getGroupPinboardIds {
Expand All @@ -43,6 +49,9 @@ export const gqlGetItemCounts = gql`
pinboardId
totalCount
unreadCount
totalCropCount
fiveByFourCount
fourByFiveCount
}
}
`;
Expand Down Expand Up @@ -71,9 +80,9 @@ const itemReturnFields = `
`;

// TODO: consider updating the resolver (cdk/stack.ts) to use a Query with a secondary index (if performance degrades when we have lots of items)
export const gqlGetInitialItems = (pinboardId: string) => gql`
query MyQuery {
listItems(pinboardId: "${pinboardId}") {
export const gqlGetInitialItems = gql`
query MyQuery($pinboardId: String!, $maybeAspectRatioFilter: String) {
listItems(pinboardId: $pinboardId, maybeAspectRatioFilter: $maybeAspectRatioFilter) {
${itemReturnFields}
}
}
Expand Down
Loading

0 comments on commit 7c1e5d8

Please sign in to comment.